bonding: helper macro __ATTR_RO to make code more clear
authorLianjie Zhang <zhanglianjie@uniontech.com>
Sun, 6 Mar 2022 08:28:08 +0000 (16:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 6 Mar 2022 12:10:16 +0000 (12:10 +0000)
Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_sysfs_slave.c

index 6a6cdd0..69b0a37 100644 (file)
@@ -15,14 +15,8 @@ struct slave_attribute {
        ssize_t (*show)(struct slave *, char *);
 };
 
-#define SLAVE_ATTR(_name, _mode, _show)                                \
-const struct slave_attribute slave_attr_##_name = {            \
-       .attr = {.name = __stringify(_name),                    \
-                .mode = _mode },                               \
-       .show   = _show,                                        \
-};
 #define SLAVE_ATTR_RO(_name)                                   \
-       SLAVE_ATTR(_name, 0444, _name##_show)
+const struct slave_attribute slave_attr_##_name = __ATTR_RO(_name)
 
 static ssize_t state_show(struct slave *slave, char *buf)
 {