Skip to content

Commit

Permalink
net: usb: hso: use DEVICE_ATTR_RO macro
Browse files Browse the repository at this point in the history
Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YueHaibing authored and David S. Miller committed May 20, 2021
1 parent 48afdae commit 7567d60
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/usb/hso.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,8 @@ static const struct usb_device_id hso_ids[] = {
MODULE_DEVICE_TABLE(usb, hso_ids);

/* Sysfs attribute */
static ssize_t hso_sysfs_show_porttype(struct device *dev,
struct device_attribute *attr,
char *buf)
static ssize_t hsotype_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hso_device *hso_dev = dev_get_drvdata(dev);
char *port_name;
Expand Down Expand Up @@ -505,7 +504,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev,

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[] = {
&dev_attr_hsotype.attr,
Expand Down

0 comments on commit 7567d60

Please sign in to comment.