Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PNP: Add helper macro for pnp_register_driver boilerplate

This patch introduces the module_pnp_driver macro which is a
convenience macro for PNP driver modules similar to module_pci_driver.
It is intended to be used by drivers which init/exit section does nothing
but register/unregister the PNP driver. By using this macro it is
possible to eliminate a few lines of boilerplate code per PNP driver.

Based on work done by Lars-Peter Clausen <lars@metafoo.de> for other
busses (i2c and spi) and Greg KH for PCI.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Peter Huewe and committed by
Rafael J. Wysocki
95c0fd45 2eb1eb02

+12
+12
include/linux/pnp.h
··· 510 510 511 511 #endif /* CONFIG_PNP */ 512 512 513 + /** 514 + * module_pnp_driver() - Helper macro for registering a PnP driver 515 + * @__pnp_driver: pnp_driver struct 516 + * 517 + * Helper macro for PnP drivers which do not do anything special in module 518 + * init/exit. This eliminates a lot of boilerplate. Each module may only 519 + * use this macro once, and calling it replaces module_init() and module_exit() 520 + */ 521 + #define module_pnp_driver(__pnp_driver) \ 522 + module_driver(__pnp_driver, pnp_register_driver, \ 523 + pnp_unregister_driver) 524 + 513 525 #endif /* _LINUX_PNP_H */