[alsa-devel] [PATCH v2] Scarlett mixer interface inclusion

Takashi Iwai tiwai at suse.de
Wed Nov 5 13:39:30 CET 2014


At Wed, 05 Nov 2014 12:33:37 +0100,
Takashi Iwai wrote:
> 
> At Wed, 22 Oct 2014 08:36:50 +0200,
> Takashi Iwai wrote:
> > 
> > > 2) When unloading a device there are numerous sysfs_remove_group issues:
> > > usb 1-1.1: USB disconnect, device number 6
> > > ------------[ cut here ]------------
> > > WARNING: CPU: 0 PID: 54 at /build/buildd/linux-3.16.0/fs/sysfs/group.c:219 sysfs_remove_group+0x99/0xa0()
> > > sysfs group ffffffff82cbd6e0 not found for kobject 'midi1'
> > (snip)
> > > However this issue occured even without the patch applied.
> > 
> > Yes, there was a similar report, but we couldn't reproduce here.
> > It's a Oops coming from OSS midi device.  This is fairly harmless, but
> > annoying.  Could you give your kernel config?  Maybe there's some
> > difference.
> 
> I'm now checking this issue again, and I still couldn't reproduce it
> on my local machines.  Could you give your kernel config if this still
> happens?
> 
> Also, as a blind shot: does the patch below give any difference?

Try the one below instead.  This is for 3.18 but should be applicable
to older kernels, too.  (It's not applicable to for-next branch due to
the recent cleanups, though.)


Takashi

---
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 7ecd0e8a5c51..f61ebb17cc64 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -591,18 +591,19 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 {
 	struct snd_card *card;
 	struct list_head *p;
+	bool was_shutdown;
 
 	if (chip == (void *)-1L)
 		return;
 
 	card = chip->card;
 	down_write(&chip->shutdown_rwsem);
+	was_shutdown = chip->shutdown;
 	chip->shutdown = 1;
 	up_write(&chip->shutdown_rwsem);
 
 	mutex_lock(&register_mutex);
-	chip->num_interfaces--;
-	if (chip->num_interfaces <= 0) {
+	if (!was_shutdown) {
 		struct snd_usb_endpoint *ep;
 
 		snd_card_disconnect(card);
@@ -622,6 +623,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 		list_for_each(p, &chip->mixer_list) {
 			snd_usb_mixer_disconnect(p);
 		}
+	}
+
+	chip->num_interfaces--;
+	if (chip->num_interfaces <= 0) {
 		usb_chip[chip->index] = NULL;
 		mutex_unlock(&register_mutex);
 		snd_card_free_when_closed(card);


More information about the Alsa-devel mailing list