[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOuDEK2Ukhe=arXQLqfcksxXbpXA5q-9HHd-yr-rn_qrPjXWoQ@mail.gmail.com>
Date: Thu, 3 Apr 2025 15:34:00 +0800
From: Guan-Yu Lin <guanyulin@...gle.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: gregkh@...uxfoundation.org, mathias.nyman@...el.com, sumit.garg@...nel.org,
kekrby@...il.com, jeff.johnson@....qualcomm.com, elder@...nel.org,
quic_zijuhu@...cinc.com, ben@...adent.org.uk, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 2/4] usb: add apis for offload usage tracking
On Tue, Apr 1, 2025 at 10:24 PM Alan Stern <stern@...land.harvard.edu> wrote:
>
> On Tue, Apr 01, 2025 at 06:22:40AM +0000, Guan-Yu Lin wrote:
> > +
> > + /*
> > + * offload_usage could only be modified when the device is active, since
> > + * it will alter the suspend flow of the device.
> > + */
> > + ret = pm_runtime_resume_and_get(&udev->dev);
> > +
> > + if (ret < 0)
> > + return ret;
> > +
> > + refcount_inc(&udev->offload_usage);
> > + pm_runtime_put_sync(&udev->dev);
>
> The USB subsystem has wrappers: usb_autoresume_device() and
> usb_autosuspend_device(). You should use them instead of calling the
> runtime PM routines directly.
>
> The same advice applies to usb_offload_put().
>
> Alan Stern
Thanks for the suggestion, I'll include the change in the next version.
Powered by blists - more mailing lists