Commit 0056982f authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

ehea: Use DEVICE_ATTR_*() macro

Use DEVICE_ATTR_*() 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 4934fb7d
...@@ -2867,14 +2867,14 @@ static int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo) ...@@ -2867,14 +2867,14 @@ static int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
return ret; return ret;
} }
static ssize_t ehea_show_port_id(struct device *dev, static ssize_t log_port_id_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev); struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev);
return sprintf(buf, "%d", port->logical_port_id); return sprintf(buf, "%d", port->logical_port_id);
} }
static DEVICE_ATTR(log_port_id, 0444, ehea_show_port_id, NULL); static DEVICE_ATTR_RO(log_port_id);
static void logical_port_release(struct device *dev) static void logical_port_release(struct device *dev)
{ {
...@@ -3113,7 +3113,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter, ...@@ -3113,7 +3113,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
return NULL; return NULL;
} }
static ssize_t ehea_probe_port(struct device *dev, static ssize_t probe_port_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -3168,9 +3168,9 @@ static ssize_t ehea_probe_port(struct device *dev, ...@@ -3168,9 +3168,9 @@ static ssize_t ehea_probe_port(struct device *dev,
return (ssize_t) count; return (ssize_t) count;
} }
static ssize_t ehea_remove_port(struct device *dev, static ssize_t remove_port_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ehea_adapter *adapter = dev_get_drvdata(dev); struct ehea_adapter *adapter = dev_get_drvdata(dev);
struct ehea_port *port; struct ehea_port *port;
...@@ -3203,8 +3203,8 @@ static ssize_t ehea_remove_port(struct device *dev, ...@@ -3203,8 +3203,8 @@ static ssize_t ehea_remove_port(struct device *dev,
return (ssize_t) count; return (ssize_t) count;
} }
static DEVICE_ATTR(probe_port, 0200, NULL, ehea_probe_port); static DEVICE_ATTR_WO(probe_port);
static DEVICE_ATTR(remove_port, 0200, NULL, ehea_remove_port); static DEVICE_ATTR_WO(remove_port);
static int ehea_create_device_sysfs(struct platform_device *dev) static int ehea_create_device_sysfs(struct platform_device *dev)
{ {
......
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