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 Wed, Jun 21, 2023 at 03:08:07PM +0400, Ivan Orlov wrote:
> On 20.06.2023 18:22, Greg Kroah-Hartman wrote:
> > 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
> 
> As I understood after reading the code, this kref is used for checking how
> many devices uses our class and testing when we can unregister it.
> 
> As we register our class only when the first device is registered, I think
> the best solution is to move this kref structure out of the usb_class
> structure as we still need it for detecting when we could finally unregister
> our class. What do you think about it?

I think we should make it simpler, allocate the class when we start up,
and free it when we shut down, which guarantees that all users of the
class are removed at that time as this is part of the usb core code.

No need to be fancy anymore with the dynamic creation/removal of the
class, it's just not worth it :)

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