OSDN Git Service

greybus: interface_block: s/gb_module/gb_interface_block/
authorGreg Kroah-Hartman <greg@kroah.com>
Thu, 11 Dec 2014 22:10:56 +0000 (17:10 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 12 Dec 2014 00:53:59 +0000 (19:53 -0500)
Rename struct gb_module to struct gb_interface_block

It's a complex rename, some functions got their name changed where
needed, but primarily this change is focused on the structure and where
it is used.  Future changes will clean up the remaining usages of the
term "module" in individual changes, this one spanned the whole
subsystem so do it all at once.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
12 files changed:
drivers/staging/greybus/ap.c
drivers/staging/greybus/battery-gb.c
drivers/staging/greybus/connection.c
drivers/staging/greybus/core.c
drivers/staging/greybus/greybus.h
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h
drivers/staging/greybus/interface_block.c
drivers/staging/greybus/interface_block.h
drivers/staging/greybus/manifest.c
drivers/staging/greybus/manifest.h
drivers/staging/greybus/sysfs.c

index 3536717..89debab 100644 (file)
@@ -123,7 +123,7 @@ static void svc_handshake(struct svc_function_handshake *handshake,
 static void svc_management(struct svc_function_unipro_management *management,
                           int payload_length, struct greybus_host_device *hd)
 {
-       struct gb_module *module;
+       struct gb_interface_block *gb_ib;
        int ret;
 
        if (payload_length != sizeof(*management)) {
@@ -138,18 +138,18 @@ static void svc_management(struct svc_function_unipro_management *management,
                hd->device_id = management->ap_id.device_id;
                break;
        case SVC_MANAGEMENT_LINK_UP:
-               module = gb_module_find(hd, management->link_up.module_id);
-               if (!module) {
+               gb_ib = gb_ib_find(hd, management->link_up.module_id);
+               if (!gb_ib) {
                        dev_err(hd->parent, "Module ID %d not found\n",
                                management->link_up.module_id);
                        return;
                }
-               ret = gb_interface_init(module,
+               ret = gb_interface_init(gb_ib,
                                management->link_up.interface_id,
                                management->link_up.device_id);
                if (ret)
                        dev_err(hd->parent, "error %d initializing "
-                               "module %hhu interface %hhu\n",
+                               "interface block %hhu interface %hhu\n",
                                ret, management->link_up.module_id,
                                management->link_up.interface_id);
                break;
index f469a8d..e4a5a85 100644 (file)
@@ -340,7 +340,7 @@ static int gb_battery_connection_init(struct gb_connection *connection)
        b->num_properties       = ARRAY_SIZE(battery_props),
        b->get_property         = get_property,
 
-       retval = power_supply_register(&connection->interface->gmod->dev, b);
+       retval = power_supply_register(&connection->interface->gb_ib->dev, b);
        if (retval) {
                kfree(gb);
                return retval;
index e59a777..7d5f461 100644 (file)
@@ -155,7 +155,7 @@ struct gb_connection *gb_connection_create(struct gb_interface *interface,
                return NULL;
        }
 
-       hd = interface->gmod->hd;
+       hd = interface->gb_ib->hd;
        connection->hd = hd;
        if (!gb_connection_hd_cport_id_alloc(connection)) {
                gb_protocol_put(connection->protocol);
@@ -236,7 +236,7 @@ void gb_connection_err(struct gb_connection *connection, const char *fmt, ...)
        vaf.va = &args;
 
        pr_err("greybus: [%hhu:%hhu:%hu]: %pV\n",
-               connection->interface->gmod->module_id,
+               connection->interface->gb_ib->module_id,
                connection->interface->id,
                connection->interface_cport_id, &vaf);
 
index 9203ebd..31460ab 100644 (file)
@@ -33,10 +33,10 @@ EXPORT_SYMBOL_GPL(greybus_disabled);
 static int greybus_module_match(struct device *dev, struct device_driver *drv)
 {
        struct greybus_driver *driver = to_greybus_driver(drv);
-       struct gb_module *gmod = to_gb_module(dev);
+       struct gb_interface_block *gb_ib = to_gb_interface_block(dev);
        const struct greybus_module_id *id;
 
-       id = gb_module_match_id(gmod, driver->id_table);
+       id = gb_ib_match_id(gb_ib, driver->id_table);
        if (id)
                return 1;
        /* FIXME - Dynamic ids? */
@@ -45,19 +45,19 @@ static int greybus_module_match(struct device *dev, struct device_driver *drv)
 
 static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
-       struct gb_module *gmod = NULL;
+       struct gb_interface_block *gb_ib = NULL;
        struct gb_interface *interface = NULL;
        struct gb_connection *connection = NULL;
 
-       if (is_gb_module(dev)) {
-               gmod = to_gb_module(dev);
+       if (is_gb_interface_block(dev)) {
+               gb_ib = to_gb_interface_block(dev);
        } else if (is_gb_interface(dev)) {
                interface = to_gb_interface(dev);
-               gmod = interface->gmod;
+               gb_ib = interface->gb_ib;
        } else if (is_gb_connection(dev)) {
                connection = to_gb_connection(dev);
                interface = connection->interface;
-               gmod = interface->gmod;
+               gb_ib = interface->gb_ib;
        } else {
                dev_WARN(dev, "uevent for unknown greybus device \"type\"!\n");
                return -EINVAL;
@@ -93,16 +93,16 @@ struct bus_type greybus_bus_type = {
 static int greybus_probe(struct device *dev)
 {
        struct greybus_driver *driver = to_greybus_driver(dev->driver);
-       struct gb_module *gmod = to_gb_module(dev);
+       struct gb_interface_block *gb_ib = to_gb_interface_block(dev);
        const struct greybus_module_id *id;
        int retval;
 
        /* match id */
-       id = gb_module_match_id(gmod, driver->id_table);
+       id = gb_ib_match_id(gb_ib, driver->id_table);
        if (!id)
                return -ENODEV;
 
-       retval = driver->probe(gmod, id);
+       retval = driver->probe(gb_ib, id);
        if (retval)
                return retval;
 
@@ -112,9 +112,9 @@ static int greybus_probe(struct device *dev)
 static int greybus_remove(struct device *dev)
 {
        struct greybus_driver *driver = to_greybus_driver(dev->driver);
-       struct gb_module *gmod = to_gb_module(dev);
+       struct gb_interface_block *gb_ib = to_gb_interface_block(dev);
 
-       driver->disconnect(gmod);
+       driver->disconnect(gb_ib);
        return 0;
 }
 
index 101b711..84516cb 100644 (file)
@@ -118,12 +118,12 @@ void greybus_remove_hd(struct greybus_host_device *hd);
 struct greybus_driver {
        const char *name;
 
-       int (*probe)(struct gb_module *gmod,
+       int (*probe)(struct gb_interface_block *gb_ib,
                     const struct greybus_module_id *id);
-       void (*disconnect)(struct gb_module *gmod);
+       void (*disconnect)(struct gb_interface_block *gb_ib);
 
-       int (*suspend)(struct gb_module *gmod, pm_message_t message);
-       int (*resume)(struct gb_module *gmod);
+       int (*suspend)(struct gb_interface_block *gb_ib, pm_message_t message);
+       int (*resume)(struct gb_interface_block *gb_ib);
 
        const struct greybus_module_id *id_table;
 
@@ -175,13 +175,13 @@ void gb_uart_device_exit(struct gb_connection *connection);
 int svc_set_route_send(struct gb_interface *interface,
                               struct greybus_host_device *hd);
 
-extern struct device_type greybus_module_type;
+extern struct device_type greybus_interface_block_type;
 extern struct device_type greybus_interface_type;
 extern struct device_type greybus_connection_type;
 
-static inline int is_gb_module(const struct device *dev)
+static inline int is_gb_interface_block(const struct device *dev)
 {
-       return dev->type == &greybus_module_type;
+       return dev->type == &greybus_interface_block_type;
 }
 
 static inline int is_gb_interface(const struct device *dev)
index 38c104f..0108100 100644 (file)
@@ -52,7 +52,7 @@ static DEFINE_SPINLOCK(gb_interfaces_lock);
  * pointer if a failure occurs due to memory exhaustion.
  */
 struct gb_interface *
-gb_interface_create(struct gb_module *gmod, u8 interface_id)
+gb_interface_create(struct gb_interface_block *gb_ib, u8 interface_id)
 {
        struct gb_interface *interface;
        int retval;
@@ -61,19 +61,19 @@ gb_interface_create(struct gb_module *gmod, u8 interface_id)
        if (!interface)
                return NULL;
 
-       interface->gmod = gmod;
+       interface->gb_ib = gb_ib;
        interface->id = interface_id;
        interface->device_id = 0xff;    /* Invalid device id to start with */
        INIT_LIST_HEAD(&interface->connections);
 
        /* Build up the interface device structures and register it with the
         * driver core */
-       interface->dev.parent = &gmod->dev;
+       interface->dev.parent = &gb_ib->dev;
        interface->dev.bus = &greybus_bus_type;
        interface->dev.type = &greybus_interface_type;
        interface->dev.groups = interface_groups;
        device_initialize(&interface->dev);
-       dev_set_name(&interface->dev, "%d:%d", gmod->module_id, interface_id);
+       dev_set_name(&interface->dev, "%d:%d", gb_ib->module_id, interface_id);
 
        retval = device_add(&interface->dev);
        if (retval) {
@@ -85,7 +85,7 @@ gb_interface_create(struct gb_module *gmod, u8 interface_id)
        }
 
        spin_lock_irq(&gb_interfaces_lock);
-       list_add_tail(&interface->links, &gmod->interfaces);
+       list_add_tail(&interface->links, &gb_ib->interfaces);
        spin_unlock_irq(&gb_interfaces_lock);
 
        return interface;
@@ -94,16 +94,16 @@ gb_interface_create(struct gb_module *gmod, u8 interface_id)
 /*
  * Tear down a previously set up interface.
  */
-void gb_interface_destroy(struct gb_module *gmod)
+void gb_interface_destroy(struct gb_interface_block *gb_ib)
 {
        struct gb_interface *interface;
        struct gb_interface *temp;
 
-       if (WARN_ON(!gmod))
+       if (WARN_ON(!gb_ib))
                return;
 
        spin_lock_irq(&gb_interfaces_lock);
-       list_for_each_entry_safe(interface, temp, &gmod->interfaces, links) {
+       list_for_each_entry_safe(interface, temp, &gb_ib->interfaces, links) {
                list_del(&interface->links);
                gb_interface_connections_exit(interface);
                device_del(&interface->dev);
@@ -111,28 +111,28 @@ void gb_interface_destroy(struct gb_module *gmod)
        spin_unlock_irq(&gb_interfaces_lock);
 }
 
-int gb_interface_init(struct gb_module *gmod, u8 interface_id, u8 device_id)
+int gb_interface_init(struct gb_interface_block *gb_ib, u8 interface_id, u8 device_id)
 {
        struct gb_interface *interface;
        int ret;
 
-       interface = gb_interface_find(gmod, interface_id);
+       interface = gb_interface_find(gb_ib, interface_id);
        if (!interface) {
-               dev_err(gmod->hd->parent, "module %hhu not found\n",
+               dev_err(gb_ib->hd->parent, "module %hhu not found\n",
                        interface_id);
                return -ENOENT;
        }
        interface->device_id = device_id;
 
-       ret = svc_set_route_send(interface, gmod->hd);
+       ret = svc_set_route_send(interface, gb_ib->hd);
        if (ret) {
-               dev_err(gmod->hd->parent, "failed to set route (%d)\n", ret);
+               dev_err(gb_ib->hd->parent, "failed to set route (%d)\n", ret);
                return ret;
        }
 
        ret = gb_interface_connections_init(interface);
        if (ret) {
-               dev_err(gmod->hd->parent, "module interface init error %d\n",
+               dev_err(gb_ib->hd->parent, "module interface init error %d\n",
                        ret);
                /* XXX clear route */
                return ret;
@@ -141,13 +141,13 @@ int gb_interface_init(struct gb_module *gmod, u8 interface_id, u8 device_id)
        return 0;
 }
 
-struct gb_interface *gb_interface_find(struct gb_module *module,
+struct gb_interface *gb_interface_find(struct gb_interface_block *gb_ib,
                                      u8 interface_id)
 {
        struct gb_interface *interface;
 
        spin_lock_irq(&gb_interfaces_lock);
-       list_for_each_entry(interface, &module->interfaces, links)
+       list_for_each_entry(interface, &gb_ib->interfaces, links)
                if (interface->id == interface_id) {
                        spin_unlock_irq(&gb_interfaces_lock);
                        return interface;
index bfd1781..2f435fd 100644 (file)
@@ -13,7 +13,7 @@
 
 struct gb_interface {
        struct device           dev;
-       struct gb_module        *gmod;
+       struct gb_interface_block       *gb_ib;
        u8                      id;
        u8                      device_id;
        struct list_head        connections;
@@ -22,11 +22,11 @@ struct gb_interface {
 };
 #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
 
-struct gb_interface *gb_interface_create(struct gb_module *gmod, u8 module_id);
-void gb_interface_destroy(struct gb_module *gmod);
-int gb_interface_init(struct gb_module *gmod, u8 module_id, u8 device_id);
+struct gb_interface *gb_interface_create(struct gb_interface_block *gb_ib, u8 module_id);
+void gb_interface_destroy(struct gb_interface_block *gb_ib);
+int gb_interface_init(struct gb_interface_block *gb_ib, u8 module_id, u8 device_id);
 
-struct gb_interface *gb_interface_find(struct gb_module *gmod, u8 interface_id);
+struct gb_interface *gb_interface_find(struct gb_interface_block *gb_ib, u8 interface_id);
 
 int gb_interface_connections_init(struct gb_interface *interface);
 void gb_interface_connections_exit(struct gb_interface *interface);
index c424a5a..10b3f50 100644 (file)
 /* XXX This could be per-host device */
 static DEFINE_SPINLOCK(gb_modules_lock);
 
-static int gb_module_match_one_id(struct gb_module *gmod,
+static int gb_module_match_one_id(struct gb_interface_block *gb_ib,
                                const struct greybus_module_id *id)
 {
        if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_VENDOR) &&
-           (id->vendor != gmod->vendor))
+           (id->vendor != gb_ib->vendor))
                return 0;
 
        if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_PRODUCT) &&
-           (id->product != gmod->product))
+           (id->product != gb_ib->product))
                return 0;
 
        if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_SERIAL) &&
-           (id->unique_id != gmod->unique_id))
+           (id->unique_id != gb_ib->unique_id))
                return 0;
 
        return 1;
 }
 
-const struct greybus_module_id *gb_module_match_id(struct gb_module *gmod,
+const struct greybus_module_id *gb_ib_match_id(struct gb_interface_block *gb_ib,
                                const struct greybus_module_id *id)
 {
        if (id == NULL)
@@ -37,108 +37,110 @@ const struct greybus_module_id *gb_module_match_id(struct gb_module *gmod,
 
        for (; id->vendor || id->product || id->unique_id ||
                        id->driver_info; id++) {
-               if (gb_module_match_one_id(gmod, id))
+               if (gb_module_match_one_id(gb_ib, id))
                        return id;
        }
 
        return NULL;
 }
 
-struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id)
+struct gb_interface_block *gb_ib_find(struct greybus_host_device *hd, u8 module_id)
 {
-       struct gb_module *module;
+       struct gb_interface_block *gb_ib;
 
-       list_for_each_entry(module, &hd->modules, links)
-               if (module->module_id == module_id)
-                       return module;
+       list_for_each_entry(gb_ib, &hd->modules, links)
+               if (gb_ib->module_id == module_id)
+                       return gb_ib;
 
        return NULL;
 }
 
-static void greybus_module_release(struct device *dev)
+static void greybus_ib_release(struct device *dev)
 {
-       struct gb_module *gmod = to_gb_module(dev);
+       struct gb_interface_block *gb_ib = to_gb_interface_block(dev);
 
-       kfree(gmod);
+       kfree(gb_ib);
 }
 
-struct device_type greybus_module_type = {
-       .name =         "greybus_module",
-       .release =      greybus_module_release,
+struct device_type greybus_interface_block_type = {
+       .name =         "greybus_interface_block",
+       .release =      greybus_ib_release,
 };
 
 /*
  * A Greybus module represents a user-replicable component on an Ara
- * phone.
+ * phone.  An interface block is the physical connection on that module.  A
+ * module may have more than one interface block.
  *
- * Create a gb_module structure to represent a discovered module.
+ * Create a gb_interface_block structure to represent a discovered module.
  * The position within the Endo is encoded in the "module_id" argument.
  * Returns a pointer to the new module or a null pointer if a
  * failure occurs due to memory exhaustion.
  */
-struct gb_module *gb_module_create(struct greybus_host_device *hd, u8 module_id)
+static struct gb_interface_block *gb_ib_create(struct greybus_host_device *hd,
+                                              u8 module_id)
 {
-       struct gb_module *gmod;
+       struct gb_interface_block *gb_ib;
        int retval;
 
-       gmod = gb_module_find(hd, module_id);
-       if (gmod) {
+       gb_ib = gb_ib_find(hd, module_id);
+       if (gb_ib) {
                dev_err(hd->parent, "Duplicate module id %d will not be created\n",
                        module_id);
                return NULL;
        }
 
-       gmod = kzalloc(sizeof(*gmod), GFP_KERNEL);
-       if (!gmod)
+       gb_ib = kzalloc(sizeof(*gb_ib), GFP_KERNEL);
+       if (!gb_ib)
                return NULL;
 
-       gmod->hd = hd;          /* XXX refcount? */
-       gmod->module_id = module_id;
-       INIT_LIST_HEAD(&gmod->interfaces);
+       gb_ib->hd = hd;         /* XXX refcount? */
+       gb_ib->module_id = module_id;
+       INIT_LIST_HEAD(&gb_ib->interfaces);
 
-       gmod->dev.parent = hd->parent;
-       gmod->dev.bus = &greybus_bus_type;
-       gmod->dev.type = &greybus_module_type;
-       gmod->dev.groups = greybus_module_groups;
-       gmod->dev.dma_mask = hd->parent->dma_mask;
-       device_initialize(&gmod->dev);
-       dev_set_name(&gmod->dev, "%d", module_id);
+       gb_ib->dev.parent = hd->parent;
+       gb_ib->dev.bus = &greybus_bus_type;
+       gb_ib->dev.type = &greybus_interface_block_type;
+       gb_ib->dev.groups = greybus_module_groups;
+       gb_ib->dev.dma_mask = hd->parent->dma_mask;
+       device_initialize(&gb_ib->dev);
+       dev_set_name(&gb_ib->dev, "%d", module_id);
 
-       retval = device_add(&gmod->dev);
+       retval = device_add(&gb_ib->dev);
        if (retval) {
                pr_err("failed to add module device for id 0x%02hhx\n",
                        module_id);
-               put_device(&gmod->dev);
-               kfree(gmod);
+               put_device(&gb_ib->dev);
+               kfree(gb_ib);
                return NULL;
        }
 
        spin_lock_irq(&gb_modules_lock);
-       list_add_tail(&gmod->links, &hd->modules);
+       list_add_tail(&gb_ib->links, &hd->modules);
        spin_unlock_irq(&gb_modules_lock);
 
-       return gmod;
+       return gb_ib;
 }
 
 /*
  * Tear down a previously set up module.
  */
-void gb_module_destroy(struct gb_module *gmod)
+static void gb_ib_destroy(struct gb_interface_block *gb_ib)
 {
-       if (WARN_ON(!gmod))
+       if (WARN_ON(!gb_ib))
                return;
 
        spin_lock_irq(&gb_modules_lock);
-       list_del(&gmod->links);
+       list_del(&gb_ib->links);
        spin_unlock_irq(&gb_modules_lock);
 
-       gb_interface_destroy(gmod);
+       gb_interface_destroy(gb_ib);
 
-       kfree(gmod->product_string);
-       kfree(gmod->vendor_string);
+       kfree(gb_ib->product_string);
+       kfree(gb_ib->vendor_string);
        /* kref_put(module->hd); */
 
-       device_del(&gmod->dev);
+       device_del(&gb_ib->dev);
 }
 
 /**
@@ -150,11 +152,11 @@ void gb_module_destroy(struct gb_module *gmod)
 void gb_add_module(struct greybus_host_device *hd, u8 module_id,
                   u8 *data, int size)
 {
-       struct gb_module *gmod;
+       struct gb_interface_block *gb_ib;
 
-       gmod = gb_module_create(hd, module_id);
-       if (!gmod) {
-               dev_err(hd->parent, "failed to create module\n");
+       gb_ib = gb_ib_create(hd, module_id);
+       if (!gb_ib) {
+               dev_err(hd->parent, "failed to create interface block\n");
                return;
        }
 
@@ -162,7 +164,7 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id,
         * Parse the manifest and build up our data structures
         * representing what's in it.
         */
-       if (!gb_manifest_parse(gmod, data, size)) {
+       if (!gb_manifest_parse(gb_ib, data, size)) {
                dev_err(hd->parent, "manifest error\n");
                goto err_module;
        }
@@ -179,23 +181,23 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id,
        return;
 
 err_module:
-       gb_module_destroy(gmod);
+       gb_ib_destroy(gb_ib);
 }
 
 void gb_remove_module(struct greybus_host_device *hd, u8 module_id)
 {
-       struct gb_module *gmod = gb_module_find(hd, module_id);
+       struct gb_interface_block *gb_ib = gb_ib_find(hd, module_id);
 
-       if (gmod)
-               gb_module_destroy(gmod);
+       if (gb_ib)
+               gb_ib_destroy(gb_ib);
        else
-               dev_err(hd->parent, "module id %d not found\n", module_id);
+               dev_err(hd->parent, "interface block id %d not found\n", module_id);
 }
 
 void gb_remove_modules(struct greybus_host_device *hd)
 {
-       struct gb_module *gmod, *temp;
+       struct gb_interface_block *gb_ib, *temp;
 
-       list_for_each_entry_safe(gmod, temp, &hd->modules, links)
-               gb_module_destroy(gmod);
+       list_for_each_entry_safe(gb_ib, temp, &hd->modules, links)
+               gb_ib_destroy(gb_ib);
 }
index 2fdca57..b751ce4 100644 (file)
@@ -1,19 +1,21 @@
 /*
- * Greybus modules
+ * Greybus Interface Block code
  *
  * Copyright 2014 Google Inc.
  *
  * Released under the GPLv2 only.
  */
 
-#ifndef __MODULE_H
-#define __MODULE_H
+#ifndef __INTERFACE_BLOCK_H
+#define __INTERFACE_BLOCK_H
 
 /* Increase these values if needed */
 #define MAX_CPORTS_PER_MODULE  10
 #define MAX_STRINGS_PER_MODULE 10
 
-struct gb_module {
+
+/* Greybus "public" definitions" */
+struct gb_interface_block {
        struct device dev;
 
        struct list_head interfaces;
@@ -29,27 +31,26 @@ struct gb_module {
 
        struct greybus_host_device *hd;
 };
-#define to_gb_module(d) container_of(d, struct gb_module, dev)
+#define to_gb_interface_block(d) container_of(d, struct gb_interface_block, dev)
 
 static inline void
-gb_module_set_drvdata(struct gb_module *gmod, void *data)
+gb_interface_block_set_drvdata(struct gb_interface_block *gb_ib, void *data)
 {
-       dev_set_drvdata(&gmod->dev, data);
+       dev_set_drvdata(&gb_ib->dev, data);
 }
 
-static inline void *gb_module_get_drvdata(struct gb_module *gmod)
+static inline void *
+gb_interface_block_get_drvdata(struct gb_interface_block *gb_ib)
 {
-       return dev_get_drvdata(&gmod->dev);
+       return dev_get_drvdata(&gb_ib->dev);
 }
 
-const struct greybus_module_id *gb_module_match_id(struct gb_module *gmod,
-                                       const struct greybus_module_id *id);
+/* Greybus "private" definitions */
 
-struct gb_module *gb_module_create(struct greybus_host_device *hd,
-                                       u8 module_id);
-void gb_module_destroy(struct gb_module *module);
+const struct greybus_module_id *gb_ib_match_id(struct gb_interface_block *gb_ib,
+                                       const struct greybus_module_id *id);
 
-struct gb_module *gb_module_find(struct greybus_host_device *hd,
-                               u8 module_id);
+struct gb_interface_block *gb_ib_find(struct greybus_host_device *hd,
+                                     u8 module_id);
 
-#endif /* __MODULE_H */
+#endif /* __INTERFACE_BLOCK_H */
index 57cd594..67aa927 100644 (file)
@@ -217,7 +217,7 @@ static u32 gb_manifest_parse_cports(struct gb_interface *interface)
  * structures.  Returns the number of interfaces set up for the
  * given module.
  */
-static u32 gb_manifest_parse_interfaces(struct gb_module *gmod)
+static u32 gb_manifest_parse_interfaces(struct gb_interface_block *gb_ib)
 {
        u32 count = 0;
 
@@ -239,7 +239,7 @@ static u32 gb_manifest_parse_interfaces(struct gb_module *gmod)
 
                /* Found one.  Set up its interface structure*/
                desc_interface = descriptor->data;
-               interface = gb_interface_create(gmod, desc_interface->id);
+               interface = gb_interface_create(gb_ib, desc_interface->id);
                if (!interface)
                        return 0;       /* Error */
 
@@ -256,41 +256,41 @@ static u32 gb_manifest_parse_interfaces(struct gb_module *gmod)
        return count;
 }
 
-static bool gb_manifest_parse_module(struct gb_module *gmod,
+static bool gb_manifest_parse_module(struct gb_interface_block *gb_ib,
                                        struct manifest_desc *module_desc)
 {
        struct greybus_descriptor_module *desc_module = module_desc->data;
 
        /* Handle the strings first--they can fail */
-       gmod->vendor_string = gb_string_get(desc_module->vendor_stringid);
-       if (IS_ERR(gmod->vendor_string))
+       gb_ib->vendor_string = gb_string_get(desc_module->vendor_stringid);
+       if (IS_ERR(gb_ib->vendor_string))
                return false;
 
-       gmod->product_string = gb_string_get(desc_module->product_stringid);
-       if (IS_ERR(gmod->product_string)) {
+       gb_ib->product_string = gb_string_get(desc_module->product_stringid);
+       if (IS_ERR(gb_ib->product_string)) {
                goto out_free_vendor_string;
        }
 
-       gmod->vendor = le16_to_cpu(desc_module->vendor);
-       gmod->product = le16_to_cpu(desc_module->product);
-       gmod->unique_id = le64_to_cpu(desc_module->unique_id);
+       gb_ib->vendor = le16_to_cpu(desc_module->vendor);
+       gb_ib->product = le16_to_cpu(desc_module->product);
+       gb_ib->unique_id = le64_to_cpu(desc_module->unique_id);
 
        /* Release the module descriptor, now that we're done with it */
        release_manifest_descriptor(module_desc);
 
        /* A module must have at least one interface descriptor */
-       if (!gb_manifest_parse_interfaces(gmod)) {
+       if (!gb_manifest_parse_interfaces(gb_ib)) {
                pr_err("manifest interface descriptors not valid\n");
                goto out_err;
        }
 
        return true;
 out_err:
-       kfree(gmod->product_string);
-       gmod->product_string = NULL;
+       kfree(gb_ib->product_string);
+       gb_ib->product_string = NULL;
 out_free_vendor_string:
-       kfree(gmod->vendor_string);
-       gmod->vendor_string = NULL;
+       kfree(gb_ib->vendor_string);
+       gb_ib->vendor_string = NULL;
 
        return false;
 }
@@ -318,7 +318,7 @@ out_free_vendor_string:
  *
  * Returns true if parsing was successful, false otherwise.
  */
-bool gb_manifest_parse(struct gb_module *gmod, void *data, size_t size)
+bool gb_manifest_parse(struct gb_interface_block *gb_ib, void *data, size_t size)
 {
        struct greybus_manifest *manifest;
        struct greybus_manifest_header *header;
@@ -388,7 +388,7 @@ bool gb_manifest_parse(struct gb_module *gmod, void *data, size_t size)
        }
 
        /* Parse the module manifest, starting with the module descriptor */
-       result = gb_manifest_parse_module(gmod, module_desc);
+       result = gb_manifest_parse_module(gb_ib, module_desc);
 
        /*
         * We really should have no remaining descriptors, but we
index a1fe2c1..7c82a45 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __MANIFEST_H
 #define __MANIFEST_H
 
-struct gb_module;
-bool gb_manifest_parse(struct gb_module *gmod, void *data, size_t size);
+struct gb_interface_block;
+bool gb_manifest_parse(struct gb_interface_block *gb_ib, void *data, size_t size);
 
 #endif /* __MANIFEST_H */
index f9d56e1..28d1b8d 100644 (file)
@@ -25,8 +25,8 @@ static ssize_t module_##field##_show(struct device *dev,              \
                                     struct device_attribute *attr,     \
                                     char *buf)                         \
 {                                                                      \
-       struct gb_module *gmod = to_gb_module(dev);                     \
-       return sprintf(buf, "%"#type"\n", gmod->field);                 \
+       struct gb_interface_block *gb_ib = to_gb_interface_block(dev);  \
+       return sprintf(buf, "%"#type"\n", gb_ib->field);                \
 }                                                                      \
 static DEVICE_ATTR_RO(module_##field)