greybus: October 1 updates
Update the definitions in "greybus_manifest.h" to reflect the
changes to the Greybus specification made on October 1.
They are:
- renaming "device" to be "interface"
- renumbering greybus descriptor type
- eliminating the notion of a "function"
- defining a CPort's protocol in the CPort descriptor
- having a "class" take on the types previously used for "function"
- renaming "serial number" to be "unique id" (for now)
- relying on an interface's maximum cport id to determine how
much device+cport address space the interface consumes
- adding a simple class descriptor
- renaming gb_interface->interface_id to be gb_interface->id
This also reorders some things to match ordering in the document,
and adds some commentary for the various structures.
Since greybus_function_type is gone, we eliminate the "type" field
from a function structure. (Functions are going away, next.)
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index bae260f..4066547 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -80,11 +80,6 @@
return -EINVAL;
}
break;
- case GREYBUS_TYPE_DEVICE:
- break;
- case GREYBUS_TYPE_CLASS:
- pr_err("class descriptor found (ignoring)\n");
- break;
case GREYBUS_TYPE_STRING:
expected_size = sizeof(struct greybus_descriptor_header);
expected_size += sizeof(struct greybus_descriptor_string);
@@ -95,6 +90,8 @@
return -EINVAL;
}
break;
+ case GREYBUS_TYPE_INTERFACE:
+ break;
case GREYBUS_TYPE_CPORT:
if (desc_size < sizeof(struct greybus_descriptor_cport)) {
pr_err("cport descriptor too small (%u)\n",
@@ -102,6 +99,9 @@
return -EINVAL;
}
break;
+ case GREYBUS_TYPE_CLASS:
+ pr_warn("class descriptor found (ignoring)\n");
+ break;
case GREYBUS_TYPE_INVALID:
default:
pr_err("invalid descriptor type (%hhu)\n", desc_header->type);
@@ -183,7 +183,7 @@
while (true) {
struct manifest_desc *descriptor;
struct greybus_descriptor_cport *desc_cport;
- enum greybus_function_type function_type;
+ enum greybus_protocol protocol;
u16 cport_id;
bool found;
@@ -191,19 +191,20 @@
found = false;
list_for_each_entry(descriptor, &manifest_descs, links) {
if (descriptor->type == GREYBUS_TYPE_CPORT) {
- found = true;
- break;
+ desc_cport = descriptor->data;
+ if (desc_cport->interface == interface->id) {
+ found = true;
+ break;
+ }
}
}
if (!found)
break;
/* Found one. Set up its function structure */
- desc_cport = descriptor->data;
- function_type =
- (enum greybus_function_type)desc_cport->function_type;
+ protocol = (enum greybus_protocol)desc_cport->protocol;
cport_id = le16_to_cpu(desc_cport->id);
- if (!gb_function_create(interface, cport_id, function_type))
+ if (!gb_function_create(interface, cport_id))
return 0; /* Error */
count++;
@@ -231,7 +232,7 @@
/* Find an interface descriptor */
list_for_each_entry(descriptor, &manifest_descs, links) {
- if (descriptor->type == GREYBUS_TYPE_DEVICE) {
+ if (descriptor->type == GREYBUS_TYPE_INTERFACE) {
found = true;
break;
}
@@ -284,7 +285,7 @@
gmod->vendor = le16_to_cpu(desc_module->vendor);
gmod->product = le16_to_cpu(desc_module->product);
gmod->version = le16_to_cpu(desc_module->version);
- gmod->serial_number = le64_to_cpu(desc_module->serial_number);
+ gmod->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);