-greybus-y := core.o gbuf.o i2c-gb.o
+greybus-y := core.o gbuf.o i2c-gb.o gpio-gb.o sdio-gb.o uart-gb.o
obj-m += greybus.o
-obj-m += sdio-gb.o
-obj-m += gpio-gb.o
-obj-m += uart-gb.o
KERNELVER ?= $(shell uname -r)
KERNELDIR ?= /lib/modules/$(KERNELVER)/build
/* Allocate all of the different "sub device types" for this device */
retval = gb_i2c_probe(gdev, id);
+ if (retval)
+ goto error_i2c;
+
+ retval = gb_gpio_probe(gdev, id);
+ if (retval)
+ goto error_gpio;
+
+ retval = gb_sdio_probe(gdev, id);
+ if (retval)
+ goto error_sdio;
+
+ retval = gb_tty_probe(gdev, id);
+ if (retval)
+ goto error_tty;
return 0;
+
+error_tty:
+ gb_sdio_disconnect(gdev);
+
+error_sdio:
+ gb_gpio_disconnect(gdev);
+
+error_gpio:
+ gb_i2c_disconnect(gdev);
+
+error_i2c:
+ return retval;
}
+static void remove_device(struct greybus_device *gdev)
+{
+ /* tear down all of the "sub device types" for this device */
+ gb_i2c_disconnect(gdev);
+ gb_gpio_disconnect(gdev);
+ gb_sdio_disconnect(gdev);
+ gb_tty_disconnect(gdev);
+}
static int __init gb_init(void)
{
+ int retval;
+
+ retval = gb_tty_init();
+ if (retval)
+ return retval;
+
return 0;
}
static void __exit gb_exit(void)
{
+ gb_tty_exit();
}
module_init(gb_init);
return;
}
-static int gpio_gb_probe(struct greybus_device *gdev, const struct greybus_device_id *id)
+int gb_gpio_probe(struct greybus_device *gdev,
+ const struct greybus_device_id *id)
{
struct gb_gpio_device *gb_gpio;
struct gpio_chip *gpio;
return 0;
}
-static void gpio_gb_disconnect(struct greybus_device *gdev)
+void gb_gpio_disconnect(struct greybus_device *gdev)
{
struct gb_gpio_device *gb_gpio_dev;
gpiochip_remove(&gb_gpio_dev->chip);
}
+#if 0
static struct greybus_driver gpio_gb_driver = {
- .probe = gpio_gb_probe,
- .disconnect = gpio_gb_disconnect,
+ .probe = gb_gpio_probe,
+ .disconnect = gb_gpio_disconnect,
.id_table = id_table,
};
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Greybus GPIO driver");
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
+#endif
*/
int gb_i2c_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
void gb_i2c_disconnect(struct greybus_device *gdev);
-
+int gb_gpio_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
+void gb_gpio_disconnect(struct greybus_device *gdev);
+int gb_sdio_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
+void gb_sdio_disconnect(struct greybus_device *gdev);
+int gb_tty_probe(struct greybus_device *gdev, const struct greybus_device_id *id);
+void gb_tty_disconnect(struct greybus_device *gdev);
+
+int gb_tty_init(void);
+void gb_tty_exit(void);
struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev,
struct cport *cport,
.get_ro = gb_sd_get_ro,
};
-static int sd_gb_probe(struct greybus_device *gdev, const struct greybus_device_id *id)
+int gb_sdio_probe(struct greybus_device *gdev,
+ const struct greybus_device_id *id)
{
struct mmc_host *mmc;
struct gb_sdio_host *host;
return 0;
}
-static void sd_gb_disconnect(struct greybus_device *gdev)
+void gb_sdio_disconnect(struct greybus_device *gdev)
{
struct mmc_host *mmc;
struct gb_sdio_host *host;
mmc_free_host(mmc);
}
+#if 0
static struct greybus_driver sd_gb_driver = {
- .probe = sd_gb_probe,
- .disconnect = sd_gb_disconnect,
+ .probe = gb_sdio_probe,
+ .disconnect = gb_sdio_disconnect,
.id_table = id_table,
};
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Greybus SD/MMC Host driver");
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
+#endif
};
-static int tty_gb_probe(struct greybus_device *gdev, const struct greybus_device_id *id)
+int gb_tty_probe(struct greybus_device *gdev,
+ const struct greybus_device_id *id)
{
struct gb_tty *gb_tty;
struct device *tty_dev;
return retval;
}
-static void tty_gb_disconnect(struct greybus_device *gdev)
+void gb_tty_disconnect(struct greybus_device *gdev)
{
struct gb_tty *gb_tty = greybus_get_drvdata(gdev);
struct tty_struct *tty;
}
static struct greybus_driver tty_gb_driver = {
- .probe = tty_gb_probe,
- .disconnect = tty_gb_disconnect,
+ .probe = gb_tty_probe,
+ .disconnect = gb_tty_disconnect,
.id_table = id_table,
};
-static int __init gb_tty_init(void)
+int __init gb_tty_init(void)
{
int retval;
return retval;
}
-static void __exit gb_tty_exit(void)
+void __exit gb_tty_exit(void)
{
greybus_deregister(&tty_gb_driver);
tty_unregister_driver(gb_tty_driver);
put_tty_driver(gb_tty_driver);
}
+#if 0
module_init(gb_tty_init);
module_exit(gb_tty_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
+#endif