bonding: helper macro __ATTR_RO to make code more clear

Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Lianjie Zhang 2022-03-06 16:28:08 +08:00 committed by David S. Miller
parent 83b7b77af3
commit 669b258a79
1 changed files with 1 additions and 7 deletions

View 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)
{