Merge tag 'iwlwifi-next-for-kalle-2014-12-30' of https://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / drivers / rapidio / rio-sysfs.c
index e0221c6..cdb005c 100644 (file)
@@ -341,3 +341,43 @@ const struct attribute_group *rio_bus_groups[] = {
        &rio_bus_group,
        NULL,
 };
+
+static ssize_t
+port_destid_show(struct device *dev, struct device_attribute *attr,
+                char *buf)
+{
+       struct rio_mport *mport = to_rio_mport(dev);
+
+       if (mport)
+               return sprintf(buf, "0x%04x\n", mport->host_deviceid);
+       else
+               return -ENODEV;
+}
+static DEVICE_ATTR_RO(port_destid);
+
+static ssize_t sys_size_show(struct device *dev, struct device_attribute *attr,
+                          char *buf)
+{
+       struct rio_mport *mport = to_rio_mport(dev);
+
+       if (mport)
+               return sprintf(buf, "%u\n", mport->sys_size);
+       else
+               return -ENODEV;
+}
+static DEVICE_ATTR_RO(sys_size);
+
+static struct attribute *rio_mport_attrs[] = {
+       &dev_attr_port_destid.attr,
+       &dev_attr_sys_size.attr,
+       NULL,
+};
+
+static const struct attribute_group rio_mport_group = {
+       .attrs = rio_mport_attrs,
+};
+
+const struct attribute_group *rio_mport_groups[] = {
+       &rio_mport_group,
+       NULL,
+};