greybus: gpbridge: Add gpbridge driver init/exit helper macros
authorVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Thu, 5 May 2016 09:02:28 +0000 (14:32 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 5 May 2016 20:38:57 +0000 (13:38 -0700)
In order to help bridged-phy drivers to define init()/exit()
functions, define helper macro in gpbridge.h file.

Testing Done: Tested on gbsim.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/gpbridge.h

index 431cb7b..aa2cdc0 100644 (file)
@@ -56,6 +56,16 @@ void gb_gpbridge_deregister_driver(struct gpbridge_driver *driver);
 #define gb_gpbridge_deregister(driver) \
        gb_gpbridge_deregister_driver(driver)
 
+#define gb_gpbridge_builtin_driver(__driver)           \
+       int __init gb_##__driver##_init(void)           \
+{                                                      \
+       return gb_gpbridge_register(&__driver);         \
+}                                                      \
+void gb_##__driver##_exit(void)                                \
+{                                                      \
+       gb_gpbridge_deregister(&__driver);                      \
+}
+
 extern int gb_gpio_protocol_init(void);
 extern void gb_gpio_protocol_exit(void);