diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-11-17 08:20:55 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-17 09:49:17 +0100 |
commit | ee7b9053bd69ff43cbc87a9bb987f4d92dc2c29f (patch) | |
tree | eef6377b4bc5f6c76fffa547ee4d0872c58e8f3a /net/mac802154 | |
parent | cb41c8dd01d74d091618f72e28f0282f064a9f0a (diff) | |
download | linux-ee7b9053bd69ff43cbc87a9bb987f4d92dc2c29f.tar.gz linux-ee7b9053bd69ff43cbc87a9bb987f4d92dc2c29f.tar.bz2 linux-ee7b9053bd69ff43cbc87a9bb987f4d92dc2c29f.zip |
ieee802154: fix byteorder for short address and panid
This patch changes the byteorder handling for short and panid handling.
We now except to get little endian in nl802154 for these attributes.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r-- | net/mac802154/cfg.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c index 7def2625eaca..c035708ada16 100644 --- a/net/mac802154/cfg.c +++ b/net/mac802154/cfg.c @@ -88,7 +88,7 @@ ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) static int ieee802154_set_pan_id(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, - u16 pan_id) + __le16 pan_id) { ASSERT_RTNL(); @@ -99,10 +99,10 @@ ieee802154_set_pan_id(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, * * This could useful to simple deassociate an device. */ - if (pan_id == IEEE802154_PAN_ID_BROADCAST) + if (pan_id == cpu_to_le16(IEEE802154_PAN_ID_BROADCAST)) return -EINVAL; - wpan_dev->pan_id = cpu_to_le16(pan_id); + wpan_dev->pan_id = pan_id; return 0; } @@ -125,7 +125,7 @@ ieee802154_set_backoff_exponent(struct wpan_phy *wpan_phy, static int ieee802154_set_short_addr(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, - u16 short_addr) + __le16 short_addr) { ASSERT_RTNL(); @@ -140,11 +140,11 @@ ieee802154_set_short_addr(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, * I think we should allow to set these settings but * don't allow to allow socket communication with it. */ - if (short_addr == IEEE802154_ADDR_SHORT_UNSPEC || - short_addr == IEEE802154_ADDR_SHORT_BROADCAST) + if (short_addr == cpu_to_le16(IEEE802154_ADDR_SHORT_UNSPEC) || + short_addr == cpu_to_le16(IEEE802154_ADDR_SHORT_BROADCAST)) return -EINVAL; - wpan_dev->short_addr = cpu_to_le16(short_addr); + wpan_dev->short_addr = short_addr; return 0; } |