Description:
Product ID of a Greybus interface.
-What: /sys/bus/greybus/device/N-I/product_string
-Date: October 2015
-KernelVersion: 4.XX
-Contact: Greg Kroah-Hartman <greg@kroah.com>
-Description:
- Product ID string of a Greybus interface.
-
What: /sys/bus/greybus/device/N-I/vendor_id
Date: October 2015
KernelVersion: 4.XX
Description:
Vendor ID of a Greybus interface.
-What: /sys/bus/greybus/device/N-I/vendor_string
-Date: October 2015
-KernelVersion: 4.XX
-Contact: Greg Kroah-Hartman <greg@kroah.com>
-Description:
- Vendor ID string of a Greybus interface block.
-
What: /sys/bus/greybus/device/N-I/version
Date: October 2015
KernelVersion: 4.XX
A bundle B on the Interface I, B is replaced by a 1-byte
number representing the bundle.
+What: /sys/bus/greybus/device/N-I.ctrl/product_string
+Date: October 2015
+KernelVersion: 4.XX
+Contact: Greg Kroah-Hartman <greg@kroah.com>
+Description:
+ Product ID string of a Greybus interface.
+
+What: /sys/bus/greybus/device/N-I.ctrl/vendor_string
+Date: October 2015
+KernelVersion: 4.XX
+Contact: Greg Kroah-Hartman <greg@kroah.com>
+Description:
+ Vendor ID string of a Greybus interface.
+
What: /sys/bus/greybus/device/N-I.B/bundle_class
Date: October 2015
KernelVersion: 4.XX
NULL, 0);
}
+static ssize_t vendor_string_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gb_control *control = to_gb_control(dev);
+
+ return scnprintf(buf, PAGE_SIZE, "%s\n", control->vendor_string);
+}
+static DEVICE_ATTR_RO(vendor_string);
+
+static ssize_t product_string_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gb_control *control = to_gb_control(dev);
+
+ return scnprintf(buf, PAGE_SIZE, "%s\n", control->product_string);
+}
+static DEVICE_ATTR_RO(product_string);
+
+static struct attribute *control_attrs[] = {
+ &dev_attr_vendor_string.attr,
+ &dev_attr_product_string.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(control);
+
static void gb_control_release(struct device *dev)
{
struct gb_control *control = to_gb_control(dev);
gb_connection_destroy(control->connection);
+ kfree(control->vendor_string);
+ kfree(control->product_string);
+
kfree(control);
}
control->dev.parent = &intf->dev;
control->dev.bus = &greybus_bus_type;
control->dev.type = &greybus_control_type;
+ control->dev.groups = control_groups;
control->dev.dma_mask = intf->dev.dma_mask;
device_initialize(&control->dev);
dev_set_name(&control->dev, "%s.ctrl", dev_name(&intf->dev));
u8 protocol_minor;
bool has_bundle_version;
+
+ char *vendor_string;
+ char *product_string;
};
#define to_gb_control(d) container_of(d, struct gb_control, dev)
gb_interface_attr(interface_id, "%u");
gb_interface_attr(vendor_id, "0x%08x");
gb_interface_attr(product_id, "0x%08x");
-gb_interface_attr(vendor_string, "%s");
-gb_interface_attr(product_string, "%s");
gb_interface_attr(serial_number, "0x%016llx");
static ssize_t version_show(struct device *dev, struct device_attribute *attr,
&dev_attr_interface_id.attr,
&dev_attr_vendor_id.attr,
&dev_attr_product_id.attr,
- &dev_attr_vendor_string.attr,
- &dev_attr_product_string.attr,
&dev_attr_serial_number.attr,
&dev_attr_version.attr,
&dev_attr_voltage_now.attr,
{
struct gb_interface *intf = to_gb_interface(dev);
- kfree(intf->product_string);
- kfree(intf->vendor_string);
-
if (intf->control)
gb_control_put(intf->control);
u8 interface_id; /* Physical location within the Endo */
u8 device_id;
- /* Information taken from the manifest descriptor */
- char *vendor_string;
- char *product_string;
-
u32 ddbl1_manufacturer_id;
u32 ddbl1_product_id;
u32 vendor_id;
struct manifest_desc *interface_desc)
{
struct greybus_descriptor_interface *desc_intf = interface_desc->data;
+ struct gb_control *control = intf->control;
char *str;
/* Handle the strings first--they can fail */
str = gb_string_get(intf, desc_intf->vendor_stringid);
if (IS_ERR(str))
return false;
- intf->vendor_string = str;
+ control->vendor_string = str;
str = gb_string_get(intf, desc_intf->product_stringid);
if (IS_ERR(str))
goto out_free_vendor_string;
- intf->product_string = str;
+ control->product_string = str;
/* Release the interface descriptor, now that we're done with it */
release_manifest_descriptor(interface_desc);
return true;
out_err:
- kfree(intf->product_string);
- intf->product_string = NULL;
+ kfree(control->product_string);
+ control->product_string = NULL;
out_free_vendor_string:
- kfree(intf->vendor_string);
- intf->vendor_string = NULL;
+ kfree(control->vendor_string);
+ control->vendor_string = NULL;
return false;
}