aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/meth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/meth.c')
-rw-r--r--drivers/net/meth.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index e1d97cdf649e..7e69ca6edd91 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <linux/sched.h>
15#include <linux/kernel.h> /* printk() */ 14#include <linux/kernel.h> /* printk() */
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
@@ -171,7 +170,7 @@ static int mdio_probe(struct meth_private *priv)
171 170
172static void meth_check_link(struct net_device *dev) 171static void meth_check_link(struct net_device *dev)
173{ 172{
174 struct meth_private *priv = (struct meth_private *) dev->priv; 173 struct meth_private *priv = netdev_priv(dev);
175 unsigned long mii_advertising = mdio_read(priv, 4); 174 unsigned long mii_advertising = mdio_read(priv, 4);
176 unsigned long mii_partner = mdio_read(priv, 5); 175 unsigned long mii_partner = mdio_read(priv, 5);
177 unsigned long negotiated = mii_advertising & mii_partner; 176 unsigned long negotiated = mii_advertising & mii_partner;
@@ -269,7 +268,7 @@ static void meth_free_rx_ring(struct meth_private *priv)
269 268
270int meth_reset(struct net_device *dev) 269int meth_reset(struct net_device *dev)
271{ 270{
272 struct meth_private *priv = (struct meth_private *) dev->priv; 271 struct meth_private *priv = netdev_priv(dev);
273 272
274 /* Reset card */ 273 /* Reset card */
275 mace->eth.mac_ctrl = SGI_MAC_RESET; 274 mace->eth.mac_ctrl = SGI_MAC_RESET;
@@ -311,7 +310,7 @@ int meth_reset(struct net_device *dev)
311 */ 310 */
312static int meth_open(struct net_device *dev) 311static int meth_open(struct net_device *dev)
313{ 312{
314 struct meth_private *priv = dev->priv; 313 struct meth_private *priv = netdev_priv(dev);
315 int ret; 314 int ret;
316 315
317 priv->phy_addr = -1; /* No PHY is known yet... */ 316 priv->phy_addr = -1; /* No PHY is known yet... */
@@ -355,7 +354,7 @@ out_free_tx_ring:
355 354
356static int meth_release(struct net_device *dev) 355static int meth_release(struct net_device *dev)
357{ 356{
358 struct meth_private *priv = dev->priv; 357 struct meth_private *priv = netdev_priv(dev);
359 358
360 DPRINTK("Stopping queue\n"); 359 DPRINTK("Stopping queue\n");
361 netif_stop_queue(dev); /* can't transmit any more */ 360 netif_stop_queue(dev); /* can't transmit any more */
@@ -377,7 +376,7 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
377{ 376{
378 struct sk_buff *skb; 377 struct sk_buff *skb;
379 unsigned long status; 378 unsigned long status;
380 struct meth_private *priv = (struct meth_private *) dev->priv; 379 struct meth_private *priv = netdev_priv(dev);
381 unsigned long fifo_rptr = (int_status & METH_INT_RX_RPTR_MASK) >> 8; 380 unsigned long fifo_rptr = (int_status & METH_INT_RX_RPTR_MASK) >> 8;
382 381
383 spin_lock(&priv->meth_lock); 382 spin_lock(&priv->meth_lock);
@@ -467,14 +466,14 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
467 466
468static int meth_tx_full(struct net_device *dev) 467static int meth_tx_full(struct net_device *dev)
469{ 468{
470 struct meth_private *priv = (struct meth_private *) dev->priv; 469 struct meth_private *priv = netdev_priv(dev);
471 470
472 return (priv->tx_count >= TX_RING_ENTRIES - 1); 471 return (priv->tx_count >= TX_RING_ENTRIES - 1);
473} 472}
474 473
475static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status) 474static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
476{ 475{
477 struct meth_private *priv = dev->priv; 476 struct meth_private *priv = netdev_priv(dev);
478 unsigned long status; 477 unsigned long status;
479 struct sk_buff *skb; 478 struct sk_buff *skb;
480 unsigned long rptr = (int_status&TX_INFO_RPTR) >> 16; 479 unsigned long rptr = (int_status&TX_INFO_RPTR) >> 16;
@@ -537,7 +536,7 @@ static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
537 536
538static void meth_error(struct net_device* dev, unsigned status) 537static void meth_error(struct net_device* dev, unsigned status)
539{ 538{
540 struct meth_private *priv = (struct meth_private *) dev->priv; 539 struct meth_private *priv = netdev_priv(dev);
541 540
542 printk(KERN_WARNING "meth: error status: 0x%08x\n",status); 541 printk(KERN_WARNING "meth: error status: 0x%08x\n",status);
543 /* check for errors too... */ 542 /* check for errors too... */
@@ -571,7 +570,7 @@ static void meth_error(struct net_device* dev, unsigned status)
571static irqreturn_t meth_interrupt(int irq, void *dev_id) 570static irqreturn_t meth_interrupt(int irq, void *dev_id)
572{ 571{
573 struct net_device *dev = (struct net_device *)dev_id; 572 struct net_device *dev = (struct net_device *)dev_id;
574 struct meth_private *priv = (struct meth_private *) dev->priv; 573 struct meth_private *priv = netdev_priv(dev);
575 unsigned long status; 574 unsigned long status;
576 575
577 status = mace->eth.int_stat; 576 status = mace->eth.int_stat;
@@ -696,7 +695,7 @@ static void meth_add_to_tx_ring(struct meth_private *priv, struct sk_buff *skb)
696 */ 695 */
697static int meth_tx(struct sk_buff *skb, struct net_device *dev) 696static int meth_tx(struct sk_buff *skb, struct net_device *dev)
698{ 697{
699 struct meth_private *priv = (struct meth_private *) dev->priv; 698 struct meth_private *priv = netdev_priv(dev);
700 unsigned long flags; 699 unsigned long flags;
701 700
702 spin_lock_irqsave(&priv->meth_lock, flags); 701 spin_lock_irqsave(&priv->meth_lock, flags);
@@ -727,7 +726,7 @@ static int meth_tx(struct sk_buff *skb, struct net_device *dev)
727 */ 726 */
728static void meth_tx_timeout(struct net_device *dev) 727static void meth_tx_timeout(struct net_device *dev)
729{ 728{
730 struct meth_private *priv = (struct meth_private *) dev->priv; 729 struct meth_private *priv = netdev_priv(dev);
731 unsigned long flags; 730 unsigned long flags;
732 731
733 printk(KERN_WARNING "%s: transmit timed out\n", dev->name); 732 printk(KERN_WARNING "%s: transmit timed out\n", dev->name);
@@ -779,7 +778,7 @@ static int meth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
779 */ 778 */
780static struct net_device_stats *meth_stats(struct net_device *dev) 779static struct net_device_stats *meth_stats(struct net_device *dev)
781{ 780{
782 struct meth_private *priv = (struct meth_private *) dev->priv; 781 struct meth_private *priv = netdev_priv(dev);
783 return &priv->stats; 782 return &priv->stats;
784} 783}
785 784
@@ -808,7 +807,7 @@ static struct net_device *meth_init(void)
808 dev->irq = MACE_ETHERNET_IRQ; 807 dev->irq = MACE_ETHERNET_IRQ;
809 dev->base_addr = (unsigned long)&mace->eth; 808 dev->base_addr = (unsigned long)&mace->eth;
810 809
811 priv = (struct meth_private *) dev->priv; 810 priv = netdev_priv(dev);
812 spin_lock_init(&priv->meth_lock); 811 spin_lock_init(&priv->meth_lock);
813 812
814 ret = register_netdev(dev); 813 ret = register_netdev(dev);