diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-11-09 02:36:51 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-09 13:50:28 -0500 |
commit | a6fd693f6b862cd73fc90849353492406cfba5f6 (patch) | |
tree | b71a928fb567211d8d2c3f0f2cdee3dbc5cb929c /net/ieee802154 | |
parent | fcf39e6e88e9492f6688ec8ba4e1be622b904232 (diff) |
ieee802154: sysfs add wpan_phy index and name
This patch adds new sysfs entries for wpan_phy index and name. This
needed for the new 802.15.4 userspace tool.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r-- | net/ieee802154/sysfs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/ieee802154/sysfs.c b/net/ieee802154/sysfs.c index 88199980dae9..1613b9c65dfa 100644 --- a/net/ieee802154/sysfs.c +++ b/net/ieee802154/sysfs.c | |||
@@ -27,6 +27,27 @@ dev_to_rdev(struct device *dev) | |||
27 | wpan_phy.dev); | 27 | wpan_phy.dev); |
28 | } | 28 | } |
29 | 29 | ||
30 | #define SHOW_FMT(name, fmt, member) \ | ||
31 | static ssize_t name ## _show(struct device *dev, \ | ||
32 | struct device_attribute *attr, \ | ||
33 | char *buf) \ | ||
34 | { \ | ||
35 | return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \ | ||
36 | } \ | ||
37 | static DEVICE_ATTR_RO(name) | ||
38 | |||
39 | SHOW_FMT(index, "%d", wpan_phy_idx); | ||
40 | |||
41 | static ssize_t name_show(struct device *dev, | ||
42 | struct device_attribute *attr, | ||
43 | char *buf) | ||
44 | { | ||
45 | struct wpan_phy *wpan_phy = &dev_to_rdev(dev)->wpan_phy; | ||
46 | |||
47 | return sprintf(buf, "%s\n", dev_name(&wpan_phy->dev)); | ||
48 | } | ||
49 | static DEVICE_ATTR_RO(name); | ||
50 | |||
30 | #define MASTER_SHOW_COMPLEX(name, format_string, args...) \ | 51 | #define MASTER_SHOW_COMPLEX(name, format_string, args...) \ |
31 | static ssize_t name ## _show(struct device *dev, \ | 52 | static ssize_t name ## _show(struct device *dev, \ |
32 | struct device_attribute *attr, char *buf) \ | 53 | struct device_attribute *attr, char *buf) \ |
@@ -78,6 +99,9 @@ static void wpan_phy_release(struct device *dev) | |||
78 | } | 99 | } |
79 | 100 | ||
80 | static struct attribute *pmib_attrs[] = { | 101 | static struct attribute *pmib_attrs[] = { |
102 | &dev_attr_index.attr, | ||
103 | &dev_attr_name.attr, | ||
104 | /* below will be removed soon */ | ||
81 | &dev_attr_current_channel.attr, | 105 | &dev_attr_current_channel.attr, |
82 | &dev_attr_current_page.attr, | 106 | &dev_attr_current_page.attr, |
83 | &dev_attr_channels_supported.attr, | 107 | &dev_attr_channels_supported.attr, |