compat: add ndo_do_ioctl()
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Wed, 11 Apr 2012 01:45:25 +0000 (18:45 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Wed, 11 Apr 2012 01:59:05 +0000 (18:59 -0700)
commit78b895ca501b9a70bccccc505b9b39e080de1503
treefea441bd81a4a022307d9599df566d913e0d9e32
parentebab6cd63a4026fdd83e47cce7c6b34e97ec1b2a
compat: add ndo_do_ioctl()

This helps reduce the delta on backporting calls of the
netdev's ioctl callback. Instead of ifdef'ing on where
the ioctl callback lies in different kernels we take
care of that for all kernels.

This lets us for example change this backport:

@@ -925,8 +954,13 @@ static int wireless_process_ioctl(struct
return private(dev, iwr, cmd, info, handler);
}
/* Old driver API : call driver ioctl handler */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
if (dev->netdev_ops->ndo_do_ioctl)
return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
+#else
+       if (dev->do_ioctl)
+               return dev->do_ioctl(dev, ifr, cmd);
+#endif
return -EOPNOTSUPP;
 }

To this:

--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -925,9 +925,7 @@ static int wireless_process_ioctl(struct
return private(dev, iwr, cmd, info, handler);
}
/* Old driver API : call driver ioctl handler */
-       if (dev->netdev_ops->ndo_do_ioctl)
-               return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
-       return -EOPNOTSUPP;
+       return ndo_do_ioctl(dev, ifr, cmd);
 }

 /* If command is `set a parameter', or `get the encoding parameters',

This shows more deletions than additions. This is what we want.

If we add ndo_do_ioctl() upstream then this would require 0 delta!

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]

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
include/linux/compat-2.6.29.h