|
@@ -378,26 +378,31 @@ static void xenbus_dev_release(struct device *dev)
|
|
|
kfree(to_xenbus_device(dev));
|
|
|
}
|
|
|
|
|
|
-static ssize_t xendev_show_nodename(struct device *dev,
|
|
|
- struct device_attribute *attr, char *buf)
|
|
|
+static ssize_t nodename_show(struct device *dev,
|
|
|
+ struct device_attribute *attr, char *buf)
|
|
|
{
|
|
|
return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
|
|
|
}
|
|
|
-static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
|
|
|
|
|
|
-static ssize_t xendev_show_devtype(struct device *dev,
|
|
|
- struct device_attribute *attr, char *buf)
|
|
|
+static ssize_t devtype_show(struct device *dev,
|
|
|
+ struct device_attribute *attr, char *buf)
|
|
|
{
|
|
|
return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
|
|
|
}
|
|
|
-static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
|
|
|
|
|
|
-static ssize_t xendev_show_modalias(struct device *dev,
|
|
|
- struct device_attribute *attr, char *buf)
|
|
|
+static ssize_t modalias_show(struct device *dev,
|
|
|
+ struct device_attribute *attr, char *buf)
|
|
|
{
|
|
|
return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype);
|
|
|
}
|
|
|
-static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
|
|
|
+
|
|
|
+struct device_attribute xenbus_dev_attrs[] = {
|
|
|
+ __ATTR_RO(nodename),
|
|
|
+ __ATTR_RO(devtype),
|
|
|
+ __ATTR_RO(modalias),
|
|
|
+ __ATTR_NULL
|
|
|
+};
|
|
|
+EXPORT_SYMBOL_GPL(xenbus_dev_attrs);
|
|
|
|
|
|
int xenbus_probe_node(struct xen_bus_type *bus,
|
|
|
const char *type,
|
|
@@ -449,25 +454,7 @@ int xenbus_probe_node(struct xen_bus_type *bus,
|
|
|
if (err)
|
|
|
goto fail;
|
|
|
|
|
|
- err = device_create_file(&xendev->dev, &dev_attr_nodename);
|
|
|
- if (err)
|
|
|
- goto fail_unregister;
|
|
|
-
|
|
|
- err = device_create_file(&xendev->dev, &dev_attr_devtype);
|
|
|
- if (err)
|
|
|
- goto fail_remove_nodename;
|
|
|
-
|
|
|
- err = device_create_file(&xendev->dev, &dev_attr_modalias);
|
|
|
- if (err)
|
|
|
- goto fail_remove_devtype;
|
|
|
-
|
|
|
return 0;
|
|
|
-fail_remove_devtype:
|
|
|
- device_remove_file(&xendev->dev, &dev_attr_devtype);
|
|
|
-fail_remove_nodename:
|
|
|
- device_remove_file(&xendev->dev, &dev_attr_nodename);
|
|
|
-fail_unregister:
|
|
|
- device_unregister(&xendev->dev);
|
|
|
fail:
|
|
|
kfree(xendev);
|
|
|
return err;
|