clps711xfb: convert to proc_fops
[safe/jmp/linux-2.6] / drivers / net / spider_net.c
index e8b3b08..2185248 100644 (file)
@@ -57,6 +57,7 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com> and Jens Osterkamp " \
 MODULE_DESCRIPTION("Spider Southbridge Gigabit Ethernet driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(VERSION);
+MODULE_FIRMWARE(SPIDER_NET_FIRMWARE_NAME);
 
 static int rx_descriptors = SPIDER_NET_RX_DESCRIPTORS_DEFAULT;
 static int tx_descriptors = SPIDER_NET_TX_DESCRIPTORS_DEFAULT;
@@ -409,7 +410,7 @@ spider_net_free_rx_chain_contents(struct spider_net_card *card)
  * @card: card structure
  * @descr: descriptor to re-init
  *
- * Return 0 on succes, <0 on failure.
+ * Return 0 on success, <0 on failure.
  *
  * Allocates a new rx skb, iommu-maps it and attaches it to the
  * descriptor. Mark the descriptor as activated, ready-to-use.
@@ -452,7 +453,7 @@ spider_net_prepare_rx_descr(struct spider_net_card *card,
        /* iommu-map the skb */
        buf = pci_map_single(card->pdev, descr->skb->data,
                        SPIDER_NET_MAX_FRAME, PCI_DMA_FROMDEVICE);
-       if (pci_dma_mapping_error(buf)) {
+       if (pci_dma_mapping_error(card->pdev, buf)) {
                dev_kfree_skb_any(descr->skb);
                descr->skb = NULL;
                if (netif_msg_rx_err(card) && net_ratelimit())
@@ -672,7 +673,6 @@ write_hash:
 /**
  * spider_net_prepare_tx_descr - fill tx descriptor with skb data
  * @card: card structure
- * @descr: descriptor structure to fill out
  * @skb: packet to use
  *
  * returns 0 on success, <0 on failure.
@@ -691,7 +691,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
        unsigned long flags;
 
        buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
-       if (pci_dma_mapping_error(buf)) {
+       if (pci_dma_mapping_error(card->pdev, buf)) {
                if (netif_msg_tx_err(card) && net_ratelimit())
                        dev_err(&card->netdev->dev, "could not iommu-map packet (%p, %i). "
                                  "Dropping packet\n", skb->data, skb->len);
@@ -790,7 +790,7 @@ spider_net_set_low_watermark(struct spider_net_card *card)
  * spider_net_release_tx_chain releases the tx descriptors that spider has
  * finished with (if non-brutal) or simply release tx descriptors (if brutal).
  * If some other context is calling this function, we return 1 so that we're
- * scheduled again (if we were scheduled) and will not loose initiative.
+ * scheduled again (if we were scheduled) and will not lose initiative.
  */
 static int
 spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
@@ -867,7 +867,6 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
 /**
  * spider_net_kick_tx_dma - enables TX DMA processing
  * @card: card structure
- * @descr: descriptor address to enable TX processing at
  *
  * This routine will start the transmit DMA running if
  * it is not already running. This routine ned only be
@@ -1279,7 +1278,6 @@ bad_desc:
 static int spider_net_poll(struct napi_struct *napi, int budget)
 {
        struct spider_net_card *card = container_of(napi, struct spider_net_card, napi);
-       struct net_device *netdev = card->netdev;
        int packets_done = 0;
 
        while (packets_done < budget) {
@@ -1304,7 +1302,7 @@ static int spider_net_poll(struct napi_struct *napi, int budget)
        /* if all packets are in the stack, enable interrupts and return 0 */
        /* if not, return 1 */
        if (packets_done < budget) {
-               netif_rx_complete(netdev, napi);
+               napi_complete(napi);
                spider_net_rx_irq_on(card);
                card->ignore_rx_ramfull = 0;
        }
@@ -1531,8 +1529,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                        spider_net_refill_rx_chain(card);
                        spider_net_enable_rxdmac(card);
                        card->num_rx_ints ++;
-                       netif_rx_schedule(card->netdev,
-                                         &card->napi);
+                       napi_schedule(&card->napi);
                }
                show_error = 0;
                break;
@@ -1552,8 +1549,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                spider_net_refill_rx_chain(card);
                spider_net_enable_rxdmac(card);
                card->num_rx_ints ++;
-               netif_rx_schedule(card->netdev,
-                                 &card->napi);
+               napi_schedule(&card->napi);
                show_error = 0;
                break;
 
@@ -1567,8 +1563,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                spider_net_refill_rx_chain(card);
                spider_net_enable_rxdmac(card);
                card->num_rx_ints ++;
-               netif_rx_schedule(card->netdev,
-                                 &card->napi);
+               napi_schedule(&card->napi);
                show_error = 0;
                break;
 
@@ -1637,7 +1632,6 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
  * spider_net_interrupt - interrupt handler for spider_net
  * @irq: interrupt number
  * @ptr: pointer to net_device
- * @regs: PU registers
  *
  * returns IRQ_HANDLED, if interrupt was for driver, or IRQ_NONE, if no
  * interrupt found raised by card.
@@ -1663,11 +1657,11 @@ spider_net_interrupt(int irq, void *ptr)
 
        if (status_reg & SPIDER_NET_RXINT ) {
                spider_net_rx_irq_off(card);
-               netif_rx_schedule(netdev, &card->napi);
+               napi_schedule(&card->napi);
                card->num_rx_ints ++;
        }
        if (status_reg & SPIDER_NET_TXINT)
-               netif_rx_schedule(netdev, &card->napi);
+               napi_schedule(&card->napi);
 
        if (status_reg & SPIDER_NET_LINKINT)
                spider_net_link_reset(netdev);
@@ -1704,7 +1698,7 @@ spider_net_poll_controller(struct net_device *netdev)
  *
  * spider_net_enable_interrupt enables several interrupts
  */
-static void 
+static void
 spider_net_enable_interrupts(struct spider_net_card *card)
 {
        spider_net_write_reg(card, SPIDER_NET_GHIINT0MSK,
@@ -1721,7 +1715,7 @@ spider_net_enable_interrupts(struct spider_net_card *card)
  *
  * spider_net_disable_interrupts disables all the interrupts
  */
-static void 
+static void
 spider_net_disable_interrupts(struct spider_net_card *card)
 {
        spider_net_write_reg(card, SPIDER_NET_GHIINT0MSK, 0);
@@ -2045,7 +2039,8 @@ static void spider_net_link_phy(unsigned long data)
        /* if link didn't come up after SPIDER_NET_ANEG_TIMEOUT tries, setup phy again */
        if (card->aneg_count > SPIDER_NET_ANEG_TIMEOUT) {
 
-               pr_info("%s: link is down trying to bring it up\n", card->netdev->name);
+               pr_debug("%s: link is down trying to bring it up\n",
+                        card->netdev->name);
 
                switch (card->medium) {
                case BCM54XX_COPPER:
@@ -2096,9 +2091,10 @@ static void spider_net_link_phy(unsigned long data)
 
        card->aneg_count = 0;
 
-       pr_debug("Found %s with %i Mbps, %s-duplex %sautoneg.\n",
-               phy->def->name, phy->speed, phy->duplex==1 ? "Full" : "Half",
-               phy->autoneg==1 ? "" : "no ");
+       pr_info("%s: link up, %i Mbps, %s-duplex %sautoneg.\n",
+               card->netdev->name, phy->speed,
+               phy->duplex == 1 ? "Full" : "Half",
+               phy->autoneg == 1 ? "" : "no ");
 
        return;
 }
@@ -2264,6 +2260,23 @@ spider_net_tx_timeout(struct net_device *netdev)
        card->spider_stats.tx_timeouts++;
 }
 
+static const struct net_device_ops spider_net_ops = {
+       .ndo_open               = spider_net_open,
+       .ndo_stop               = spider_net_stop,
+       .ndo_start_xmit         = spider_net_xmit,
+       .ndo_set_multicast_list = spider_net_set_multi,
+       .ndo_set_mac_address    = spider_net_set_mac,
+       .ndo_change_mtu         = spider_net_change_mtu,
+       .ndo_do_ioctl           = spider_net_do_ioctl,
+       .ndo_tx_timeout         = spider_net_tx_timeout,
+       .ndo_validate_addr      = eth_validate_addr,
+       /* HW VLAN */
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       /* poll controller */
+       .ndo_poll_controller    = spider_net_poll_controller,
+#endif /* CONFIG_NET_POLL_CONTROLLER */
+};
+
 /**
  * spider_net_setup_netdev_ops - initialization of net_device operations
  * @netdev: net_device structure
@@ -2273,21 +2286,8 @@ spider_net_tx_timeout(struct net_device *netdev)
 static void
 spider_net_setup_netdev_ops(struct net_device *netdev)
 {
-       netdev->open = &spider_net_open;
-       netdev->stop = &spider_net_stop;
-       netdev->hard_start_xmit = &spider_net_xmit;
-       netdev->set_multicast_list = &spider_net_set_multi;
-       netdev->set_mac_address = &spider_net_set_mac;
-       netdev->change_mtu = &spider_net_change_mtu;
-       netdev->do_ioctl = &spider_net_do_ioctl;
-       /* tx watchdog */
-       netdev->tx_timeout = &spider_net_tx_timeout;
+       netdev->netdev_ops = &spider_net_ops;
        netdev->watchdog_timeo = SPIDER_NET_WATCHDOG_TIMEOUT;
-       /* HW VLAN */
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       /* poll controller */
-       netdev->poll_controller = &spider_net_poll_controller;
-#endif /* CONFIG_NET_POLL_CONTROLLER */
        /* ethtool ops */
        netdev->ethtool_ops = &spider_net_ethtool_ops;
 }
@@ -2417,7 +2417,6 @@ spider_net_undo_pci_setup(struct spider_net_card *card)
 
 /**
  * spider_net_setup_pci_dev - sets up the device in terms of PCI operations
- * @card: card structure
  * @pdev: PCI device
  *
  * Returns the card structure or NULL if any errors occur