Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd8ceabcd10d47f6f28ecfaf2eac7beffca11b3c
Commit:     dd8ceabcd10d47f6f28ecfaf2eac7beffca11b3c
Parent:     4b1e255384570138c2a823904796d46f628e8350
Author:     Johannes Berg <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 26 20:45:47 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Apr 26 20:45:47 2007 -0700

    [WEXT]: Cleanup early ioctl call path.
    
    This patch makes the code in wireless_process_ioctl somewhat more
    readable.
    
    Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/wireless/wext.c |   73 ++++++++++++++++++--------------------------------
 1 files changed, 26 insertions(+), 47 deletions(-)

diff --git a/net/wireless/wext.c b/net/wireless/wext.c
index dabc645..adcb083 100644
--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -1035,53 +1035,31 @@ static int wireless_process_ioctl(struct ifreq *ifr, 
unsigned int cmd)
        /* A bunch of special cases, then the generic case...
         * Note that 'cmd' is already filtered in dev_ioctl() with
         * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */
-       switch (cmd) {
-       case SIOCGIWSTATS:
-               /* Get Wireless Stats */
-               return ioctl_standard_call(dev,
-                                          ifr,
-                                          cmd,
+       if (cmd == SIOCGIWSTATS)
+               return ioctl_standard_call(dev, ifr, cmd,
                                           &iw_handler_get_iwstats);
 
-       case SIOCGIWPRIV:
-               /* Check if we have some wireless handlers defined */
-               if (dev->wireless_handlers != NULL) {
-                       /* We export to user space the definition of
-                        * the private handler ourselves */
-                       return ioctl_standard_call(dev,
-                                                  ifr,
-                                                  cmd,
-                                                  &iw_handler_get_private);
-               }
-               // ## Fall-through for old API ##
-       default:
-               /* Generic IOCTL */
-               /* Basic check */
-               if (!netif_device_present(dev))
-                       return -ENODEV;
-               /* New driver API : try to find the handler */
-               handler = get_handler(dev, cmd);
-               if (handler != NULL) {
-                       /* Standard and private are not the same */
-                       if (cmd < SIOCIWFIRSTPRIV)
-                               return ioctl_standard_call(dev,
-                                                          ifr,
-                                                          cmd,
-                                                          handler);
-                       else
-                               return ioctl_private_call(dev,
-                                                         ifr,
-                                                         cmd,
-                                                         handler);
-               }
-               /* Old driver API : call driver ioctl handler */
-               if (dev->do_ioctl) {
-                       return dev->do_ioctl(dev, ifr, cmd);
-               }
-               return -EOPNOTSUPP;
+       if (cmd == SIOCGIWPRIV && dev->wireless_handlers)
+               return ioctl_standard_call(dev, ifr, cmd,
+                                          &iw_handler_get_private);
+
+       /* Basic check */
+       if (!netif_device_present(dev))
+               return -ENODEV;
+
+       /* New driver API : try to find the handler */
+       handler = get_handler(dev, cmd);
+       if (handler) {
+               /* Standard and private are not the same */
+               if (cmd < SIOCIWFIRSTPRIV)
+                       return ioctl_standard_call(dev, ifr, cmd, handler);
+               else
+                       return ioctl_private_call(dev, ifr, cmd, handler);
        }
-       /* Not reached */
-       return -EINVAL;
+       /* Old driver API : call driver ioctl handler */
+       if (dev->do_ioctl)
+               return dev->do_ioctl(dev, ifr, cmd);
+       return -EOPNOTSUPP;
 }
 
 /* entry point from dev ioctl */
@@ -1093,9 +1071,10 @@ int wext_handle_ioctl(struct ifreq *ifr, unsigned int 
cmd,
        /* If command is `set a parameter', or
         * `get the encoding parameters', check if
         * the user has the right to do it */
-       if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || cmd == SIOCGIWENCODEEXT)
-               if (!capable(CAP_NET_ADMIN))
-                       return -EPERM;
+       if ((IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || cmd == SIOCGIWENCODEEXT)
+           && !capable(CAP_NET_ADMIN))
+               return -EPERM;
+
        dev_load(ifr->ifr_name);
        rtnl_lock();
        ret = wireless_process_ioctl(ifr, cmd);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to