usb: ulpi: Automatically set driver::owner with ulpi_driver_register()

Let's follow other driver registration functions and
automatically set the driver's owner member to THIS_MODULE when
ulpi_driver_register() is called. This allows ulpi driver writers
to forget about this boiler plate detail and avoids common bugs
in the process.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Stephen Boyd
2016-06-25 22:38:21 -07:00
committed by Greg Kroah-Hartman
parent 3cc7e7b787
commit 1ebe88d38d
2 changed files with 8 additions and 3 deletions

View File

@@ -47,7 +47,11 @@ struct ulpi_driver {
#define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
int ulpi_register_driver(struct ulpi_driver *drv);
/*
* use a macro to avoid include chaining to get THIS_MODULE
*/
#define ulpi_register_driver(drv) __ulpi_register_driver(drv, THIS_MODULE)
int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module);
void ulpi_unregister_driver(struct ulpi_driver *drv);
#define module_ulpi_driver(__ulpi_driver) \