* 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;
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 */
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;
struct device dev;
struct gb_interface *intf;
u8 id;
+ u8 class_type;
u8 device_id;
struct list_head connections;
#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);
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;
/*
* 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)
{
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;
}
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 */