greybus: i2c-gb: split out into a stand-alone kernel module.
This splits the i2c-gb protocol into a stand-alone kernel module. It's not going to stay in this fashion for long, this was done to test the "can a protcol be loaded later" logic. Future refactoring is going to move the gpbridge protocols to a separate kernel module, where this protocol is going to live. But for now, split it out, it is good to test with, and shows a bug in gbsim at the moment. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
parent
fb69cb506c
commit
900ceba9e4
|
@ -8,7 +8,6 @@ greybus-y := core.o \
|
||||||
connection.o \
|
connection.o \
|
||||||
protocol.o \
|
protocol.o \
|
||||||
operation.o \
|
operation.o \
|
||||||
i2c-gb.o \
|
|
||||||
gpio-gb.o \
|
gpio-gb.o \
|
||||||
pwm-gb.o \
|
pwm-gb.o \
|
||||||
sdio-gb.o \
|
sdio-gb.o \
|
||||||
|
@ -18,6 +17,7 @@ greybus-y := core.o \
|
||||||
usb-gb.o
|
usb-gb.o
|
||||||
|
|
||||||
obj-m += greybus.o
|
obj-m += greybus.o
|
||||||
|
obj-m += i2c-gb.o
|
||||||
obj-m += es1-ap-usb.o
|
obj-m += es1-ap-usb.o
|
||||||
|
|
||||||
KERNELVER ?= $(shell uname -r)
|
KERNELVER ?= $(shell uname -r)
|
||||||
|
|
|
@ -438,12 +438,6 @@ static struct gb_protocol i2c_protocol = {
|
||||||
.request_recv = NULL, /* no incoming requests */
|
.request_recv = NULL, /* no incoming requests */
|
||||||
};
|
};
|
||||||
|
|
||||||
int gb_i2c_protocol_init(void)
|
gb_protocol_driver(&i2c_protocol);
|
||||||
{
|
|
||||||
return gb_protocol_register(&i2c_protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gb_i2c_protocol_exit(void)
|
MODULE_LICENSE("GPL v2");
|
||||||
{
|
|
||||||
gb_protocol_deregister(&i2c_protocol);
|
|
||||||
}
|
|
||||||
|
|
|
@ -184,10 +184,6 @@ bool gb_protocol_init(void)
|
||||||
pr_err("error initializing gpio protocol\n");
|
pr_err("error initializing gpio protocol\n");
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
if (gb_i2c_protocol_init()) {
|
|
||||||
pr_err("error initializing i2c protocol\n");
|
|
||||||
ret = false;
|
|
||||||
}
|
|
||||||
if (gb_pwm_protocol_init()) {
|
if (gb_pwm_protocol_init()) {
|
||||||
pr_err("error initializing pwm protocol\n");
|
pr_err("error initializing pwm protocol\n");
|
||||||
ret = false;
|
ret = false;
|
||||||
|
@ -217,7 +213,6 @@ void gb_protocol_exit(void)
|
||||||
gb_vibrator_protocol_exit();
|
gb_vibrator_protocol_exit();
|
||||||
gb_sdio_protocol_exit();
|
gb_sdio_protocol_exit();
|
||||||
gb_uart_protocol_exit();
|
gb_uart_protocol_exit();
|
||||||
gb_i2c_protocol_exit();
|
|
||||||
gb_gpio_protocol_exit();
|
gb_gpio_protocol_exit();
|
||||||
gb_battery_protocol_exit();
|
gb_battery_protocol_exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,6 @@ extern void gb_battery_protocol_exit(void);
|
||||||
extern int gb_gpio_protocol_init(void);
|
extern int gb_gpio_protocol_init(void);
|
||||||
extern void gb_gpio_protocol_exit(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 int gb_pwm_protocol_init(void);
|
||||||
extern void gb_pwm_protocol_exit(void);
|
extern void gb_pwm_protocol_exit(void);
|
||||||
|
|
||||||
|
@ -74,4 +71,16 @@ extern void gb_usb_protocol_exit(void);
|
||||||
bool gb_protocol_init(void);
|
bool gb_protocol_init(void);
|
||||||
void gb_protocol_exit(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 */
|
#endif /* __PROTOCOL_H */
|
||||||
|
|
Loading…
Reference in a new issue