aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/greybus
diff options
context:
space:
mode:
authorGravatar Greg Kroah-Hartman <greg@kroah.com> 2014-12-24 13:01:41 -0800
committerGravatar Greg Kroah-Hartman <greg@kroah.com> 2015-01-02 13:05:42 -0800
commit66b676fd88a681b149e98c462e2c0337c2848770 (patch)
tree0cc4c19957b783d83001b5eb6a138fc5e5171d97 /drivers/staging/greybus
parentgreybus: protocol: add a module owner to a protocol (diff)
downloadlinux-66b676fd88a681b149e98c462e2c0337c2848770.tar.gz
linux-66b676fd88a681b149e98c462e2c0337c2848770.tar.bz2
linux-66b676fd88a681b149e98c462e2c0337c2848770.zip
greybus: vibrator-gb: move vibrator protocol to a stand-alone module.
We can't use the gb_protocol_driver() macro here as we need to do some init and exit logic when loading and removing, so "open code" the module init and exit functions. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r--drivers/staging/greybus/Makefile2
-rw-r--r--drivers/staging/greybus/protocol.c5
-rw-r--r--drivers/staging/greybus/protocol.h3
-rw-r--r--drivers/staging/greybus/vibrator-gb.c9
4 files changed, 8 insertions, 11 deletions
diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile
index 6ce00c2b6e97..f7284680f6e0 100644
--- a/drivers/staging/greybus/Makefile
+++ b/drivers/staging/greybus/Makefile
@@ -13,11 +13,11 @@ greybus-y := core.o \
sdio-gb.o \
uart-gb.o \
battery-gb.o \
- vibrator-gb.o \
usb-gb.o
obj-m += greybus.o
obj-m += i2c-gb.o
+obj-m += vibrator-gb.o
obj-m += es1-ap-usb.o
KERNELVER ?= $(shell uname -r)
diff --git a/drivers/staging/greybus/protocol.c b/drivers/staging/greybus/protocol.c
index c6c0fd3ebea3..0d3c3367dab7 100644
--- a/drivers/staging/greybus/protocol.c
+++ b/drivers/staging/greybus/protocol.c
@@ -203,10 +203,6 @@ bool gb_protocol_init(void)
pr_err("error initializing sdio protocol\n");
ret = false;
}
- if (gb_vibrator_protocol_init()) {
- pr_err("error initializing vibrator protocol\n");
- ret = false;
- }
if (gb_usb_protocol_init()) {
pr_err("error initializing usb protocol\n");
ret = false;
@@ -217,7 +213,6 @@ bool gb_protocol_init(void)
void gb_protocol_exit(void)
{
gb_usb_protocol_exit();
- gb_vibrator_protocol_exit();
gb_sdio_protocol_exit();
gb_uart_protocol_exit();
gb_gpio_protocol_exit();
diff --git a/drivers/staging/greybus/protocol.h b/drivers/staging/greybus/protocol.h
index 62f024dd71bd..7b1c09c941b1 100644
--- a/drivers/staging/greybus/protocol.h
+++ b/drivers/staging/greybus/protocol.h
@@ -66,9 +66,6 @@ extern void gb_uart_protocol_exit(void);
extern int gb_sdio_protocol_init(void);
extern void gb_sdio_protocol_exit(void);
-extern int gb_vibrator_protocol_init(void);
-extern void gb_vibrator_protocol_exit(void);
-
extern int gb_usb_protocol_init(void);
extern void gb_usb_protocol_exit(void);
diff --git a/drivers/staging/greybus/vibrator-gb.c b/drivers/staging/greybus/vibrator-gb.c
index 3ef7d06160bb..71c96d3da9ed 100644
--- a/drivers/staging/greybus/vibrator-gb.c
+++ b/drivers/staging/greybus/vibrator-gb.c
@@ -205,7 +205,7 @@ static struct gb_protocol vibrator_protocol = {
.request_recv = NULL, /* no incoming requests */
};
-int gb_vibrator_protocol_init(void)
+static __init int protocol_init(void)
{
int retval;
@@ -216,8 +216,13 @@ int gb_vibrator_protocol_init(void)
return gb_protocol_register(&vibrator_protocol);
}
-void gb_vibrator_protocol_exit(void)
+static __exit void protocol_exit(void)
{
gb_protocol_deregister(&vibrator_protocol);
class_unregister(&vibrator_class);
}
+
+module_init(protocol_init);
+module_exit(protocol_exit);
+
+MODULE_LICENSE("GPL v2");