Re: [PATCH v11 2/4] usb: add apis for offload usage tracking
From: Greg KH
Date: Fri Apr 11 2025 - 10:01:36 EST
On Tue, Apr 08, 2025 at 03:57:22AM +0000, Guan-Yu Lin wrote:
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -647,6 +647,7 @@ struct usb3_lpm_parameters {
> * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
> * Will be used as wValue for SetIsochDelay requests.
> * @use_generic_driver: ask driver core to reprobe using the generic driver.
> + * @offload_usage: number of offload activities happening on this usb device.
> *
> * Notes:
> * Usbcore drivers should not set usbdev->state directly. Instead use
> @@ -733,6 +734,8 @@ struct usb_device {
>
> u16 hub_delay;
> unsigned use_generic_driver:1;
> +
> + refcount_t offload_usage;
You now have 2 different "refcounts" for the same structure, which of
course is crazy and will do nothing but cause massive problems.
I know this isn't going to be used to "reference count" the structure,
and surely you don't need/want the atomic properties of a "real"
reference count, so why isn't this a simple integer?
thanks,
greg k-h