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:
parent
83b7b77af3
commit
669b258a79
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue