greybus: loopback: move sysfs entries to /sys/bus/greybus/devices/endo0
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Wed, 23 Sep 2015 16:31:31 +0000 (09:31 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 23 Sep 2015 19:46:16 +0000 (12:46 -0700)
Currently we have sysfs entries that are created when the first incoming
connection is created as sub-nodes of the module associated with that
connection e.g. /sys/bus/grebus/devices/endo0:X where X is the module
identifier associated with the new connection. This is conceptually
incorrect since the sysfs entries we create actually aren't bound to a
module. Depending on the order connections are brought up we can also have
a situation where /sys/bus/greybus/devices/endo0:X has high-level control
sysfs data-points but /sys/bus/greybus/devices/endo0:Y does not. Rather
than needlessly replicate data-points across each endo0:X, endo0:Y, endo0:Z
sysfs directories it is more sensible to locate the entries in
/sys/bus/greybus/devices/endo0.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Patrick Titiano <ptitiano@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/loopback.c

index 7ccf9a26dab3ed4c69b0ece785b076307c29a88c..3151876a717c39b23676e9231c63380596c16905 100644 (file)
@@ -874,7 +874,7 @@ static int gb_loopback_connection_init(struct gb_connection *connection)
        struct gb_loopback *gb;
        int retval;
        char name[DEBUGFS_NAMELEN];
-       struct kobject *kobj = &connection->bundle->intf->module->dev.kobj;
+       struct kobject *kobj = &connection->hd->endo->dev.kobj;
 
        gb = kzalloc(sizeof(*gb), GFP_KERNEL);
        if (!gb)
@@ -963,7 +963,7 @@ out_sysfs:
 static void gb_loopback_connection_exit(struct gb_connection *connection)
 {
        struct gb_loopback *gb = connection->private;
-       struct kobject *kobj = &connection->bundle->intf->module->dev.kobj;
+       struct kobject *kobj = &connection->hd->endo->dev.kobj;
 
        if (!IS_ERR_OR_NULL(gb->task))
                kthread_stop(gb->task);