From: Matt Porter Date: Fri, 3 Oct 2014 17:38:24 +0000 (-0400) Subject: greybus: fix gb_add_module() by enabling the device_add() X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~2048 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=32dff13d21120cfbf6196347f7bc74e9236fce1e;p=linux.git greybus: fix gb_add_module() by enabling the device_add() Without the gb_module device being added, we have no parent device for any of the greybus subdevs to be added. Do the device_add() before creating subdevs as we need it then to register any children in the various greybus protocol drivers. Signed-off-by: Matt Porter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index 9669a34a36c5..8237f5f64015 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -231,14 +231,20 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id, device_initialize(&gmod->dev); dev_set_name(&gmod->dev, "%d", module_id); - retval = gb_init_subdevs(gmod, &fake_greybus_module_id); + retval = device_add(&gmod->dev); if (retval) goto error; - // FIXME device_add(&gmod->dev); + retval = gb_init_subdevs(gmod, &fake_greybus_module_id); + if (retval) + goto error_subdevs; //return gmod; return; + +error_subdevs: + device_del(&gmod->dev); + error: put_device(&gmod->dev); greybus_module_release(&gmod->dev);