From 4ab9b3c24b009fdc55465977153c5deffd31b0c0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 19 Dec 2014 14:56:31 -0800 Subject: [PATCH] greybus: interface: s/gb_interface_block/gb_interface/g Rename struct gb_interface_block to struct gb_interface Lots of renaming, and variable renames as well (gb_ib->intf), but all should be sane with regards to the new naming scheme we are using. Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/ap.c | 12 +- drivers/staging/greybus/battery-gb.c | 2 +- drivers/staging/greybus/bundle.c | 33 +++--- drivers/staging/greybus/bundle.h | 10 +- drivers/staging/greybus/connection.c | 4 +- drivers/staging/greybus/core.c | 24 ++-- drivers/staging/greybus/greybus.h | 14 +-- drivers/staging/greybus/interface.c | 159 ++++++++++++++------------- drivers/staging/greybus/interface.h | 23 ++-- drivers/staging/greybus/manifest.c | 38 +++---- drivers/staging/greybus/manifest.h | 4 +- drivers/staging/greybus/svc_msg.h | 9 +- 12 files changed, 165 insertions(+), 167 deletions(-) diff --git a/drivers/staging/greybus/ap.c b/drivers/staging/greybus/ap.c index a5ac2bba26ba..f9c63e43acd7 100644 --- a/drivers/staging/greybus/ap.c +++ b/drivers/staging/greybus/ap.c @@ -124,7 +124,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_interface_block *gb_ib; + struct gb_interface *intf; int ret; if (payload_length != sizeof(*management)) { @@ -139,18 +139,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: - gb_ib = gb_ib_find(hd, management->link_up.module_id); - if (!gb_ib) { + intf = gb_interface_find(hd, management->link_up.module_id); + if (!intf) { dev_err(hd->parent, "Module ID %d not found\n", management->link_up.module_id); return; } - ret = gb_bundle_init(gb_ib, + ret = gb_bundle_init(intf, management->link_up.interface_id, management->link_up.device_id); if (ret) - dev_err(hd->parent, "error %d initializing " - "interface block %hhu bundle %hhu\n", + dev_err(hd->parent, + "error %d initializing interface %hhu bundle %hhu\n", ret, management->link_up.module_id, management->link_up.interface_id); break; diff --git a/drivers/staging/greybus/battery-gb.c b/drivers/staging/greybus/battery-gb.c index 83cb64245da7..df1d7ee08199 100644 --- a/drivers/staging/greybus/battery-gb.c +++ b/drivers/staging/greybus/battery-gb.c @@ -341,7 +341,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->bundle->gb_ib->dev, b); + retval = power_supply_register(&connection->bundle->intf->dev, b); if (retval) { kfree(gb); return retval; diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index bad6cf6d17fc..2ac67a242c0f 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -50,7 +50,7 @@ static DEFINE_SPINLOCK(gb_bundles_lock); * bundle. Returns a pointer to the new bundle or a null * pointer if a failure occurs due to memory exhaustion. */ -struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interface_id) +struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 interface_id) { struct gb_bundle *bundle; int retval; @@ -59,19 +59,19 @@ struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interfac if (!bundle) return NULL; - bundle->gb_ib = gb_ib; + bundle->intf = intf; bundle->id = interface_id; bundle->device_id = 0xff; /* Invalid device id to start with */ INIT_LIST_HEAD(&bundle->connections); /* Build up the bundle device structures and register it with the * driver core */ - bundle->dev.parent = &gb_ib->dev; + bundle->dev.parent = &intf->dev; bundle->dev.bus = &greybus_bus_type; bundle->dev.type = &greybus_bundle_type; bundle->dev.groups = bundle_groups; device_initialize(&bundle->dev); - dev_set_name(&bundle->dev, "%d:%d", gb_ib->module_id, interface_id); + dev_set_name(&bundle->dev, "%d:%d", intf->module_id, interface_id); retval = device_add(&bundle->dev); if (retval) { @@ -83,7 +83,7 @@ struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interfac } spin_lock_irq(&gb_bundles_lock); - list_add_tail(&bundle->links, &gb_ib->bundles); + list_add_tail(&bundle->links, &intf->bundles); spin_unlock_irq(&gb_bundles_lock); return bundle; @@ -92,16 +92,16 @@ struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interfac /* * Tear down a previously set up bundle. */ -void gb_bundle_destroy(struct gb_interface_block *gb_ib) +void gb_bundle_destroy(struct gb_interface *intf) { struct gb_bundle *bundle; struct gb_bundle *temp; - if (WARN_ON(!gb_ib)) + if (WARN_ON(!intf)) return; spin_lock_irq(&gb_bundles_lock); - list_for_each_entry_safe(bundle, temp, &gb_ib->bundles, links) { + list_for_each_entry_safe(bundle, temp, &intf->bundles, links) { list_del(&bundle->links); gb_bundle_connections_exit(bundle); device_del(&bundle->dev); @@ -109,28 +109,27 @@ void gb_bundle_destroy(struct gb_interface_block *gb_ib) spin_unlock_irq(&gb_bundles_lock); } -int gb_bundle_init(struct gb_interface_block *gb_ib, u8 bundle_id, u8 device_id) +int gb_bundle_init(struct gb_interface *intf, u8 bundle_id, u8 device_id) { struct gb_bundle *bundle; int ret; - bundle = gb_bundle_find(gb_ib, bundle_id); + bundle = gb_bundle_find(intf, bundle_id); if (!bundle) { - dev_err(gb_ib->hd->parent, "bundle %hhu not found\n", - bundle_id); + dev_err(intf->hd->parent, "bundle %hhu not found\n", bundle_id); return -ENOENT; } bundle->device_id = device_id; - ret = svc_set_route_send(bundle, gb_ib->hd); + ret = svc_set_route_send(bundle, intf->hd); if (ret) { - dev_err(gb_ib->hd->parent, "failed to set route (%d)\n", ret); + dev_err(intf->hd->parent, "failed to set route (%d)\n", ret); return ret; } ret = gb_bundle_connections_init(bundle); if (ret) { - dev_err(gb_ib->hd->parent, "interface bundle init error %d\n", + dev_err(intf->hd->parent, "interface bundle init error %d\n", ret); /* XXX clear route */ return ret; @@ -139,12 +138,12 @@ int gb_bundle_init(struct gb_interface_block *gb_ib, u8 bundle_id, u8 device_id) return 0; } -struct gb_bundle *gb_bundle_find(struct gb_interface_block *gb_ib, u8 bundle_id) +struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id) { struct gb_bundle *bundle; spin_lock_irq(&gb_bundles_lock); - list_for_each_entry(bundle, &gb_ib->bundles, links) + list_for_each_entry(bundle, &intf->bundles, links) if (bundle->id == bundle_id) { spin_unlock_irq(&gb_bundles_lock); return bundle; diff --git a/drivers/staging/greybus/bundle.h b/drivers/staging/greybus/bundle.h index ad14a47d64a8..c3c66faac6fc 100644 --- a/drivers/staging/greybus/bundle.h +++ b/drivers/staging/greybus/bundle.h @@ -15,7 +15,7 @@ /* Greybus "public" definitions" */ struct gb_bundle { struct device dev; - struct gb_interface_block *gb_ib; + struct gb_interface *intf; u8 id; u8 device_id; struct list_head connections; @@ -25,10 +25,10 @@ struct gb_bundle { #define to_gb_bundle(d) container_of(d, struct gb_bundle, dev) /* Greybus "private" definitions" */ -struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 module_id); -void gb_bundle_destroy(struct gb_interface_block *gb_ib); -int gb_bundle_init(struct gb_interface_block *gb_ib, u8 module_id, u8 device_id); +struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 module_id); +void gb_bundle_destroy(struct gb_interface *intf); +int gb_bundle_init(struct gb_interface *intf, u8 module_id, u8 device_id); -struct gb_bundle *gb_bundle_find(struct gb_interface_block *gb_ib, u8 bundle_id); +struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id); #endif /* __BUNDLE_H */ diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 2a54b3e067ba..2d61ee788218 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -156,7 +156,7 @@ struct gb_connection *gb_connection_create(struct gb_bundle *bundle, return NULL; } - hd = bundle->gb_ib->hd; + hd = bundle->intf->hd; connection->hd = hd; if (!gb_connection_hd_cport_id_alloc(connection)) { gb_protocol_put(connection->protocol); @@ -237,7 +237,7 @@ void gb_connection_err(struct gb_connection *connection, const char *fmt, ...) vaf.va = &args; pr_err("greybus: [%hhu:%hhu:%hu]: %pV\n", - connection->bundle->gb_ib->module_id, + connection->bundle->intf->module_id, connection->bundle->id, connection->bundle_cport_id, &vaf); diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index eef28e1afaf1..a0e0af5c23d2 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -34,10 +34,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_interface_block *gb_ib = to_gb_interface_block(dev); + struct gb_interface *intf = to_gb_interface(dev); const struct greybus_interface_block_id *id; - id = gb_ib_match_id(gb_ib, driver->id_table); + id = gb_interface_match_id(intf, driver->id_table); if (id) return 1; /* FIXME - Dynamic ids? */ @@ -46,19 +46,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_interface_block *gb_ib = NULL; + struct gb_interface *intf = NULL; struct gb_bundle *bundle = NULL; struct gb_connection *connection = NULL; - if (is_gb_interface_block(dev)) { - gb_ib = to_gb_interface_block(dev); + if (is_gb_interface(dev)) { + intf = to_gb_interface(dev); } else if (is_gb_bundle(dev)) { bundle = to_gb_bundle(dev); - gb_ib = bundle->gb_ib; + intf = bundle->intf; } else if (is_gb_connection(dev)) { connection = to_gb_connection(dev); bundle = connection->bundle; - gb_ib = bundle->gb_ib; + intf = bundle->intf; } else { dev_WARN(dev, "uevent for unknown greybus device \"type\"!\n"); return -EINVAL; @@ -94,16 +94,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_interface_block *gb_ib = to_gb_interface_block(dev); + struct gb_interface *intf = to_gb_interface(dev); const struct greybus_interface_block_id *id; int retval; /* match id */ - id = gb_ib_match_id(gb_ib, driver->id_table); + id = gb_interface_match_id(intf, driver->id_table); if (!id) return -ENODEV; - retval = driver->probe(gb_ib, id); + retval = driver->probe(intf, id); if (retval) return retval; @@ -113,9 +113,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_interface_block *gb_ib = to_gb_interface_block(dev); + struct gb_interface *intf = to_gb_interface(dev); - driver->disconnect(gb_ib); + driver->disconnect(intf); return 0; } diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index e0c5eb7bd13f..bca0e6682eef 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -119,12 +119,12 @@ void greybus_remove_hd(struct greybus_host_device *hd); struct greybus_driver { const char *name; - int (*probe)(struct gb_interface_block *gb_ib, + int (*probe)(struct gb_interface *intf, const struct greybus_interface_block_id *id); - void (*disconnect)(struct gb_interface_block *gb_ib); + void (*disconnect)(struct gb_interface *intf); - int (*suspend)(struct gb_interface_block *gb_ib, pm_message_t message); - int (*resume)(struct gb_interface_block *gb_ib); + int (*suspend)(struct gb_interface *intf, pm_message_t message); + int (*resume)(struct gb_interface *intf); const struct greybus_interface_block_id *id_table; @@ -175,13 +175,13 @@ void gb_uart_device_exit(struct gb_connection *connection); int svc_set_route_send(struct gb_bundle *bundle, struct greybus_host_device *hd); -extern struct device_type greybus_interface_block_type; +extern struct device_type greybus_interface_type; extern struct device_type greybus_bundle_type; extern struct device_type greybus_connection_type; -static inline int is_gb_interface_block(const struct device *dev) +static inline int is_gb_interface(const struct device *dev) { - return dev->type == &greybus_interface_block_type; + return dev->type == &greybus_interface_type; } static inline int is_gb_bundle(const struct device *dev) diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index f47c8fc18433..f2c935439a9b 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -1,5 +1,5 @@ /* - * Greybus interface block code + * Greybus interface code * * Copyright 2014 Google Inc. * Copyright 2014 Linaro Ltd. @@ -9,24 +9,24 @@ #include "greybus.h" -/* interface block sysfs attributes */ -#define gb_ib_attr(field, type) \ -static ssize_t field##_show(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ +/* interface sysfs attributes */ +#define gb_interface_attr(field, type) \ +static ssize_t field##_show(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ - struct gb_interface_block *gb_ib = to_gb_interface_block(dev); \ - return sprintf(buf, "%"#type"\n", gb_ib->field); \ + struct gb_interface *intf = to_gb_interface(dev); \ + return sprintf(buf, "%"#type"\n", intf->field); \ } \ static DEVICE_ATTR_RO(field) -gb_ib_attr(vendor, x); -gb_ib_attr(product, x); -gb_ib_attr(unique_id, llX); -gb_ib_attr(vendor_string, s); -gb_ib_attr(product_string, s); +gb_interface_attr(vendor, x); +gb_interface_attr(product, x); +gb_interface_attr(unique_id, llX); +gb_interface_attr(vendor_string, s); +gb_interface_attr(product_string, s); -static struct attribute *interface_block_attrs[] = { +static struct attribute *interface_attrs[] = { &dev_attr_vendor.attr, &dev_attr_product.attr, &dev_attr_unique_id.attr, @@ -34,143 +34,144 @@ static struct attribute *interface_block_attrs[] = { &dev_attr_product_string.attr, NULL, }; -ATTRIBUTE_GROUPS(interface_block); +ATTRIBUTE_GROUPS(interface); /* XXX This could be per-host device */ static DEFINE_SPINLOCK(gb_modules_lock); -static int gb_ib_match_one_id(struct gb_interface_block *gb_ib, - const struct greybus_interface_block_id *id) +static int gb_interface_match_one_id(struct gb_interface *intf, + const struct greybus_interface_block_id *id) { if ((id->match_flags & GREYBUS_ID_MATCH_VENDOR) && - (id->vendor != gb_ib->vendor)) + (id->vendor != intf->vendor)) return 0; if ((id->match_flags & GREYBUS_ID_MATCH_PRODUCT) && - (id->product != gb_ib->product)) + (id->product != intf->product)) return 0; if ((id->match_flags & GREYBUS_ID_MATCH_SERIAL) && - (id->unique_id != gb_ib->unique_id)) + (id->unique_id != intf->unique_id)) return 0; return 1; } const struct greybus_interface_block_id * -gb_ib_match_id(struct gb_interface_block *gb_ib, - const struct greybus_interface_block_id *id) +gb_interface_match_id(struct gb_interface *intf, + const struct greybus_interface_block_id *id) { if (id == NULL) return NULL; for (; id->vendor || id->product || id->unique_id || id->driver_info; id++) { - if (gb_ib_match_one_id(gb_ib, id)) + if (gb_interface_match_one_id(intf, id)) return id; } return NULL; } -struct gb_interface_block *gb_ib_find(struct greybus_host_device *hd, u8 module_id) +struct gb_interface *gb_interface_find(struct greybus_host_device *hd, + u8 module_id) { - struct gb_interface_block *gb_ib; + struct gb_interface *intf; - list_for_each_entry(gb_ib, &hd->modules, links) - if (gb_ib->module_id == module_id) - return gb_ib; + list_for_each_entry(intf, &hd->modules, links) + if (intf->module_id == module_id) + return intf; return NULL; } -static void greybus_ib_release(struct device *dev) +static void greybus_interface_release(struct device *dev) { - struct gb_interface_block *gb_ib = to_gb_interface_block(dev); + struct gb_interface *intf = to_gb_interface(dev); - kfree(gb_ib); + kfree(intf); } -struct device_type greybus_interface_block_type = { - .name = "greybus_interface_block", - .release = greybus_ib_release, +struct device_type greybus_interface_type = { + .name = "greybus_interface", + .release = greybus_interface_release, }; /* * A Greybus module represents a user-replicable component on an Ara - * phone. An interface block is the physical connection on that module. A - * module may have more than one interface block. + * phone. An interface is the physical connection on that module. A + * module may have more than one interface. * - * Create a gb_interface_block structure to represent a discovered module. + * Create a gb_interface 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. */ -static struct gb_interface_block *gb_ib_create(struct greybus_host_device *hd, - u8 module_id) +static struct gb_interface *gb_interface_create(struct greybus_host_device *hd, + u8 module_id) { - struct gb_interface_block *gb_ib; + struct gb_interface *intf; int retval; - gb_ib = gb_ib_find(hd, module_id); - if (gb_ib) { + intf = gb_interface_find(hd, module_id); + if (intf) { dev_err(hd->parent, "Duplicate module id %d will not be created\n", module_id); return NULL; } - gb_ib = kzalloc(sizeof(*gb_ib), GFP_KERNEL); - if (!gb_ib) + intf = kzalloc(sizeof(*intf), GFP_KERNEL); + if (!intf) return NULL; - gb_ib->hd = hd; /* XXX refcount? */ - gb_ib->module_id = module_id; - INIT_LIST_HEAD(&gb_ib->bundles); + intf->hd = hd; /* XXX refcount? */ + intf->module_id = module_id; + INIT_LIST_HEAD(&intf->bundles); - 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 = interface_block_groups; - gb_ib->dev.dma_mask = hd->parent->dma_mask; - device_initialize(&gb_ib->dev); - dev_set_name(&gb_ib->dev, "%d", module_id); + intf->dev.parent = hd->parent; + intf->dev.bus = &greybus_bus_type; + intf->dev.type = &greybus_interface_type; + intf->dev.groups = interface_groups; + intf->dev.dma_mask = hd->parent->dma_mask; + device_initialize(&intf->dev); + dev_set_name(&intf->dev, "%d", module_id); - retval = device_add(&gb_ib->dev); + retval = device_add(&intf->dev); if (retval) { pr_err("failed to add module device for id 0x%02hhx\n", module_id); - put_device(&gb_ib->dev); - kfree(gb_ib); + put_device(&intf->dev); + kfree(intf); return NULL; } spin_lock_irq(&gb_modules_lock); - list_add_tail(&gb_ib->links, &hd->modules); + list_add_tail(&intf->links, &hd->modules); spin_unlock_irq(&gb_modules_lock); - return gb_ib; + return intf; } /* * Tear down a previously set up module. */ -static void gb_ib_destroy(struct gb_interface_block *gb_ib) +static void gb_interface_destroy(struct gb_interface *intf) { - if (WARN_ON(!gb_ib)) + if (WARN_ON(!intf)) return; spin_lock_irq(&gb_modules_lock); - list_del(&gb_ib->links); + list_del(&intf->links); spin_unlock_irq(&gb_modules_lock); - gb_bundle_destroy(gb_ib); + gb_bundle_destroy(intf); - kfree(gb_ib->product_string); - kfree(gb_ib->vendor_string); + kfree(intf->product_string); + kfree(intf->vendor_string); /* kref_put(module->hd); */ - device_del(&gb_ib->dev); + device_del(&intf->dev); } /** @@ -182,11 +183,11 @@ static void gb_ib_destroy(struct gb_interface_block *gb_ib) void gb_add_module(struct greybus_host_device *hd, u8 module_id, u8 *data, int size) { - struct gb_interface_block *gb_ib; + struct gb_interface *intf; - gb_ib = gb_ib_create(hd, module_id); - if (!gb_ib) { - dev_err(hd->parent, "failed to create interface block\n"); + intf = gb_interface_create(hd, module_id); + if (!intf) { + dev_err(hd->parent, "failed to create interface\n"); return; } @@ -194,7 +195,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(gb_ib, data, size)) { + if (!gb_manifest_parse(intf, data, size)) { dev_err(hd->parent, "manifest error\n"); goto err_module; } @@ -211,23 +212,23 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id, return; err_module: - gb_ib_destroy(gb_ib); + gb_interface_destroy(intf); } void gb_remove_module(struct greybus_host_device *hd, u8 module_id) { - struct gb_interface_block *gb_ib = gb_ib_find(hd, module_id); + struct gb_interface *intf = gb_interface_find(hd, module_id); - if (gb_ib) - gb_ib_destroy(gb_ib); + if (intf) + gb_interface_destroy(intf); else - dev_err(hd->parent, "interface block id %d not found\n", module_id); + dev_err(hd->parent, "interface id %d not found\n", module_id); } void gb_remove_modules(struct greybus_host_device *hd) { - struct gb_interface_block *gb_ib, *temp; + struct gb_interface *intf, *temp; - list_for_each_entry_safe(gb_ib, temp, &hd->modules, links) - gb_ib_destroy(gb_ib); + list_for_each_entry_safe(intf, temp, &hd->modules, links) + gb_interface_destroy(intf); } diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h index 5c7cebc17e2e..52adc83dd19f 100644 --- a/drivers/staging/greybus/interface.h +++ b/drivers/staging/greybus/interface.h @@ -16,7 +16,7 @@ /* Greybus "public" definitions" */ -struct gb_interface_block { +struct gb_interface { struct device dev; struct list_head bundles; @@ -32,27 +32,26 @@ struct gb_interface_block { struct greybus_host_device *hd; }; -#define to_gb_interface_block(d) container_of(d, struct gb_interface_block, dev) +#define to_gb_interface(d) container_of(d, struct gb_interface, dev) -static inline void -gb_interface_block_set_drvdata(struct gb_interface_block *gb_ib, void *data) +static inline void gb_interface_set_drvdata(struct gb_interface *intf, + void *data) { - dev_set_drvdata(&gb_ib->dev, data); + dev_set_drvdata(&intf->dev, data); } -static inline void * -gb_interface_block_get_drvdata(struct gb_interface_block *gb_ib) +static inline void * gb_interface__get_drvdata(struct gb_interface *intf) { - return dev_get_drvdata(&gb_ib->dev); + return dev_get_drvdata(&intf->dev); } /* Greybus "private" definitions */ const struct greybus_interface_block_id * - gb_ib_match_id(struct gb_interface_block *gb_ib, - const struct greybus_interface_block_id *id); + gb_interface_match_id(struct gb_interface *intf, + const struct greybus_interface_block_id *id); -struct gb_interface_block *gb_ib_find(struct greybus_host_device *hd, - u8 module_id); +struct gb_interface *gb_interface_find(struct greybus_host_device *hd, + u8 module_id); #endif /* __INTERFACE_H */ diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c index 7661ca74acf3..f4cd422c72ad 100644 --- a/drivers/staging/greybus/manifest.c +++ b/drivers/staging/greybus/manifest.c @@ -218,7 +218,7 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle) * structures. Returns the number of bundles set up for the * given module. */ -static u32 gb_manifest_parse_bundles(struct gb_interface_block *gb_ib) +static u32 gb_manifest_parse_bundles(struct gb_interface *intf) { u32 count = 0; @@ -240,7 +240,7 @@ static u32 gb_manifest_parse_bundles(struct gb_interface_block *gb_ib) /* Found one. Set up its bundle structure*/ desc_interface = descriptor->data; - bundle = gb_bundle_create(gb_ib, desc_interface->id); + bundle = gb_bundle_create(intf, desc_interface->id); if (!bundle) return 0; /* Error */ @@ -257,41 +257,41 @@ static u32 gb_manifest_parse_bundles(struct gb_interface_block *gb_ib) return count; } -static bool gb_manifest_parse_module(struct gb_interface_block *gb_ib, - struct manifest_desc *module_desc) +static bool gb_manifest_parse_module(struct gb_interface *intf, + struct manifest_desc *module_desc) { struct greybus_descriptor_module *desc_module = module_desc->data; /* Handle the strings first--they can fail */ - gb_ib->vendor_string = gb_string_get(desc_module->vendor_stringid); - if (IS_ERR(gb_ib->vendor_string)) + intf->vendor_string = gb_string_get(desc_module->vendor_stringid); + if (IS_ERR(intf->vendor_string)) return false; - gb_ib->product_string = gb_string_get(desc_module->product_stringid); - if (IS_ERR(gb_ib->product_string)) { + intf->product_string = gb_string_get(desc_module->product_stringid); + if (IS_ERR(intf->product_string)) { goto out_free_vendor_string; } - 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); + intf->vendor = le16_to_cpu(desc_module->vendor); + intf->product = le16_to_cpu(desc_module->product); + intf->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); /* An interface must have at least one bundle descriptor */ - if (!gb_manifest_parse_bundles(gb_ib)) { + if (!gb_manifest_parse_bundles(intf)) { pr_err("manifest bundle descriptors not valid\n"); goto out_err; } return true; out_err: - kfree(gb_ib->product_string); - gb_ib->product_string = NULL; + kfree(intf->product_string); + intf->product_string = NULL; out_free_vendor_string: - kfree(gb_ib->vendor_string); - gb_ib->vendor_string = NULL; + kfree(intf->vendor_string); + intf->vendor_string = NULL; return false; } @@ -314,12 +314,12 @@ out_free_vendor_string: * information it contains, and then remove that descriptor (and any * string descriptors it refers to) from further consideration. * - * After that we look for the interface block's bundles--there must be at + * After that we look for the interface's bundles--there must be at * least one of those. * * Returns true if parsing was successful, false otherwise. */ -bool gb_manifest_parse(struct gb_interface_block *gb_ib, void *data, size_t size) +bool gb_manifest_parse(struct gb_interface *intf, void *data, size_t size) { struct greybus_manifest *manifest; struct greybus_manifest_header *header; @@ -389,7 +389,7 @@ bool gb_manifest_parse(struct gb_interface_block *gb_ib, void *data, size_t size } /* Parse the module manifest, starting with the module descriptor */ - result = gb_manifest_parse_module(gb_ib, module_desc); + result = gb_manifest_parse_module(intf, module_desc); /* * We really should have no remaining descriptors, but we diff --git a/drivers/staging/greybus/manifest.h b/drivers/staging/greybus/manifest.h index a8316a0399f9..90fb62df8063 100644 --- a/drivers/staging/greybus/manifest.h +++ b/drivers/staging/greybus/manifest.h @@ -10,7 +10,7 @@ #ifndef __MANIFEST_H #define __MANIFEST_H -struct gb_interface_block; -bool gb_manifest_parse(struct gb_interface_block *gb_ib, void *data, size_t size); +struct gb_interface; +bool gb_manifest_parse(struct gb_interface *intf, void *data, size_t size); #endif /* __MANIFEST_H */ diff --git a/drivers/staging/greybus/svc_msg.h b/drivers/staging/greybus/svc_msg.h index 1f8c4d574536..471baa59078e 100644 --- a/drivers/staging/greybus/svc_msg.h +++ b/drivers/staging/greybus/svc_msg.h @@ -83,9 +83,8 @@ enum svc_function_hotplug_event { }; /* XXX - * Does a hotplug come from module insertion, or from detection - * of each interface block (UniPro device) in a module? Assume - * the former for now. + * Does a hotplug come from module insertion, or from detection of each + * interface (UniPro device) in a module? Assume the former for now. */ struct svc_function_hotplug { __u8 hotplug_event; /* enum svc_function_hotplug_event */ @@ -116,7 +115,7 @@ struct svc_function_power_battery_status_request { }; /* XXX - * Each interface block carries power, so it's possible these things + * Each interface carries power, so it's possible these things * are associated with each UniPro device and not just the module. * For now it's safe to assume it's per-module. */ @@ -145,7 +144,7 @@ enum svc_function_suspend_command_type { SVC_SUSPEND_FIXME_2 = 0x01, }; -/* We'll want independent control for multi-interface block modules */ +/* We'll want independent control for multi-interface modules */ struct svc_function_suspend { __u8 suspend_command_type; /* enum function_suspend_command_type */ __u8 device_id;