Re: [PATCH 6/6] USB: file.c: make usb class a static const structure

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

 



On Tue, Jun 20, 2023 at 11:44:18AM +0200, Greg Kroah-Hartman wrote:
> From: Ivan Orlov <ivan.orlov0322@xxxxxxxxx>
> 
> Now that the driver core allows for struct class to be in read-only
> memory, remove the class field of the usb_class structure and
> create the usbmisc_class static class structure declared at build time
> which places it into read-only memory, instead of having it to be
> dynamically allocated at load time.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Ivan Orlov <ivan.orlov0322@xxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/usb/core/file.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
> index c4ed3310e069..0e16a9c048dd 100644
> --- a/drivers/usb/core/file.c
> +++ b/drivers/usb/core/file.c
> @@ -59,7 +59,6 @@ static const struct file_operations usb_fops = {
>  
>  static struct usb_class {
>  	struct kref kref;
> -	struct class *class;
>  } *usb_class;

Is this structure needed anymore at all now that the thing the kref was
"protecting" is gone?  I think it can be dropped entirely, right?

thanks,

greg k-h



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

  Powered by Linux