diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 5ced992e17d4..47a3413b6f21 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -80,7 +80,8 @@ void gb_bundle_bind_protocols(void) * 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 *intf, u8 interface_id) +struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id, + u8 class_type) { struct gb_bundle *bundle; int retval; @@ -90,7 +91,8 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 interface_id) return NULL; bundle->intf = intf; - bundle->id = interface_id; + bundle->id = bundle_id; + bundle->class_type = class_type; INIT_LIST_HEAD(&bundle->connections); /* Invalid device id to start with */ @@ -103,12 +105,12 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 interface_id) bundle->dev.type = &greybus_bundle_type; bundle->dev.groups = bundle_groups; device_initialize(&bundle->dev); - dev_set_name(&bundle->dev, "%s:%d", dev_name(&intf->dev), interface_id); + dev_set_name(&bundle->dev, "%s:%d", dev_name(&intf->dev), bundle_id); retval = device_add(&bundle->dev); if (retval) { pr_err("failed to add bundle device for id 0x%02hhx\n", - interface_id); + bundle_id); put_device(&bundle->dev); kfree(bundle); return NULL; diff --git a/drivers/staging/greybus/bundle.h b/drivers/staging/greybus/bundle.h index 62969cf0fa1f..385c90a5e9f8 100644 --- a/drivers/staging/greybus/bundle.h +++ b/drivers/staging/greybus/bundle.h @@ -17,6 +17,7 @@ struct gb_bundle { struct device dev; struct gb_interface *intf; u8 id; + u8 class_type; u8 device_id; struct list_head connections; @@ -27,7 +28,8 @@ struct gb_bundle { #define GB_DEVICE_ID_BAD 0xff /* Greybus "private" definitions" */ -struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 module_id); +struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id, + u8 class_type); void gb_bundle_destroy(struct gb_interface *intf); int gb_bundle_init(struct gb_interface *intf, u8 module_id, u8 device_id); diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c index c00e378453df..8541a2a9f0d2 100644 --- a/drivers/staging/greybus/manifest.c +++ b/drivers/staging/greybus/manifest.c @@ -108,6 +108,9 @@ static int identify_descriptor(struct gb_interface *intf, break; case GREYBUS_TYPE_INTERFACE: break; + case GREYBUS_TYPE_BUNDLE: + expected_size += sizeof(struct greybus_descriptor_bundle); + break; case GREYBUS_TYPE_CPORT: expected_size += sizeof(struct greybus_descriptor_cport); break; @@ -237,7 +240,7 @@ static u32 gb_manifest_parse_cports(struct gb_interface *intf, /* * Find bundle descriptors in the manifest and set up their data * structures. Returns the number of bundles set up for the - * given module. + * given interface. */ static u32 gb_manifest_parse_bundles(struct gb_interface *intf) { @@ -245,13 +248,13 @@ static u32 gb_manifest_parse_bundles(struct gb_interface *intf) while (true) { struct manifest_desc *descriptor; - struct greybus_descriptor_interface *desc_interface; + struct greybus_descriptor_bundle *desc_bundle; struct gb_bundle *bundle; bool found = false; /* Find an bundle descriptor */ list_for_each_entry(descriptor, &intf->manifest_descs, links) { - if (descriptor->type == GREYBUS_TYPE_INTERFACE) { + if (descriptor->type == GREYBUS_TYPE_BUNDLE) { found = true; break; } @@ -260,8 +263,9 @@ static u32 gb_manifest_parse_bundles(struct gb_interface *intf) break; /* Found one. Set up its bundle structure*/ - desc_interface = descriptor->data; - bundle = gb_bundle_create(intf, desc_interface->id); + desc_bundle = descriptor->data; + bundle = gb_bundle_create(intf, desc_bundle->id, + desc_bundle->class_type); if (!bundle) return 0; /* Error */