Re: [PATCH 1/3] usb: misc: ljca: move usb_autopm_put_interface() after wait for response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 4-Nov-24 9:50 AM, Stanislaw Gruszka wrote:
> Do not mark interface as ready to suspend when we are still waiting
> for response messages from the device.
> 
> Fixes: acd6199f195d ("usb: Add support for Intel LJCA device")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/misc/usb-ljca.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/misc/usb-ljca.c b/drivers/usb/misc/usb-ljca.c
> index 01ceafc4ab78..dcb3c5d248ac 100644
> --- a/drivers/usb/misc/usb-ljca.c
> +++ b/drivers/usb/misc/usb-ljca.c
> @@ -332,9 +332,6 @@ static int ljca_send(struct ljca_adapter *adap, u8 type, u8 cmd,
>  
>  	ret = usb_bulk_msg(adap->usb_dev, adap->tx_pipe, header,
>  			   msg_len, &transferred, LJCA_WRITE_TIMEOUT_MS);
> -
> -	usb_autopm_put_interface(adap->intf);
> -
>  	if (ret < 0)
>  		goto out;
>  	if (transferred != msg_len) {
> @@ -353,6 +350,8 @@ static int ljca_send(struct ljca_adapter *adap, u8 type, u8 cmd,
>  	ret = adap->actual_length;
>  
>  out:
> +	usb_autopm_put_interface(adap->intf);
> +

I'm afraid that this now does a double pm_runtime_put() on
usb_autopm_get_interface() failures. usb_autopm_get_interface() uses
pm_runtime_resume_and_get() which already does a pm_runtime_put()
on failure.

So you need to add a second out label which skips the new
location of the usb_autopm_put_interface(adap->intf); call
and jump to this second label on usb_autopm_get_interface()
failures.

With that fixed this is:

Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>

I have also given this a test run on a "ThinkPad X1 Yoga Gen 8" and
everything there works at least as well as before:

Tested-by: Hans de Goede <hdegoede@xxxxxxxxxx> # ThinkPad X1 Yoga Gen 8, ov2740

Regards,

Hans




>  	spin_lock_irqsave(&adap->lock, flags);
>  	adap->ex_buf = NULL;
>  	adap->ex_buf_len = 0;





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux