Alex, On Fri, Aug 25, 2017 at 06:26:03PM +0300, Alex Briskin wrote: > Hi Andy, > I'm not sure what to make from your comment. I meant instead of module_driver(hdm_usb, usb_register, usb_deregister); use module_usb_driver(hdm_usb); since $ grep def.*module_usb_driver include/linux/ -rnA3 include/linux/usb.h:1265:#define module_usb_driver(__usb_driver) \ include/linux/usb.h-1266- module_driver(__usb_driver, usb_register, \ include/linux/usb.h-1267- usb_deregister) include/linux/usb.h-1268- Thanks, Andy > I stand by my patch. > According to device.h module_driver is a variadic macro requiring at > least 3 parameters. > Please see below quote: > /** > * module_driver() - Helper macro for drivers that don't do anything > * special in module init/exit. This eliminates a lot of boilerplate. > * Each module may only use this macro once, and calling it replaces > * module_init() and module_exit(). > * > * @__driver: driver name > * @__register: register function for this driver type > * @__unregister: unregister function for this driver type > * @...: Additional arguments to be passed to __register and __unregister. > * > * Use this macro to construct bus specific macros for registering > * drivers, and do not use it on its own. > */ > #define module_driver(__driver, __register, __unregister, ...) \ > static int __init __driver##_init(void) \ > { \ > return __register(&(__driver) , ##__VA_ARGS__); \ > } \ > module_init(__driver##_init); \ > static void __exit __driver##_exit(void) \ > { \ > __unregister(&(__driver) , ##__VA_ARGS__); \ > } \ > module_exit(__driver##_exit); > > Please clarify what you meant! > Thanks, > Alex > On 08/25/2017 04:27 PM, Andrey Shvetsov wrote: > >On Fri, Aug 25, 2017 at 12:47:33PM +0300, Alex Briskin wrote: > >>1. Remove redundant functions. > >>2. Remove potentially misleading return code (-EIO). > >>3. Add module_driver driver registration macro. > >>* Will also remove pr_info messages. > >> > >>Signed-off-by: Alex Briskin <br.shurik@xxxxxxxxx> > >>--- > >> drivers/staging/most/hdm-usb/hdm_usb.c | 20 +------------------- > >> 1 file changed, 1 insertion(+), 19 deletions(-) > >> > >>diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c > >>index a9c3785d19ae..a662cba76d00 100644 > >>--- a/drivers/staging/most/hdm-usb/hdm_usb.c > >>+++ b/drivers/staging/most/hdm-usb/hdm_usb.c > >>@@ -1301,25 +1301,7 @@ static struct usb_driver hdm_usb = { > >> .disconnect = hdm_disconnect, > >> }; > >>-static int __init hdm_usb_init(void) > >>-{ > >>- pr_info("hdm_usb_init()\n"); > >>- if (usb_register(&hdm_usb)) { > >>- pr_err("could not register hdm_usb driver\n"); > >>- return -EIO; > >>- } > >>- > >>- return 0; > >>-} > >>- > >>-static void __exit hdm_usb_exit(void) > >>-{ > >>- pr_info("hdm_usb_exit()\n"); > >>- usb_deregister(&hdm_usb); > >>-} > >>- > >>-module_init(hdm_usb_init); > >>-module_exit(hdm_usb_exit); > >>+module_driver(hdm_usb, usb_register, usb_deregister); > >-module_driver(hdm_usb, usb_register, usb_deregister); > >+module_usb_driver(hdm_usb); > > > >/andy > > _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel