All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: linux-usb@vger.kernel.org, Wentong Wu <wentong.wu@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH 1/3] usb: misc: ljca: move usb_autopm_put_interface() after wait for response
Date: Mon, 4 Nov 2024 15:37:10 +0100	[thread overview]
Message-ID: <ZyjcFltIgCS/YqdZ@linux.intel.com> (raw)
In-Reply-To: <0e0d4146-a083-4263-a06b-c6277e89ddc5@redhat.com>

On Mon, Nov 04, 2024 at 02:39:57PM +0100, Hans de Goede wrote:
> 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@vger.kernel.org
> > Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
> > ---
> >  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.

Good point, thanks for catching this, I will fix and post v2.

Regards
Stanislaw


      reply	other threads:[~2024-11-04 14:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  8:50 [PATCH 1/3] usb: misc: ljca: move usb_autopm_put_interface() after wait for response Stanislaw Gruszka
2024-11-04  8:50 ` [PATCH 2/3] usb: misc: ljca: set small runtime autosuspend delay Stanislaw Gruszka
2024-11-04 13:50   ` Hans de Goede
2024-11-05 14:42     ` Stanislaw Gruszka
2024-11-04 15:13   ` Sakari Ailus
2024-11-05  6:41     ` Stanislaw Gruszka
2024-11-04  8:50 ` [PATCH 3/3] usb: misc: ljca: print firmware version Stanislaw Gruszka
2024-11-04 13:51   ` Hans de Goede
2024-11-04 22:32   ` Sakari Ailus
2024-11-04 13:39 ` [PATCH 1/3] usb: misc: ljca: move usb_autopm_put_interface() after wait for response Hans de Goede
2024-11-04 14:37   ` Stanislaw Gruszka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZyjcFltIgCS/YqdZ@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=wentong.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.