]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: interface: make interfaces children of host devices
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 25 Nov 2015 14:59:04 +0000 (15:59 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 25 Nov 2015 23:27:06 +0000 (15:27 -0800)
Make interfaces child devices of host devices.

The new interface device name is "<bus_id>-<intf_id>", where bus_id is
the dynamically allocated bus id for the host device and intf_id is the
svc-allocated interface id.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h
drivers/staging/greybus/loopback.c

index 1b13d3791b28d85bc71564880b0c847493a10620..5060924f167db21525e5cfd964a8d88ba93cf3e4 100644 (file)
@@ -124,20 +124,14 @@ int gb_create_bundle_connection(struct gb_interface *intf, u8 class)
 struct gb_interface *gb_interface_create(struct gb_host_device *hd,
                                         u8 interface_id)
 {
-       struct gb_module *module;
        struct gb_interface *intf;
        int retval;
 
-       module = gb_module_find(hd, endo_get_module_id(hd->endo, interface_id));
-       if (!module)
-               return NULL;
-
        intf = kzalloc(sizeof(*intf), GFP_KERNEL);
        if (!intf)
-               goto put_module;
+               return NULL;
 
        intf->hd = hd;          /* XXX refcount? */
-       intf->module = module;
        intf->interface_id = interface_id;
        INIT_LIST_HEAD(&intf->bundles);
        INIT_LIST_HEAD(&intf->manifest_descs);
@@ -145,13 +139,13 @@ struct gb_interface *gb_interface_create(struct gb_host_device *hd,
        /* Invalid device id to start with */
        intf->device_id = GB_DEVICE_ID_BAD;
 
-       intf->dev.parent = &module->dev;
+       intf->dev.parent = &hd->dev;
        intf->dev.bus = &greybus_bus_type;
        intf->dev.type = &greybus_interface_type;
        intf->dev.groups = interface_groups;
        intf->dev.dma_mask = hd->dev.dma_mask;
        device_initialize(&intf->dev);
-       dev_set_name(&intf->dev, "%s:%d", dev_name(&module->dev), interface_id);
+       dev_set_name(&intf->dev, "%d-%d", hd->bus_id, interface_id);
 
        retval = device_add(&intf->dev);
        if (retval) {
@@ -167,8 +161,6 @@ struct gb_interface *gb_interface_create(struct gb_host_device *hd,
 
 free_intf:
        put_device(&intf->dev);
-put_module:
-       put_device(&module->dev);
        return NULL;
 }
 
@@ -177,7 +169,6 @@ put_module:
  */
 void gb_interface_remove(struct gb_interface *intf)
 {
-       struct gb_module *module;
        struct gb_bundle *bundle;
        struct gb_bundle *next;
 
@@ -191,9 +182,7 @@ void gb_interface_remove(struct gb_interface *intf)
        list_for_each_entry_safe(bundle, next, &intf->bundles, links)
                gb_bundle_destroy(bundle);
 
-       module = intf->module;
        device_unregister(&intf->dev);
-       put_device(&module->dev);
 }
 
 void gb_interfaces_remove(struct gb_host_device *hd)
index 71493cd96ec70e550d7aad477008b678b4620b55..1202062a70eb24b00290d50400595c240dad2bed 100644 (file)
@@ -31,7 +31,6 @@ struct gb_interface {
        u32 vendor_id;
        u32 product_id;
 
-       struct gb_module *module;
        struct gb_host_device *hd;
 
        /* The interface needs to boot over unipro */
index 0c38414a3e06841d2870b02aeb84a2fdc2f90854..ededfef40e9c02e3166752c46c8c4f13de7b65f2 100644 (file)
@@ -878,12 +878,6 @@ static int gb_loopback_bus_id_compare(void *priv, struct list_head *lha,
        struct gb_connection *ca = a->connection;
        struct gb_connection *cb = b->connection;
 
-       if (ca->bundle->intf->module->module_id <
-           cb->bundle->intf->module->module_id)
-               return -1;
-       if (cb->bundle->intf->module->module_id <
-           ca->bundle->intf->module->module_id)
-               return 1;
        if (ca->bundle->intf->interface_id < cb->bundle->intf->interface_id)
                return -1;
        if (cb->bundle->intf->interface_id < ca->bundle->intf->interface_id)