summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-11-25 15:59:04 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-11-25 15:27:06 -0800
commit8b0df4b2eaf2f741ae44e8f5bad4ecb223f87932 (patch)
treed41ab2630f80140f4ddbed6cd33cc7988347d1a7 /drivers
parent582b3a13920c71ca6e546598d344dc6027168e64 (diff)
downloadop-kernel-dev-8b0df4b2eaf2f741ae44e8f5bad4ecb223f87932.zip
op-kernel-dev-8b0df4b2eaf2f741ae44e8f5bad4ecb223f87932.tar.gz
greybus: interface: make interfaces children of host devices
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/greybus/interface.c17
-rw-r--r--drivers/staging/greybus/interface.h1
-rw-r--r--drivers/staging/greybus/loopback.c6
3 files changed, 3 insertions, 21 deletions
diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c
index 1b13d37..5060924 100644
--- a/drivers/staging/greybus/interface.c
+++ b/drivers/staging/greybus/interface.c
@@ -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)
diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h
index 71493cd..1202062 100644
--- a/drivers/staging/greybus/interface.h
+++ b/drivers/staging/greybus/interface.h
@@ -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 */
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 0c38414..ededfef 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -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)
OpenPOWER on IntegriCloud