OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --- a/net/wireless/sysfs.c |
2 | +++ b/net/wireless/sysfs.c |
||
3 | @@ -24,18 +24,35 @@ static inline struct cfg80211_registered |
||
4 | return container_of(dev, struct cfg80211_registered_device, wiphy.dev); |
||
5 | } |
||
6 | |||
7 | -#define SHOW_FMT(name, fmt, member) \ |
||
8 | +#define SHOW_FMT(name, fmt, member, mode) \ |
||
9 | static ssize_t name ## _show(struct device *dev, \ |
||
10 | struct device_attribute *attr, \ |
||
11 | char *buf) \ |
||
12 | { \ |
||
13 | return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \ |
||
14 | } \ |
||
15 | -static DEVICE_ATTR_RO(name) |
||
16 | +static DEVICE_ATTR_##mode(name) |
||
17 | |||
18 | -SHOW_FMT(index, "%d", wiphy_idx); |
||
19 | -SHOW_FMT(macaddress, "%pM", wiphy.perm_addr); |
||
20 | -SHOW_FMT(address_mask, "%pM", wiphy.addr_mask); |
||
21 | +static ssize_t macaddress_store(struct device *dev, |
||
22 | + struct device_attribute *attr, |
||
23 | + const char *buf, size_t len) |
||
24 | +{ |
||
25 | + u8 mac[ETH_ALEN]; |
||
26 | + |
||
27 | + if (!mac_pton(buf, mac)) |
||
28 | + return -EINVAL; |
||
29 | + |
||
30 | + if (buf[3 * ETH_ALEN - 1] && buf[3 * ETH_ALEN - 1] != '\n') |
||
31 | + return -EINVAL; |
||
32 | + |
||
33 | + memcpy(dev_to_rdev(dev)->wiphy.perm_addr, mac, ETH_ALEN); |
||
34 | + |
||
35 | + return strnlen(buf, len); |
||
36 | +} |
||
37 | + |
||
38 | +SHOW_FMT(index, "%d", wiphy_idx, RO); |
||
39 | +SHOW_FMT(macaddress, "%pM", wiphy.perm_addr, RW); |
||
40 | +SHOW_FMT(address_mask, "%pM", wiphy.addr_mask, RO); |
||
41 | |||
42 | static ssize_t name_show(struct device *dev, |
||
43 | struct device_attribute *attr, |