Re: [PATCH 03/18] vfio/mdev: Simplify driver registration

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

 



On Fri, Mar 26, 2021 at 09:10:48AM -0300, Jason Gunthorpe wrote:
> It is usually hidden and works like this:
> 
>  /* pci_register_driver() must be a macro so KBUILD_MODNAME can be expanded */
>  #define pci_register_driver(driver)		\
>  	__pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
>  
>  int __pci_register_driver(struct pci_driver *drv, struct module *owner,
>  			  const char *mod_name)
>  {
> 	drv->driver.owner = owner;
>   	drv->driver.mod_name = mod_name;

Indeed, there seem to be about two handful of instance of that.

> > I've not really seen that in anywere else, and the only user seems
> > to be module_add_driver for a rather odd case we shouldn't hit here.
> 
> vfio_mdev could be compiled built in? 
> 
> AFAICT it handles the case where THIS_MODULE==NULL so we still need to
> create sysfs links to the built in module.
> 
> If it is left NULL then a few sysfs files go missing for the built in
> mode but no harm done?

Yes, it seems to be needed for a few driver-specific files.  So it looks
ok, even if rather unexpected.



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux