greybus: usb: Create separate module
Create separate module for usb gpbridge driver.
Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile
index e99a9a8..592525c 100644
--- a/drivers/staging/greybus/Makefile
+++ b/drivers/staging/greybus/Makefile
@@ -14,8 +14,7 @@
operation.o \
legacy.o
-gb-phy-y := gpbridge.o \
- usb.o
+gb-phy-y := gpbridge.o
# Prefix all modules with gb-
gb-vibrator-y := vibrator.o
@@ -40,6 +39,7 @@
gb-pwm-y := pwm.o
gb-gpio-y := gpio.o
gb-i2c-y := i2c.o
+gb-usb-y := usb.o
obj-m += greybus.o
obj-m += gb-phy.o
@@ -68,6 +68,7 @@
obj-m += gb-pwm.o
obj-m += gb-gpio.o
obj-m += gb-i2c.o
+obj-m += gb-usb.o
KERNELVER ?= $(shell uname -r)
KERNELDIR ?= /lib/modules/$(KERNELVER)/build
diff --git a/drivers/staging/greybus/gpbridge.c b/drivers/staging/greybus/gpbridge.c
index 5a65564..67f18ac 100644
--- a/drivers/staging/greybus/gpbridge.c
+++ b/drivers/staging/greybus/gpbridge.c
@@ -317,15 +317,8 @@
goto error_gpbridge;
}
- if (gb_usb_driver_init()) {
- pr_err("error initializing usb driver\n");
- goto error_usb;
- }
-
return 0;
-error_usb:
- greybus_deregister(&gb_gpbridge_driver);
error_gpbridge:
bus_unregister(&gpbridge_bus_type);
ida_destroy(&gpbridge_id);
@@ -335,8 +328,6 @@
static void __exit gpbridge_exit(void)
{
- gb_usb_driver_exit();
-
greybus_deregister(&gb_gpbridge_driver);
bus_unregister(&gpbridge_bus_type);
ida_destroy(&gpbridge_id);
diff --git a/drivers/staging/greybus/gpbridge.h b/drivers/staging/greybus/gpbridge.h
index 532dd56..d4339e6 100644
--- a/drivers/staging/greybus/gpbridge.h
+++ b/drivers/staging/greybus/gpbridge.h
@@ -66,9 +66,6 @@
gb_gpbridge_deregister(&__driver); \
}
-extern int gb_usb_driver_init(void);
-extern void gb_usb_driver_exit(void);
-
/**
* module_gpbridge_driver() - Helper macro for registering a gpbridge driver
* @__gpbridge_driver: gpbridge_driver structure
diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c
index 2b4789b..2f68a1b 100644
--- a/drivers/staging/greybus/usb.c
+++ b/drivers/staging/greybus/usb.c
@@ -242,6 +242,7 @@
{ GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_USB) },
{ },
};
+MODULE_DEVICE_TABLE(gpbridge, gb_usb_id_table);
static struct gpbridge_driver usb_driver = {
.name = "usb",
@@ -249,4 +250,6 @@
.remove = gb_usb_remove,
.id_table = gb_usb_id_table,
};
-gb_gpbridge_builtin_driver(usb_driver);
+
+module_gpbridge_driver(usb_driver);
+MODULE_LICENSE("GPL v2");