]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: i2c-gb: move i2c protocol into the gpbridge driver
authorGreg Kroah-Hartman <greg@kroah.com>
Wed, 24 Dec 2014 21:01:44 +0000 (13:01 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 2 Jan 2015 21:05:42 +0000 (13:05 -0800)
The i2c protocol belongs in the gpbridge driver, so move it
there.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
drivers/staging/greybus/Makefile
drivers/staging/greybus/gpb.c
drivers/staging/greybus/i2c-gb.c
drivers/staging/greybus/protocol.h

index 5d73aede91dfdc15af9e43aaa7357bc2ee9695d9..8e6551b08a9337c6b171f822e9eb5526aabc518f 100644 (file)
@@ -14,11 +14,11 @@ gpbridge-y :=       gpb.o           \
                uart-gb.o       \
                pwm-gb.o        \
                gpio-gb.o       \
+               i2c-gb.o        \
                usb-gb.o
 
 obj-m += greybus.o
 obj-m += gpbridge.o
-obj-m += i2c-gb.o
 obj-m += vibrator-gb.o
 obj-m += battery-gb.o
 obj-m += es1-ap-usb.o
index 0c4f46c4d4586305ad0c87722431124f02e2b5d8..0776df65e4b6e15edabe589dee430d91ba28f930 100644 (file)
@@ -41,8 +41,14 @@ static int __init gpbridge_init(void)
                pr_err("error initializing usb protocol\n");
                goto error_usb;
        }
+       if (gb_i2c_protocol_init()) {
+               pr_err("error initializing usb protocol\n");
+               goto error_i2c;
+       }
        return 0;
 
+error_i2c:
+       gb_usb_protocol_exit();
 error_usb:
        gb_sdio_protocol_exit();
 error_sdio:
@@ -57,6 +63,7 @@ error_gpio:
 
 static void __exit gpbridge_exit(void)
 {
+       gb_i2c_protocol_exit();
        gb_usb_protocol_exit();
        gb_sdio_protocol_exit();
        gb_uart_protocol_exit();
index d430beac9d5ce8547499f7ee4afeca2efe8a147c..b78de6b4be10b268d69e9f4746672c099374943c 100644 (file)
@@ -438,6 +438,12 @@ static struct gb_protocol i2c_protocol = {
        .request_recv           = NULL, /* no incoming requests */
 };
 
-gb_protocol_driver(&i2c_protocol);
+int gb_i2c_protocol_init(void)
+{
+       return gb_protocol_register(&i2c_protocol);
+}
 
-MODULE_LICENSE("GPL v2");
+void gb_i2c_protocol_exit(void)
+{
+       gb_protocol_deregister(&i2c_protocol);
+}
index 1f6fd74a946fe59457bda3de5257f4d3413f4f50..2d4fcfac8052f1cd2ad4db98389b0d09151ceb3b 100644 (file)
@@ -66,6 +66,9 @@ extern void gb_sdio_protocol_exit(void);
 extern int gb_usb_protocol_init(void);
 extern void gb_usb_protocol_exit(void);
 
+extern int gb_i2c_protocol_init(void);
+extern void gb_i2c_protocol_exit(void);
+
 #define gb_protocol_driver(__protocol)                 \
 static int __init protocol_init(void)                  \
 {                                                      \