]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda: Fix driver index handling at re-binding
authorTakashi Iwai <tiwai@suse.de>
Wed, 9 Feb 2022 08:19:12 +0000 (09:19 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 9 Feb 2022 08:20:11 +0000 (09:20 +0100)
commit7e54e62e789b16bc6fa7d9b38351c0ea12a46cdf
treea9fc6a392c61295d7470abe58d0d894f399c674f
parentb36a7d1005876d43e5103fd885804542849192be
ALSA: hda: Fix driver index handling at re-binding

HD-audio driver handles the multiple instances and keeps the static
index that is incremented at each probe.  This becomes a problem when
user tries to re-bind the device via sysfs multiple times; as the
device index isn't cleared unlike rmmod case, it points to the next
element at re-binding, and eventually later you can't probe any more
when it reaches to SNDRV_CARDS_MAX (usually 32).

This patch is an attempt to improve the handling at rebinding.
Instead of a static device index, now we keep a bitmap and assigns to
the first zero bit position.  At the driver remove, in return, the
bitmap slot is cleared again, so that it'll be available for the next
probe.

Reported-by: Alexander Sergeyev <sergeev917@gmail.com>
Link: https://lore.kernel.org/r/20220209081912.20687-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_intel.c