compat: backport ether_addr_equal
authorOzan Çağlayan <ozancag@gmail.com>
Wed, 16 May 2012 09:55:48 +0000 (12:55 +0300)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Wed, 16 May 2012 20:29:03 +0000 (13:29 -0700)
This backports:

    commit a599b0f54d233d0f63d6be9a2ff0049d24751669
    Author: Joe Perches <joe@perches.com>
    Date:   Tue May 8 18:56:45 2012 +0000

        etherdevice.h: Add ether_addr_equal

        Add a boolean function to check if 2 ethernet addresses
        are the same.

        This is to avoid any confusion about compare_ether_addr
        returning an unsigned, and not being able to use the
        compare_ether_addr function for sorting ala memcmp.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[root@ozzyfedora compat]# bin/ckmake
Trying kernel                      3.3.4-5.fc17.x86_64  [OK]

mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel                  3.4.0-030400rc1-generic [OK]
Trying kernel                  3.3.0-030300rc2-generic [OK]
Trying kernel                     3.2.2-030202-generic [OK]
Trying kernel                    3.1.10-030110-generic [OK]
Trying kernel                    3.0.18-030018-generic [OK]
Trying kernel                  2.6.39-02063904-generic [OK]
Trying kernel                  2.6.38-02063808-generic [OK]
Trying kernel                  2.6.37-02063706-generic [OK]
Trying kernel                  2.6.36-02063604-generic [OK]
Trying kernel                  2.6.35-02063512-generic [OK]
Trying kernel                  2.6.34-02063410-generic [OK]
Trying kernel                  2.6.33-02063305-generic [OK]
Trying kernel                  2.6.32-02063255-generic [OK]
Trying kernel                  2.6.31-02063113-generic [OK]
Trying kernel                  2.6.30-02063010-generic [OK]
Trying kernel                  2.6.29-02062906-generic [OK]
Trying kernel                  2.6.28-02062810-generic [OK]
Trying kernel                    2.6.27-020627-generic [OK]
Trying kernel                    2.6.26-020626-generic [OK]
Trying kernel                    2.6.25-020625-generic [OK]
Trying kernel                    2.6.24-020624-generic [OK]

Tested-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
include/linux/compat-3.5.h

index 554d347a972b55ef7cdf1a9f1a53b101b2999038..a83266be56ddeff0748feaec699d2828f35cc9d8 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/version.h>
 #include <linux/fs.h>
+#include <linux/etherdevice.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
 
@@ -12,6 +13,12 @@ extern int simple_open(struct inode *inode, struct file *file);
 #define tty_lock(__tty) tty_lock()
 #define tty_unlock(__tty) tty_unlock()
 
+/* Backport ether_addr_equal */
+static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+{
+    return !compare_ether_addr(addr1, addr2);
+}
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
 
 #endif /* LINUX_3_5_COMPAT_H */