Use CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to check if this function can be optimized by using the generic ether_addr_equal.
Remove the unnecessary ?: after the unoptimized memcmp.
Signed-off-by: Joe Perches joe@perches.com --- net/batman-adv/main.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index f94f287b..74a7a3f 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -266,7 +266,11 @@ static inline void batadv_dbg(int type __always_unused, */ static inline int batadv_compare_eth(const void *data1, const void *data2) { - return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) + return ether_addr_equal(data1, data2); +#else + return memcmp(data1, data2, ETH_ALEN) == 0; +#endif }
/**