Use macro __ATTR to simplify the code. Note that __ATTR can't be used in MDIO_BUS_STATS_ADDR_ATTR_DECL because the included stringification would conflict with how argument file is passed. Signed-off-by: Heiner Kallweit --- drivers/net/phy/mdio_bus.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 4fe9859369b..0c0cf7a7296 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -191,24 +191,17 @@ static ssize_t mdio_bus_device_stat_field_show(struct device *dev, return sysfs_emit(buf, "%llu\n", val); } -#define MDIO_BUS_STATS_ATTR_DECL(field, file) \ +#define MDIO_BUS_STATS_ATTR(field) \ static struct mdio_bus_stat_attr dev_attr_mdio_bus_##field = { \ - .attr = { .attr = { .name = file, .mode = 0444 }, \ - .show = mdio_bus_stat_field_show, \ - }, \ + .attr = __ATTR(field, 0444, mdio_bus_stat_field_show, NULL), \ .address = -1, \ .field_offset = offsetof(struct mdio_bus_stats, field), \ }; \ static struct mdio_bus_stat_attr dev_attr_mdio_bus_device_##field = { \ - .attr = { .attr = { .name = file, .mode = 0444 }, \ - .show = mdio_bus_device_stat_field_show, \ - }, \ + .attr = __ATTR(field, 0444, mdio_bus_device_stat_field_show, NULL), \ .address = -1, \ .field_offset = offsetof(struct mdio_bus_stats, field), \ -}; - -#define MDIO_BUS_STATS_ATTR(field) \ - MDIO_BUS_STATS_ATTR_DECL(field, __stringify(field)) +} MDIO_BUS_STATS_ATTR(transfers); MDIO_BUS_STATS_ATTR(errors); -- 2.53.0