From: Alex Elder Date: Thu, 16 Oct 2014 11:35:30 +0000 (-0500) Subject: greybus: stop init_subdevs stuff X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~2013 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=17d265f6a69aef5920cf3d6669735239cb792184;p=linux.git greybus: stop init_subdevs stuff Upcoming patches are going to set up devices based on what is discovered in the module manifest. Get rid of the hard-coded initialization done by gb_init_subdevs(), along with other related code. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index 67628719f8d1..720ab47033fb 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -131,59 +131,6 @@ static struct device_type greybus_module_type = { .release = greybus_module_release, }; -/* XXX - * This needs to be driven by the list of functions that the - * manifest says are present. - */ -static int gb_init_subdevs(struct gb_module *gmod, - const struct greybus_module_id *id) -{ - int retval; - - /* Allocate all of the different "sub device types" for this device */ - - /* XXX - * Decide what exactly we should get supplied for the i2c - * probe, and then work that back to what should be present - * in the manifest. - */ - retval = gb_i2c_probe(gmod, id); - if (retval) - goto error_i2c; - - retval = gb_gpio_probe(gmod, id); - if (retval) - goto error_gpio; - - retval = gb_sdio_probe(gmod, id); - if (retval) - goto error_sdio; - - retval = gb_tty_probe(gmod, id); - if (retval) - goto error_tty; - - retval = gb_battery_probe(gmod, id); - if (retval) - goto error_battery; - return 0; - -error_battery: - gb_tty_disconnect(gmod); - -error_tty: - gb_sdio_disconnect(gmod); - -error_sdio: - gb_gpio_disconnect(gmod); - -error_gpio: - gb_i2c_disconnect(gmod); - -error_i2c: - return retval; -} - static const struct greybus_module_id fake_greybus_module_id = { GREYBUS_DEVICE(0x42, 0x42) }; @@ -235,19 +182,8 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id, dev_set_name(&gmod->dev, "%d", module_id); retval = device_add(&gmod->dev); - if (retval) - goto error; - - retval = gb_init_subdevs(gmod, &fake_greybus_module_id); - if (retval) - goto error_subdevs; - - //return gmod; - return; - -error_subdevs: - device_del(&gmod->dev); - + if (!retval) + return; /* Success */ error: gb_module_destroy(gmod); @@ -274,13 +210,6 @@ void gb_remove_module(struct greybus_host_device *hd, u8 module_id) void greybus_remove_device(struct gb_module *gmod) { - /* tear down all of the "sub device types" for this device */ - gb_i2c_disconnect(gmod); - gb_gpio_disconnect(gmod); - gb_sdio_disconnect(gmod); - gb_tty_disconnect(gmod); - gb_battery_disconnect(gmod); - device_del(&gmod->dev); put_device(&gmod->dev); } diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index 033c7abe96f0..1970106d70a0 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -265,23 +265,6 @@ void gb_deregister_cport_complete(u16 cport_id); extern const struct attribute_group *greybus_module_groups[]; -/* - * Because we are allocating a data structure per "type" in the greybus device, - * we have static functions for this, not "dynamic" drivers like we really - * should in the end. - */ -int gb_i2c_probe(struct gb_module *gmod, const struct greybus_module_id *id); -void gb_i2c_disconnect(struct gb_module *gmod); -int gb_gpio_probe(struct gb_module *gmod, const struct greybus_module_id *id); -void gb_gpio_disconnect(struct gb_module *gmod); -int gb_sdio_probe(struct gb_module *gmod, const struct greybus_module_id *id); -void gb_sdio_disconnect(struct gb_module *gmod); -int gb_tty_probe(struct gb_module *gmod, const struct greybus_module_id *id); -void gb_tty_disconnect(struct gb_module *gmod); -int gb_battery_probe(struct gb_module *gmod, - const struct greybus_module_id *id); -void gb_battery_disconnect(struct gb_module *gmod); - int gb_tty_init(void); void gb_tty_exit(void);