Module: xenomai-3
Branch: wip/rtnet-fixes
Commit: c0489ddaafb91dff9ad835c20fb4f2a5ff87f27f
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c0489ddaafb91dff9ad835c20fb4f2a5ff87f27f

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jan 23 12:03:51 2018 +0100

net/socket: align rtdev do_ioctl handler on the regular ndo_do_ioctl

Align on the signature of the regular ndo_do_ioctl() handler for
interface-directed ioctl requests, since an ifr block must have been
provided by the caller to determine the device to hand over the
request to anyway.

---

 kernel/drivers/net/drivers/igb/igb_main.c |    7 +++----
 kernel/drivers/net/stack/include/rtdev.h  |    2 +-
 kernel/drivers/net/stack/socket.c         |    4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/kernel/drivers/net/drivers/igb/igb_main.c 
b/kernel/drivers/net/drivers/igb/igb_main.c
index fe0132b..be98d78 100644
--- a/kernel/drivers/net/drivers/igb/igb_main.c
+++ b/kernel/drivers/net/drivers/igb/igb_main.c
@@ -216,7 +216,7 @@ static int igb_msix_ring(rtdm_irq_t *irq_handle);
 static void igb_poll(struct igb_q_vector *);
 static bool igb_clean_tx_irq(struct igb_q_vector *);
 static bool igb_clean_rx_irq(struct igb_q_vector *, int);
-static int igb_ioctl(struct rtnet_device *, unsigned cmd, void *);
+static int igb_ioctl(struct rtnet_device *, struct ifreq *ifr, int cmd);
 static void igb_reset_task(struct work_struct *);
 static void igb_vlan_mode(struct rtnet_device *netdev,
                          netdev_features_t features);
@@ -5063,15 +5063,14 @@ static int igb_mii_ioctl(struct rtnet_device *netdev, 
struct ifreq *ifr, int cmd
  * @ifreq:
  * @cmd:
  **/
-static int igb_ioctl(struct rtnet_device *netdev, unsigned cmd, void *rq)
+static int igb_ioctl(struct rtnet_device *netdev, struct ifreq *ifr, int cmd)
 {
-       struct ifreq *ifr = rq;
-
        switch (cmd) {
        case SIOCGMIIPHY:
        case SIOCGMIIREG:
        case SIOCSMIIREG:
                return igb_mii_ioctl(netdev, ifr, cmd);
+
        default:
                return -EOPNOTSUPP;
        }
diff --git a/kernel/drivers/net/stack/include/rtdev.h 
b/kernel/drivers/net/stack/include/rtdev.h
index c1c0b4e..a3ac7dd 100644
--- a/kernel/drivers/net/stack/include/rtdev.h
+++ b/kernel/drivers/net/stack/include/rtdev.h
@@ -152,7 +152,7 @@ struct rtnet_device {
                                   unsigned int priority);
 
     int                 (*do_ioctl)(struct rtnet_device *rtdev,
-                                   unsigned int request, void * cmd);
+                                   struct ifreq *ifr, int cmd);
     struct net_device_stats *(*get_stats)(struct rtnet_device *rtdev);
 
     /* DMA pre-mapping hooks */
diff --git a/kernel/drivers/net/stack/socket.c 
b/kernel/drivers/net/stack/socket.c
index 1eb1856..c139d95 100644
--- a/kernel/drivers/net/stack/socket.c
+++ b/kernel/drivers/net/stack/socket.c
@@ -343,12 +343,12 @@ int rt_socket_if_ioctl(struct rtdm_fd *fd, int request, 
void __user *arg)
                if (rtdev->do_ioctl != NULL) {
                        if (rtdm_in_rt_context())
                                return -ENOSYS;
-                       ret = rtdev->do_ioctl(rtdev, request, arg);
+                       ret = rtdev->do_ioctl(rtdev, ifr, request);
                } else
                        ret = -EOPNOTSUPP;
            break;
 
-       default:
+        default:
            ret = -EOPNOTSUPP;
            break;
     }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to