Skip to contentSkip to conversation

ALSA: usb-audio: Fix superfluous autosuspend recovery

PATCH In review Takashi Iwai 2 participants 3 messages Jul 25, 2021 – Jul 26, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Fix superfluous autosuspend recovery

The change to restore the autosuspend from the disabled state uses a wrong check: namely, it should have been the exact comparison of the quirk_type instead of the logical and (&&). Otherwise it matches wrongly with the other quirk types.

Although re-enabling the autosuspend for the already enabled device shouldn't matter much, it's better to fix the unbalanced call.

Fixes 9799110825db ("ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()")
---
 sound/usb/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +1 -1
index 2f6a62416c05..a1f8c3a026f5 100644
@@ -907,7 +907,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
 		}
 	}
 
-	if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)
+	if (chip->quirk_type == QUIRK_SETUP_DISABLE_AUTOSUSPEND)
 		usb_enable_autosuspend(interface_to_usbdev(intf));
 
 	chip->num_interfaces--;
Signature · 1 line
2.26.2
#1 lore raw
Quoted 21 lines · Takashi Iwai

The change to restore the autosuspend from the disabled state uses a wrong check: namely, it should have been the exact comparison of the quirk_type instead of the logical and (&&). Otherwise it matches wrongly with the other quirk types.

Although re-enabling the autosuspend for the already enabled device shouldn't matter much, it's better to fix the unbalanced call.

Fixes 9799110825db ("ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()")
---
 sound/usb/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +0 -0
index 2f6a62416c05..a1f8c3a026f5 100644

sound/usb/card.c static void usb_audio_disconnect(struct usb_interface *intf) · line 910

Quoted 4 lines
sound/usb/card.c +0 -1
@@ -907,7 +907,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
                }
        }
 
-       if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)

It was bitwise and, not logical and...

Kai-Heng

Quoted 7 lines
sound/usb/card.c +1 -1
+       if (chip->quirk_type == QUIRK_SETUP_DISABLE_AUTOSUSPEND)
                usb_enable_autosuspend(interface_to_usbdev(intf));
 
        chip->num_interfaces--;
--

2.26.2

#2 lore raw
Quoted 26 lines · Kai-Heng Feng
Quoted 24 lines · Takashi Iwai

The change to restore the autosuspend from the disabled state uses a wrong check: namely, it should have been the exact comparison of the quirk_type instead of the logical and (&&). Otherwise it matches wrongly with the other quirk types.

Although re-enabling the autosuspend for the already enabled device shouldn't matter much, it's better to fix the unbalanced call.

Fixes 9799110825db ("ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()")
---
 sound/usb/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +0 -0
index 2f6a62416c05..a1f8c3a026f5 100644
@@ -907,7 +907,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
                }
        }
 
Quoted 3 lines

sound/usb/card.c static void usb_audio_disconnect(struct usb_interface *intf) · line 910

Quoted 1 line
sound/usb/card.c +0 -1
-       if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)

It was bitwise and, not logical and...

Gah, the commit message was just wrong.
The revised one is below.

thanks,

Takashi

-- 8< --
From: Takashi Iwai <[email protected]>
Subject: [PATCH v2] ALSA: usb-audio: Fix superfluous autosuspend recovery

The change to restore the autosuspend from the disabled state uses a wrong check: namely, it should have been the exact comparison of the quirk_type instead of the bitwise and (&). Otherwise it matches wrongly with the other quirk types.

Although re-enabling the autosuspend for the already enabled device shouldn't matter much, it's better to fix the unbalanced call.

Fixes 9799110825db ("ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()")
---
 sound/usb/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +1 -1
index 2f6a62416c05..a1f8c3a026f5 100644
@@ -907,7 +907,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
 		}
 	}
 
-	if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)
+	if (chip->quirk_type == QUIRK_SETUP_DISABLE_AUTOSUSPEND)
 		usb_enable_autosuspend(interface_to_usbdev(intf));
 
 	chip->num_interfaces--;
Signature · 1 line
2.26.2