mac802154: cleanup ieee802154_netdev_to_extended_addr
authorAlexander Aring <alex.aring@gmail.com>
Wed, 5 Nov 2014 19:51:24 +0000 (20:51 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 5 Nov 2014 20:53:05 +0000 (21:53 +0100)
This patch cleanups the ieee802154_be64_to_le64 to have a similar
function like ieee802154_le64_to_be64 only with switched source and
destionation types.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/mac802154.h
net/mac802154/iface.c

index cc188cb4f94d95eeace0a68d9e31104dd5348308..632f6566adb5894c8c164f4d0380d2167e490873 100644 (file)
@@ -224,12 +224,15 @@ struct ieee802154_ops {
 };
 
 /**
- * ieee802154_netdev_to_extended_addr - convert big endian 64 byte void pointer to __le64
- * @dev_addr: big endian address pointer like netdevice dev_addr attribute
+ * ieee802154_be64_to_le64 - copies and convert be64 to le64
+ * @le64_dst: le64 destination pointer
+ * @be64_src: be64 source pointer
  */
-static inline __le64 ieee802154_netdev_to_extended_addr(const void *dev_addr)
+static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
 {
-       return (__force __le64)swab64p(dev_addr);
+       __le64 tmp = (__force __le64)swab64p(be64_src);
+
+       memcpy(le64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN);
 }
 
 /**
index 764ce496fdc3ea1628f9518dd133d389e40a5f36..a1aa09b03d127ddf2c84fd0f890cc7582771b073 100644 (file)
@@ -117,7 +117,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
        if (netif_running(dev))
                return -EBUSY;
 
-       extended_addr = ieee802154_netdev_to_extended_addr(addr->sa_data);
+       ieee802154_be64_to_le64(&extended_addr, addr->sa_data);
        if (!ieee802154_is_valid_extended_addr(extended_addr))
                return -EINVAL;