Commit 7567d603 authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

net: usb: hso: use DEVICE_ATTR_RO macro

Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48afdaea
...@@ -457,9 +457,8 @@ static const struct usb_device_id hso_ids[] = { ...@@ -457,9 +457,8 @@ static const struct usb_device_id hso_ids[] = {
MODULE_DEVICE_TABLE(usb, hso_ids); MODULE_DEVICE_TABLE(usb, hso_ids);
/* Sysfs attribute */ /* Sysfs attribute */
static ssize_t hso_sysfs_show_porttype(struct device *dev, static ssize_t hsotype_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr, char *buf)
char *buf)
{ {
struct hso_device *hso_dev = dev_get_drvdata(dev); struct hso_device *hso_dev = dev_get_drvdata(dev);
char *port_name; char *port_name;
...@@ -505,7 +504,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev, ...@@ -505,7 +504,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev,
return sprintf(buf, "%s\n", port_name); return sprintf(buf, "%s\n", port_name);
} }
static DEVICE_ATTR(hsotype, 0444, hso_sysfs_show_porttype, NULL); static DEVICE_ATTR_RO(hsotype);
static struct attribute *hso_serial_dev_attrs[] = { static struct attribute *hso_serial_dev_attrs[] = {
&dev_attr_hsotype.attr, &dev_attr_hsotype.attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment