patch-2.4.23 linux-2.4.23/drivers/net/pcmcia/xirc2ps_cs.c
Next file: linux-2.4.23/drivers/net/pcmcia/xircom_cb.c
Previous file: linux-2.4.23/drivers/net/pcmcia/wavelan_cs.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
2003-11-28 10:26:20.000000000 -0800
- Orig file:
linux-2.4.22/drivers/net/pcmcia/xirc2ps_cs.c
- Orig date:
2003-06-13 07:51:35.000000000 -0700
diff -urN linux-2.4.22/drivers/net/pcmcia/xirc2ps_cs.c linux-2.4.23/drivers/net/pcmcia/xirc2ps_cs.c
@@ -386,6 +386,7 @@
static int do_config(struct net_device *dev, struct ifmap *map);
static int do_open(struct net_device *dev);
static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
+static struct ethtool_ops netdev_ethtool_ops;
static void hardreset(struct net_device *dev);
static void do_reset(struct net_device *dev, int full);
static int init_mii(struct net_device *dev);
@@ -650,6 +651,7 @@
dev->set_config = &do_config;
dev->get_stats = &do_get_stats;
dev->do_ioctl = &do_ioctl;
+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
dev->set_multicast_list = &set_multicast_list;
ether_setup(dev);
dev->open = &do_open;
@@ -1722,26 +1724,16 @@
return 0;
}
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static void netdev_get_drvinfo(struct net_device *dev,
+ struct ethtool_drvinfo *info)
{
- u32 ethcmd;
-
- if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
- return -EFAULT;
-
- switch (ethcmd) {
- case ETHTOOL_GDRVINFO: {
- struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
- strncpy(info.driver, "xirc2ps_cs", sizeof(info.driver)-1);
- if (copy_to_user(useraddr, &info, sizeof(info)))
- return -EFAULT;
- return 0;
- }
- }
-
- return -EOPNOTSUPP;
+ strcpy(info->driver, "xirc2ps_cs");
}
+static struct ethtool_ops netdev_ethtool_ops = {
+ .get_drvinfo = netdev_get_drvinfo,
+};
+
static int
do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
@@ -1757,15 +1749,16 @@
return -EOPNOTSUPP;
switch(cmd) {
- case SIOCETHTOOL:
- return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
- case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
+ case SIOCGMIIPHY: /* Get the address of the PHY in use. */
+ case SIOCDEVPRIVATE:
data[0] = 0; /* we have only this address */
/* fall trough */
- case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
+ case SIOCGMIIREG: /* Read the specified MII register. */
+ case SIOCDEVPRIVATE+1:
data[3] = mii_rd(ioaddr, data[0] & 0x1f, data[1] & 0x1f);
break;
- case SIOCDEVPRIVATE+2: /* Write the specified MII register */
+ case SIOCSMIIREG: /* Write the specified MII register */
+ case SIOCDEVPRIVATE+2:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
mii_wr(ioaddr, data[0] & 0x1f, data[1] & 0x1f, data[2], 16);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)