.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)
};
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);
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);
}
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);