.request_recv = NULL, /* no incoming requests */
};
-int gb_i2c_protocol_init(void)
-{
- return gb_protocol_register(&i2c_protocol);
-}
+gb_protocol_driver(&i2c_protocol);
-void gb_i2c_protocol_exit(void)
-{
- gb_protocol_deregister(&i2c_protocol);
-}
+MODULE_LICENSE("GPL v2");
pr_err("error initializing gpio protocol\n");
ret = false;
}
- if (gb_i2c_protocol_init()) {
- pr_err("error initializing i2c protocol\n");
- ret = false;
- }
if (gb_pwm_protocol_init()) {
pr_err("error initializing pwm protocol\n");
ret = false;
gb_vibrator_protocol_exit();
gb_sdio_protocol_exit();
gb_uart_protocol_exit();
- gb_i2c_protocol_exit();
gb_gpio_protocol_exit();
gb_battery_protocol_exit();
}
extern int gb_gpio_protocol_init(void);
extern void gb_gpio_protocol_exit(void);
-extern int gb_i2c_protocol_init(void);
-extern void gb_i2c_protocol_exit(void);
-
extern int gb_pwm_protocol_init(void);
extern void gb_pwm_protocol_exit(void);
bool gb_protocol_init(void);
void gb_protocol_exit(void);
+#define gb_protocol_driver(__protocol) \
+static int __init protocol_init(void) \
+{ \
+ return gb_protocol_register(__protocol); \
+} \
+module_init(protocol_init); \
+static void __exit protocol_exit(void) \
+{ \
+ gb_protocol_deregister(__protocol); \
+} \
+module_exit(protocol_exit);
+
#endif /* __PROTOCOL_H */