From d6046b44a5663865a316f9d73a44d64c99aa9fb2 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 9 May 2016 18:15:07 +0530 Subject: [PATCH] greybus: i2c : Create separate module Create separate module for i2c gpbridge driver. Tested on EVT 1.5 by inserting GP test module, all the devices were enumerated correctly. Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/Makefile | 3 ++- drivers/staging/greybus/gpbridge.c | 7 ------- drivers/staging/greybus/gpbridge.h | 3 --- drivers/staging/greybus/i2c.c | 5 ++++- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile index e5c784d..b9e4e96 100644 --- a/drivers/staging/greybus/Makefile +++ b/drivers/staging/greybus/Makefile @@ -18,7 +18,6 @@ gb-phy-y := gpbridge.o \ sdio.o \ uart.o \ pwm.o \ - i2c.o \ spi.o \ usb.o @@ -40,6 +39,7 @@ gb-audio-manager-y += audio_manager_module.o gb-camera-y := camera.o gb-firmware-y := fw-core.o fw-download.o gb-gpio-y := gpio.o +gb-i2c-y := i2c.o obj-m += greybus.o obj-m += gb-phy.o @@ -63,6 +63,7 @@ obj-m += gb-audio-apbridgea.o obj-m += gb-audio-manager.o obj-m += gb-firmware.o obj-m += gb-gpio.o +obj-m += gb-i2c.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 8622677..92838d5 100644 --- a/drivers/staging/greybus/gpbridge.c +++ b/drivers/staging/greybus/gpbridge.c @@ -333,10 +333,6 @@ static int __init gpbridge_init(void) pr_err("error initializing usb driver\n"); goto error_usb; } - if (gb_i2c_driver_init()) { - pr_err("error initializing i2c driver\n"); - goto error_i2c; - } if (gb_spi_driver_init()) { pr_err("error initializing spi driver\n"); goto error_spi; @@ -345,8 +341,6 @@ static int __init gpbridge_init(void) return 0; error_spi: - gb_i2c_driver_exit(); -error_i2c: gb_usb_driver_exit(); error_usb: gb_sdio_driver_exit(); @@ -366,7 +360,6 @@ module_init(gpbridge_init); static void __exit gpbridge_exit(void) { gb_spi_driver_exit(); - gb_i2c_driver_exit(); gb_usb_driver_exit(); gb_sdio_driver_exit(); gb_uart_driver_exit(); diff --git a/drivers/staging/greybus/gpbridge.h b/drivers/staging/greybus/gpbridge.h index a346fa2..3f0340e 100644 --- a/drivers/staging/greybus/gpbridge.h +++ b/drivers/staging/greybus/gpbridge.h @@ -78,9 +78,6 @@ extern void gb_sdio_driver_exit(void); extern int gb_usb_driver_init(void); extern void gb_usb_driver_exit(void); -extern int gb_i2c_driver_init(void); -extern void gb_i2c_driver_exit(void); - extern int gb_spi_driver_init(void); extern void gb_spi_driver_exit(void); diff --git a/drivers/staging/greybus/i2c.c b/drivers/staging/greybus/i2c.c index b49e8b4..69d6f07 100644 --- a/drivers/staging/greybus/i2c.c +++ b/drivers/staging/greybus/i2c.c @@ -321,6 +321,7 @@ static const struct gpbridge_device_id gb_i2c_id_table[] = { { GPBRIDGE_PROTOCOL(GREYBUS_PROTOCOL_I2C) }, { }, }; +MODULE_DEVICE_TABLE(gpbridge, gb_i2c_id_table); static struct gpbridge_driver i2c_driver = { .name = "i2c", @@ -328,4 +329,6 @@ static struct gpbridge_driver i2c_driver = { .remove = gb_i2c_remove, .id_table = gb_i2c_id_table, }; -gb_gpbridge_builtin_driver(i2c_driver); + +module_gpbridge_driver(i2c_driver); +MODULE_LICENSE("GPL v2"); -- 2.7.4