diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2009-09-22 15:26:48 +0400 |
---|---|---|
committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2009-11-06 14:23:41 +0300 |
commit | a0b4a738e0e03f5e0d6ca366560f9a48e5adf83a (patch) | |
tree | 8063be3ae88a2bef6377cdf913b2432d9805c48b /net/ieee802154 | |
parent | 375bb0e04b618d0c425b0ea492d16cf71eb94905 (diff) | |
download | linux-3.10-a0b4a738e0e03f5e0d6ca366560f9a48e5adf83a.tar.gz linux-3.10-a0b4a738e0e03f5e0d6ca366560f9a48e5adf83a.tar.bz2 linux-3.10-a0b4a738e0e03f5e0d6ca366560f9a48e5adf83a.zip |
wpan-phy: allow specifying a per-page channel mask
IEEE 802.15.4-2006 defines channel pages that hold channels (max 32 pages,
27 channels per page). Allow the driver to specify supported channels
on pages, other than the first one.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'net/ieee802154')
-rw-r--r-- | net/ieee802154/wpan-class.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index 68ccde63155..0c51f85aa59 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c @@ -40,12 +40,30 @@ static ssize_t name ## _show(struct device *dev, \ MASTER_SHOW(current_channel, "%d"); MASTER_SHOW(current_page, "%d"); -MASTER_SHOW(channels_supported, "%#x"); MASTER_SHOW_COMPLEX(transmit_power, "%d +- %d dB", ((signed char) (phy->transmit_power << 2)) >> 2, (phy->transmit_power >> 6) ? (phy->transmit_power >> 6) * 3 : 1 ); MASTER_SHOW(cca_mode, "%d"); +static ssize_t channels_supported_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); + int ret; + int i, len = 0; + + mutex_lock(&phy->pib_lock); + for (i = 0; i < 32; i++) { + ret = snprintf(buf + len, PAGE_SIZE - len, + "%#09x\n", phy->channels_supported[i]); + if (ret < 0) + break; + len += ret; + } + mutex_unlock(&phy->pib_lock); + return len; +} + static struct device_attribute pmib_attrs[] = { __ATTR_RO(current_channel), __ATTR_RO(current_page), |