]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/smc91x.c
hostap: fix section mismatch warning
[linux-2.6-omap-h63xx.git] / drivers / net / smc91x.c
index 49f4b7712ebfe8efd4c78ec2f375ae874290f2f4..7da7589d45ddfed4a3bb898bbc381898a8485a83 100644 (file)
@@ -173,56 +173,6 @@ MODULE_LICENSE("GPL");
  */
 #define MII_DELAY              1
 
-/* store this information for the driver.. */
-struct smc_local {
-       /*
-        * If I have to wait until memory is available to send a
-        * packet, I will store the skbuff here, until I get the
-        * desired memory.  Then, I'll send it out and free it.
-        */
-       struct sk_buff *pending_tx_skb;
-       struct tasklet_struct tx_task;
-
-       /*
-        * these are things that the kernel wants me to keep, so users
-        * can find out semi-useless statistics of how well the card is
-        * performing
-        */
-       struct net_device_stats stats;
-
-       /* version/revision of the SMC91x chip */
-       int     version;
-
-       /* Contains the current active transmission mode */
-       int     tcr_cur_mode;
-
-       /* Contains the current active receive mode */
-       int     rcr_cur_mode;
-
-       /* Contains the current active receive/phy mode */
-       int     rpc_cur_mode;
-       int     ctl_rfduplx;
-       int     ctl_rspeed;
-
-       u32     msg_enable;
-       u32     phy_type;
-       struct mii_if_info mii;
-
-       /* work queue */
-       struct work_struct phy_configure;
-       struct net_device *dev;
-       int     work_pending;
-
-       spinlock_t lock;
-
-#ifdef SMC_USE_PXA_DMA
-       /* DMA needs the physical address of the chip */
-       u_long physaddr;
-#endif
-       void __iomem *base;
-       void __iomem *datacs;
-};
-
 #if SMC_DEBUG > 0
 #define DBG(n, args...)                                        \
        do {                                            \
@@ -332,8 +282,8 @@ static void smc_reset(struct net_device *dev)
        /* free any pending tx skb */
        if (pending_skb) {
                dev_kfree_skb(pending_skb);
-               lp->stats.tx_errors++;
-               lp->stats.tx_aborted_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_aborted_errors++;
        }
 
        /*
@@ -512,13 +462,13 @@ static inline void  smc_rcv(struct net_device *dev)
                }
                SMC_WAIT_MMU_BUSY();
                SMC_SET_MMU_CMD(MC_RELEASE);
-               lp->stats.rx_errors++;
+               dev->stats.rx_errors++;
                if (status & RS_ALGNERR)
-                       lp->stats.rx_frame_errors++;
+                       dev->stats.rx_frame_errors++;
                if (status & (RS_TOOSHORT | RS_TOOLONG))
-                       lp->stats.rx_length_errors++;
+                       dev->stats.rx_length_errors++;
                if (status & RS_BADCRC)
-                       lp->stats.rx_crc_errors++;
+                       dev->stats.rx_crc_errors++;
        } else {
                struct sk_buff *skb;
                unsigned char *data;
@@ -526,7 +476,7 @@ static inline void  smc_rcv(struct net_device *dev)
 
                /* set multicast stats */
                if (status & RS_MULTICAST)
-                       lp->stats.multicast++;
+                       dev->stats.multicast++;
 
                /*
                 * Actual payload is packet_len - 6 (or 5 if odd byte).
@@ -542,7 +492,7 @@ static inline void  smc_rcv(struct net_device *dev)
                                dev->name);
                        SMC_WAIT_MMU_BUSY();
                        SMC_SET_MMU_CMD(MC_RELEASE);
-                       lp->stats.rx_dropped++;
+                       dev->stats.rx_dropped++;
                        return;
                }
 
@@ -568,11 +518,10 @@ static inline void  smc_rcv(struct net_device *dev)
                PRINT_PKT(data, packet_len - 4);
 
                dev->last_rx = jiffies;
-               skb->dev = dev;
                skb->protocol = eth_type_trans(skb, dev);
                netif_rx(skb);
-               lp->stats.rx_packets++;
-               lp->stats.rx_bytes += data_len;
+               dev->stats.rx_packets++;
+               dev->stats.rx_bytes += data_len;
        }
 }
 
@@ -645,8 +594,8 @@ static void smc_hardware_send_pkt(unsigned long data)
        packet_no = SMC_GET_AR();
        if (unlikely(packet_no & AR_FAILED)) {
                printk("%s: Memory allocation failed.\n", dev->name);
-               lp->stats.tx_errors++;
-               lp->stats.tx_fifo_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_fifo_errors++;
                smc_special_unlock(&lp->lock);
                goto done;
        }
@@ -689,8 +638,8 @@ static void smc_hardware_send_pkt(unsigned long data)
        smc_special_unlock(&lp->lock);
 
        dev->trans_start = jiffies;
-       lp->stats.tx_packets++;
-       lp->stats.tx_bytes += len;
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes += len;
 
        SMC_ENABLE_INT(IM_TX_INT | IM_TX_EMPTY_INT);
 
@@ -730,8 +679,8 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        numPages = ((skb->len & ~1) + (6 - 1)) >> 8;
        if (unlikely(numPages > 7)) {
                printk("%s: Far too big packet error.\n", dev->name);
-               lp->stats.tx_errors++;
-               lp->stats.tx_dropped++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_dropped++;
                dev_kfree_skb(skb);
                return 0;
        }
@@ -804,17 +753,17 @@ static void smc_tx(struct net_device *dev)
                dev->name, tx_status, packet_no);
 
        if (!(tx_status & ES_TX_SUC))
-               lp->stats.tx_errors++;
+               dev->stats.tx_errors++;
 
        if (tx_status & ES_LOSTCARR)
-               lp->stats.tx_carrier_errors++;
+               dev->stats.tx_carrier_errors++;
 
        if (tx_status & (ES_LATCOL | ES_16COL)) {
                PRINTK("%s: %s occurred on last xmit\n", dev->name,
                       (tx_status & ES_LATCOL) ?
                        "late collision" : "too many collisions");
-               lp->stats.tx_window_errors++;
-               if (!(lp->stats.tx_window_errors & 63) && net_ratelimit()) {
+               dev->stats.tx_window_errors++;
+               if (!(dev->stats.tx_window_errors & 63) && net_ratelimit()) {
                        printk(KERN_INFO "%s: unexpectedly large number of "
                               "bad collisions. Please check duplex "
                               "setting.\n", dev->name);
@@ -1348,19 +1297,19 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
                        SMC_SELECT_BANK(2);
 
                        /* single collisions */
-                       lp->stats.collisions += card_stats & 0xF;
+                       dev->stats.collisions += card_stats & 0xF;
                        card_stats >>= 4;
 
                        /* multiple collisions */
-                       lp->stats.collisions += card_stats & 0xF;
+                       dev->stats.collisions += card_stats & 0xF;
                } else if (status & IM_RX_OVRN_INT) {
                        DBG(1, "%s: RX overrun (EPH_ST 0x%04x)\n", dev->name,
                               ({ int eph_st; SMC_SELECT_BANK(0);
                                  eph_st = SMC_GET_EPH_STATUS();
                                  SMC_SELECT_BANK(2); eph_st; }) );
                        SMC_ACK_INT(IM_RX_OVRN_INT);
-                       lp->stats.rx_errors++;
-                       lp->stats.rx_fifo_errors++;
+                       dev->stats.rx_errors++;
+                       dev->stats.rx_fifo_errors++;
                } else if (status & IM_EPH_INT) {
                        smc_eph_interrupt(dev);
                } else if (status & IM_MDINT) {
@@ -1628,19 +1577,6 @@ static int smc_close(struct net_device *dev)
        return 0;
 }
 
-/*
- * Get the current statistics.
- * This may be called with the card open or closed.
- */
-static struct net_device_stats *smc_query_statistics(struct net_device *dev)
-{
-       struct smc_local *lp = netdev_priv(dev);
-
-       DBG(2, "%s: %s\n", dev->name, __FUNCTION__);
-
-       return &lp->stats;
-}
-
 /*
  * Ethtool support
  */
@@ -1843,9 +1779,10 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr)
 {
        struct smc_local *lp = netdev_priv(dev);
        static int version_printed = 0;
-       int i, retval;
+       int retval;
        unsigned int val, revision_register;
        const char *version_string;
+       DECLARE_MAC_BUF(mac);
 
        DBG(2, "%s: %s\n", CARDNAME, __FUNCTION__);
 
@@ -1966,7 +1903,6 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr)
        dev->hard_start_xmit = smc_hard_start_xmit;
        dev->tx_timeout = smc_timeout;
        dev->watchdog_timeo = msecs_to_jiffies(watchdog);
-       dev->get_stats = smc_query_statistics;
        dev->set_multicast_list = smc_set_multicast_list;
        dev->ethtool_ops = &smc_ethtool_ops;
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2036,10 +1972,8 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr)
                               "set using ifconfig\n", dev->name);
                } else {
                        /* Print the Ethernet address */
-                       printk("%s: Ethernet addr: ", dev->name);
-                       for (i = 0; i < 5; i++)
-                               printk("%2.2x:", dev->dev_addr[i]);
-                       printk("%2.2x\n", dev->dev_addr[5]);
+                       printk("%s: Ethernet addr: %s\n",
+                              dev->name, print_mac(mac, dev->dev_addr));
                }
 
                if (lp->phy_type == 0) {
@@ -2213,7 +2147,6 @@ static int smc_drv_probe(struct platform_device *pdev)
                ret = -ENOMEM;
                goto out_release_io;
        }
-       SET_MODULE_OWNER(ndev);
        SET_NETDEV_DEV(ndev, &pdev->dev);
 
        ndev->dma = (unsigned char)-1;
@@ -2239,17 +2172,19 @@ static int smc_drv_probe(struct platform_device *pdev)
                goto out_release_attrib;
        }
 
-       platform_set_drvdata(pdev, ndev);
-       ret = smc_probe(ndev, addr);
-       if (ret != 0)
-               goto out_iounmap;
 #ifdef SMC_USE_PXA_DMA
-       else {
+       {
                struct smc_local *lp = netdev_priv(ndev);
+               lp->device = &pdev->dev;
                lp->physaddr = res->start;
        }
 #endif
 
+       platform_set_drvdata(pdev, ndev);
+       ret = smc_probe(ndev, addr);
+       if (ret != 0)
+               goto out_iounmap;
+
        smc_request_datacs(pdev, ndev);
 
        return 0;