Description:
Vendor ID string of a Greybus interface block.
+What: /sys/bus/greybus/device/.../device_id
+Date: October 2015
+KernelVersion: 4.XX
+Contact: Greg Kroah-Hartman <greg@kroah.com>
+Description:
+ The device ID of a Greybus interface block.
+
What: /sys/bus/greybus/device/.../state
Date: October 2015
KernelVersion: 4.XX
Description:
The protocol ID of a Greybus connection.
-What: /sys/bus/greybus/device/.../device_id
-Date: October 2015
-KernelVersion: 4.XX
-Contact: Greg Kroah-Hartman <greg@kroah.com>
-Description:
- The device ID of a Greybus bundle.
-
What: /sys/bus/greybus/device/.../state
Date: October 2015
KernelVersion: 4.XX
static int gb_bundle_connections_init(struct gb_bundle *bundle);
-static ssize_t device_id_show(struct device *dev, struct device_attribute *attr,
- char *buf)
-{
- struct gb_bundle *bundle = to_gb_bundle(dev);
-
- return sprintf(buf, "%d\n", bundle->device_id);
-}
-static DEVICE_ATTR_RO(device_id);
-
static ssize_t class_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
static struct attribute *bundle_attrs[] = {
- &dev_attr_device_id.attr,
&dev_attr_class.attr,
&dev_attr_state.attr,
NULL,
bundle->class = class;
INIT_LIST_HEAD(&bundle->connections);
- /* Invalid device id to start with */
- bundle->device_id = GB_DEVICE_ID_BAD;
-
/* Build up the bundle device structures and register it with the
* driver core */
bundle->dev.parent = &intf->dev;
device_unregister(&bundle->dev);
}
-int gb_bundle_init(struct gb_bundle *bundle, u8 device_id)
+int gb_bundle_init(struct gb_bundle *bundle)
{
struct gb_interface *intf = bundle->intf;
int ret;
if (intf->control && bundle->id == GB_CONTROL_BUNDLE_ID)
return 0;
- bundle->device_id = device_id;
-
ret = gb_bundle_connections_init(bundle);
if (ret) {
dev_err(intf->hd->parent, "interface bundle init error %d\n",
return 0;
}
-int gb_bundles_init(struct gb_interface *intf, u8 device_id)
+int gb_bundles_init(struct gb_interface *intf)
{
struct gb_bundle *bundle;
int ret = 0;
list_for_each_entry(bundle, &intf->bundles, links) {
- ret = gb_bundle_init(bundle, device_id);
+ ret = gb_bundle_init(bundle);
if (ret) {
dev_err(intf->hd->parent,
"Failed to initialize bundle %hhu\n",
struct gb_interface *intf;
u8 id;
u8 class;
- u8 device_id;
struct list_head connections;
u8 *state;
struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
u8 class);
void gb_bundle_destroy(struct gb_bundle *bundle);
-int gb_bundle_init(struct gb_bundle *bundle, u8 device_id);
-int gb_bundles_init(struct gb_interface *intf, u8 device_id);
+int gb_bundle_init(struct gb_bundle *bundle);
+int gb_bundles_init(struct gb_interface *intf);
struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id);
void gb_bundle_bind_protocols(void);
void gb_connection_bind_protocol(struct gb_connection *connection)
{
- struct gb_bundle *bundle;
+ struct gb_interface *intf;
struct gb_protocol *protocol;
/* If we already have a protocol bound here, just return */
connection->protocol = protocol;
/*
- * If we have a valid device_id for the bundle, then we have an active
- * device, so bring up the connection at the same time.
+ * If we have a valid device_id for the interface block, then we have an
+ * active device, so bring up the connection at the same time.
* */
- bundle = connection->bundle;
- if (bundle->device_id != GB_DEVICE_ID_BAD)
+ intf = connection->bundle->intf;
+ if (intf->device_id != GB_DEVICE_ID_BAD)
gb_connection_init(connection);
}
} \
static DEVICE_ATTR_RO(field)
+gb_interface_attr(device_id, d);
gb_interface_attr(vendor, x);
gb_interface_attr(product, x);
gb_interface_attr(unique_id, llX);
gb_interface_attr(product_string, s);
static struct attribute *interface_attrs[] = {
+ &dev_attr_device_id.attr,
&dev_attr_vendor.attr,
&dev_attr_product.attr,
&dev_attr_unique_id.attr,
* managing control CPort. Also initialize the bundle, which will request SVC to
* set route and will initialize the control protocol for this connection.
*/
-static int gb_create_control_connection(struct gb_interface *intf, u8 device_id)
+static int gb_create_control_connection(struct gb_interface *intf)
{
struct gb_bundle *bundle;
- int ret;
bundle = gb_bundle_create(intf, GB_CONTROL_BUNDLE_ID,
GREYBUS_CLASS_CONTROL);
GREYBUS_PROTOCOL_CONTROL))
return -EINVAL;
- ret = gb_bundle_init(bundle, device_id);
- if (ret) {
- dev_err(&intf->dev,
- "error %d initializing bundles for interface %hu\n",
- ret, intf->interface_id);
- return ret;
- }
-
return 0;
}
INIT_LIST_HEAD(&intf->bundles);
INIT_LIST_HEAD(&intf->manifest_descs);
+ /* Invalid device id to start with */
+ intf->device_id = GB_DEVICE_ID_BAD;
+
intf->dev.parent = &module->dev;
intf->dev.bus = &greybus_bus_type;
intf->dev.type = &greybus_interface_type;
int ret, size;
void *manifest;
+ intf->device_id = device_id;
+
/* Establish control CPort connection */
- ret = gb_create_control_connection(intf, device_id);
+ ret = gb_create_control_connection(intf);
if (ret) {
dev_err(&intf->dev, "Failed to create control CPort connection (%d)\n", ret);
return ret;
goto free_manifest;
}
- ret = gb_bundles_init(intf, device_id);
- if (ret)
- dev_err(&intf->dev,
- "Error %d initializing bundles for interface %hu\n",
- ret, intf->interface_id);
-
/*
* XXX
* We've successfully parsed the manifest. Now we need to
struct list_head links; /* greybus_host_device->interfaces */
struct list_head manifest_descs;
u8 interface_id; /* Physical location within the Endo */
+ u8 device_id; /* Device id allocated for the interface block by the SVC */
/* Information taken from the manifest descriptor */
u16 vendor;