Commit 3880fc37 authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

sfc: 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 52af13a4
...@@ -370,7 +370,7 @@ static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address) ...@@ -370,7 +370,7 @@ static int efx_ef10_get_mac_address_vf(struct efx_nic *efx, u8 *mac_address)
return 0; return 0;
} }
static ssize_t efx_ef10_show_link_control_flag(struct device *dev, static ssize_t link_control_flag_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
...@@ -382,7 +382,7 @@ static ssize_t efx_ef10_show_link_control_flag(struct device *dev, ...@@ -382,7 +382,7 @@ static ssize_t efx_ef10_show_link_control_flag(struct device *dev,
? 1 : 0); ? 1 : 0);
} }
static ssize_t efx_ef10_show_primary_flag(struct device *dev, static ssize_t primary_flag_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
...@@ -519,9 +519,8 @@ static void efx_ef10_cleanup_vlans(struct efx_nic *efx) ...@@ -519,9 +519,8 @@ static void efx_ef10_cleanup_vlans(struct efx_nic *efx)
mutex_unlock(&nic_data->vlan_lock); mutex_unlock(&nic_data->vlan_lock);
} }
static DEVICE_ATTR(link_control_flag, 0444, efx_ef10_show_link_control_flag, static DEVICE_ATTR_RO(link_control_flag);
NULL); static DEVICE_ATTR_RO(primary_flag);
static DEVICE_ATTR(primary_flag, 0444, efx_ef10_show_primary_flag, NULL);
static int efx_ef10_probe(struct efx_nic *efx) static int efx_ef10_probe(struct efx_nic *efx)
{ {
......
...@@ -689,13 +689,13 @@ static struct notifier_block efx_netdev_notifier = { ...@@ -689,13 +689,13 @@ static struct notifier_block efx_netdev_notifier = {
.notifier_call = efx_netdev_event, .notifier_call = efx_netdev_event,
}; };
static ssize_t static ssize_t phy_type_show(struct device *dev,
show_phy_type(struct device *dev, struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct efx_nic *efx = dev_get_drvdata(dev); struct efx_nic *efx = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", efx->phy_type); return sprintf(buf, "%d\n", efx->phy_type);
} }
static DEVICE_ATTR(phy_type, 0444, show_phy_type, NULL); static DEVICE_ATTR_RO(phy_type);
static int efx_register_netdev(struct efx_nic *efx) static int efx_register_netdev(struct efx_nic *efx)
{ {
......
...@@ -1160,7 +1160,8 @@ void efx_fini_io(struct efx_nic *efx) ...@@ -1160,7 +1160,8 @@ void efx_fini_io(struct efx_nic *efx)
} }
#ifdef CONFIG_SFC_MCDI_LOGGING #ifdef CONFIG_SFC_MCDI_LOGGING
static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr, static ssize_t mcdi_logging_show(struct device *dev,
struct device_attribute *attr,
char *buf) char *buf)
{ {
struct efx_nic *efx = dev_get_drvdata(dev); struct efx_nic *efx = dev_get_drvdata(dev);
...@@ -1169,7 +1170,8 @@ static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr, ...@@ -1169,7 +1170,8 @@ static ssize_t show_mcdi_log(struct device *dev, struct device_attribute *attr,
return scnprintf(buf, PAGE_SIZE, "%d\n", mcdi->logging_enabled); return scnprintf(buf, PAGE_SIZE, "%d\n", mcdi->logging_enabled);
} }
static ssize_t set_mcdi_log(struct device *dev, struct device_attribute *attr, static ssize_t mcdi_logging_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct efx_nic *efx = dev_get_drvdata(dev); struct efx_nic *efx = dev_get_drvdata(dev);
...@@ -1180,7 +1182,7 @@ static ssize_t set_mcdi_log(struct device *dev, struct device_attribute *attr, ...@@ -1180,7 +1182,7 @@ static ssize_t set_mcdi_log(struct device *dev, struct device_attribute *attr,
return count; return count;
} }
static DEVICE_ATTR(mcdi_logging, 0644, show_mcdi_log, set_mcdi_log); static DEVICE_ATTR_RW(mcdi_logging);
void efx_init_mcdi_logging(struct efx_nic *efx) void efx_init_mcdi_logging(struct efx_nic *efx)
{ {
......
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