]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/stmmac/stmmac_ethtool.c
stmmac: tidy-up stmmac_priv structure
[net-next-2.6.git] / drivers / net / stmmac / stmmac_ethtool.c
index b32c16ae55c6717b915e4ca73795c914d889655f..f2695fd180ca08531cb857c51e91ff7ca0223237 100644 (file)
@@ -89,12 +89,12 @@ static const struct  stmmac_stats stmmac_gstrings_stats[] = {
 };
 #define STMMAC_STATS_LEN ARRAY_SIZE(stmmac_gstrings_stats)
 
-void stmmac_ethtool_getdrvinfo(struct net_device *dev,
-                              struct ethtool_drvinfo *info)
+static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
+                                     struct ethtool_drvinfo *info)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
 
-       if (!priv->is_gmac)
+       if (!priv->plat->has_gmac)
                strcpy(info->driver, MAC100_ETHTOOL_NAME);
        else
                strcpy(info->driver, GMAC_ETHTOOL_NAME);
@@ -104,7 +104,8 @@ void stmmac_ethtool_getdrvinfo(struct net_device *dev,
        info->n_stats = STMMAC_STATS_LEN;
 }
 
-int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int stmmac_ethtool_getsettings(struct net_device *dev,
+                                     struct ethtool_cmd *cmd)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
        struct phy_device *phy = priv->phydev;
@@ -126,7 +127,8 @@ int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
        return rc;
 }
 
-int stmmac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int stmmac_ethtool_setsettings(struct net_device *dev,
+                                     struct ethtool_cmd *cmd)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
        struct phy_device *phy = priv->phydev;
@@ -139,32 +141,32 @@ int stmmac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
        return rc;
 }
 
-u32 stmmac_ethtool_getmsglevel(struct net_device *dev)
+static u32 stmmac_ethtool_getmsglevel(struct net_device *dev)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
        return priv->msg_enable;
 }
 
-void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level)
+static void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
        priv->msg_enable = level;
 
 }
 
-int stmmac_check_if_running(struct net_device *dev)
+static int stmmac_check_if_running(struct net_device *dev)
 {
        if (!netif_running(dev))
                return -EBUSY;
        return 0;
 }
 
-int stmmac_ethtool_get_regs_len(struct net_device *dev)
+static int stmmac_ethtool_get_regs_len(struct net_device *dev)
 {
        return REG_SPACE_SIZE;
 }
 
-void stmmac_ethtool_gregs(struct net_device *dev,
+static void stmmac_ethtool_gregs(struct net_device *dev,
                          struct ethtool_regs *regs, void *space)
 {
        int i;
@@ -174,7 +176,7 @@ void stmmac_ethtool_gregs(struct net_device *dev,
 
        memset(reg_space, 0x0, REG_SPACE_SIZE);
 
-       if (!priv->is_gmac) {
+       if (!priv->plat->has_gmac) {
                /* MAC registers */
                for (i = 0; i < 12; i++)
                        reg_space[i] = readl(priv->ioaddr + (i * 4));
@@ -195,7 +197,7 @@ void stmmac_ethtool_gregs(struct net_device *dev,
        }
 }
 
-int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
+static int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
 {
        if (data)
                netdev->features |= NETIF_F_HW_CSUM;
@@ -205,7 +207,7 @@ int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data)
        return 0;
 }
 
-u32 stmmac_ethtool_get_rx_csum(struct net_device *dev)
+static u32 stmmac_ethtool_get_rx_csum(struct net_device *dev)
 {
        struct stmmac_priv *priv = netdev_priv(dev);
 
@@ -322,7 +324,7 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
        struct stmmac_priv *priv = netdev_priv(dev);
 
        spin_lock_irq(&priv->lock);
-       if (priv->wolenabled == PMT_SUPPORTED) {
+       if (device_can_wakeup(priv->device)) {
                wol->supported = WAKE_MAGIC;
                wol->wolopts = priv->wolopts;
        }
@@ -334,16 +336,20 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
        struct stmmac_priv *priv = netdev_priv(dev);
        u32 support = WAKE_MAGIC;
 
-       if (priv->wolenabled == PMT_NOT_SUPPORTED)
+       if (!device_can_wakeup(priv->device))
                return -EINVAL;
 
        if (wol->wolopts & ~support)
                return -EINVAL;
 
-       if (wol->wolopts == 0)
-               device_set_wakeup_enable(priv->device, 0);
-       else
+       if (wol->wolopts) {
+               pr_info("stmmac: wakeup enable\n");
                device_set_wakeup_enable(priv->device, 1);
+               enable_irq_wake(dev->irq);
+       } else {
+               device_set_wakeup_enable(priv->device, 0);
+               disable_irq_wake(dev->irq);
+       }
 
        spin_lock_irq(&priv->lock);
        priv->wolopts = wol->wolopts;
@@ -374,10 +380,8 @@ static struct ethtool_ops stmmac_ethtool_ops = {
        .get_wol = stmmac_get_wol,
        .set_wol = stmmac_set_wol,
        .get_sset_count = stmmac_get_sset_count,
-#ifdef NETIF_F_TSO
        .get_tso = ethtool_op_get_tso,
        .set_tso = ethtool_op_set_tso,
-#endif
 };
 
 void stmmac_set_ethtool_ops(struct net_device *netdev)