Skip to content

Commit

Permalink
sfc: falcon: use DEVICE_ATTR_*() macro
Browse files Browse the repository at this point in the history
Use DEVICE_ATTR_*() 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 24, 2021
1 parent 3880fc3 commit 4934fb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/sfc/falcon/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2254,12 +2254,12 @@ static struct notifier_block ef4_netdev_notifier = {
};

static ssize_t
show_phy_type(struct device *dev, struct device_attribute *attr, char *buf)
phy_type_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct ef4_nic *efx = dev_get_drvdata(dev);
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 ef4_register_netdev(struct ef4_nic *efx)
{
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/sfc/falcon/falcon_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,16 @@ static int sfe4001_poweron(struct ef4_nic *efx)
return rc;
}

static ssize_t show_phy_flash_cfg(struct device *dev,
static ssize_t phy_flash_cfg_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ef4_nic *efx = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", !!(efx->phy_mode & PHY_MODE_SPECIAL));
}

static ssize_t set_phy_flash_cfg(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
static ssize_t phy_flash_cfg_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ef4_nic *efx = dev_get_drvdata(dev);
enum ef4_phy_mode old_mode, new_mode;
Expand Down Expand Up @@ -396,7 +396,7 @@ static ssize_t set_phy_flash_cfg(struct device *dev,
return err ? err : count;
}

static DEVICE_ATTR(phy_flash_cfg, 0644, show_phy_flash_cfg, set_phy_flash_cfg);
static DEVICE_ATTR_RW(phy_flash_cfg);

static void sfe4001_fini(struct ef4_nic *efx)
{
Expand Down

0 comments on commit 4934fb7

Please sign in to comment.