Skip to content

Commit

Permalink
mac802154: use put and get unaligned functions
Browse files Browse the repository at this point in the history
This patch removes the swap pointer and memmove functionality. Instead
we use the well known put/get unaligned access with specific byte order
handling.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Mar 10, 2016
1 parent 75c6aca commit f160892
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/net/mac802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#ifndef NET_MAC802154_H
#define NET_MAC802154_H

#include <asm/unaligned.h>
#include <net/af_ieee802154.h>
#include <linux/ieee802154.h>
#include <linux/skbuff.h>
#include <linux/unaligned/memmove.h>

#include <net/cfg802154.h>

Expand Down Expand Up @@ -254,7 +254,7 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
return cpu_to_le16(0);
}

return (__force __le16)__get_unaligned_memmove16(skb_mac_header(skb));
return get_unaligned_le16(skb_mac_header(skb));
}

/**
Expand All @@ -264,7 +264,7 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
*/
static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
{
__put_unaligned_memmove64(swab64p(be64_src), le64_dst);
put_unaligned_le64(get_unaligned_be64(be64_src), le64_dst);
}

/**
Expand All @@ -274,7 +274,7 @@ static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
*/
static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
{
__put_unaligned_memmove64(swab64p(le64_src), be64_dst);
put_unaligned_be64(get_unaligned_le64(le64_src), be64_dst);
}

/**
Expand All @@ -284,7 +284,7 @@ static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
*/
static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src)
{
__put_unaligned_memmove16(swab16p(le16_src), be16_dst);
put_unaligned_be16(get_unaligned_le16(le16_src), be16_dst);
}

/**
Expand Down

0 comments on commit f160892

Please sign in to comment.