Commit 498bb30a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[netdrvr] use netdev_priv in dl2k, hamachi

parent f535fd1a
......@@ -168,7 +168,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
#endif
dev->base_addr = ioaddr;
dev->irq = irq;
np = dev->priv;
np = netdev_priv(dev);
np->chip_id = chip_idx;
np->pdev = pdev;
spin_lock_init (&np->tx_lock);
......@@ -335,7 +335,7 @@ find_miiphy (struct net_device *dev)
int i, phy_found = 0;
struct netdev_private *np;
long ioaddr;
np = dev->priv;
np = netdev_priv(dev);
ioaddr = dev->base_addr;
np->phy_addr = 1;
......@@ -362,7 +362,7 @@ parse_eeprom (struct net_device *dev)
u8 *psib;
u32 crc;
PSROM_t psrom = (PSROM_t) sromdata;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int cid, next;
......@@ -432,7 +432,7 @@ parse_eeprom (struct net_device *dev)
static int
rio_open (struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
int i;
u16 macctrl;
......@@ -516,7 +516,7 @@ static void
rio_timer (unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
unsigned int entry;
int next_tick = 1*HZ;
unsigned long flags;
......@@ -574,7 +574,7 @@ rio_tx_timeout (struct net_device *dev)
static void
alloc_list (struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int i;
np->cur_rx = np->cur_tx = 0;
......@@ -631,7 +631,7 @@ alloc_list (struct net_device *dev)
static int
start_xmit (struct sk_buff *skb, struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
struct netdev_desc *txdesc;
unsigned entry;
u32 ioaddr;
......@@ -711,7 +711,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs)
int handled = 0;
ioaddr = dev->base_addr;
np = dev->priv;
np = netdev_priv(dev);
while (1) {
int_status = readw (ioaddr + IntStatus);
writew (int_status, ioaddr + IntStatus);
......@@ -745,7 +745,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs)
static void
rio_free_tx (struct net_device *dev, int irq)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int entry = np->old_tx % TX_RING_SIZE;
int tx_use = 0;
unsigned long flag = 0;
......@@ -798,7 +798,7 @@ tx_error (struct net_device *dev, int tx_status)
int frame_id;
int i;
np = dev->priv;
np = netdev_priv(dev);
frame_id = (tx_status & 0xffff0000);
printk (KERN_ERR "%s: Transmit error, TxStatus %4.4x, FrameId %d.\n",
......@@ -855,7 +855,7 @@ tx_error (struct net_device *dev, int tx_status)
static int
receive_packet (struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int entry = np->cur_rx % RX_RING_SIZE;
int cnt = 30;
......@@ -965,7 +965,7 @@ static void
rio_error (struct net_device *dev, int int_status)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
u16 macctrl;
/* Link change event */
......@@ -1016,7 +1016,7 @@ static struct net_device_stats *
get_stats (struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
#ifdef MEM_MAPPING
int i;
#endif
......@@ -1132,7 +1132,7 @@ clear_stats (struct net_device *dev)
int
change_mtu (struct net_device *dev, int new_mtu)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int max = (np->jumbo) ? MAX_JUMBO : 1536;
if ((new_mtu < 68) || (new_mtu > max)) {
......@@ -1150,7 +1150,7 @@ set_multicast (struct net_device *dev)
long ioaddr = dev->base_addr;
u32 hash_table[2];
u16 rx_mode = 0;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
hash_table[0] = hash_table[1] = 0;
/* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
......@@ -1197,7 +1197,7 @@ set_multicast (struct net_device *dev)
static int
rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
u32 ethcmd;
if (copy_from_user (&ethcmd, useraddr, sizeof (ethcmd)))
......@@ -1324,7 +1324,7 @@ static int
rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{
int phy_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru;
struct netdev_desc *desc;
......@@ -1490,7 +1490,7 @@ mii_wait_link (struct net_device *dev, int wait)
int phy_addr;
struct netdev_private *np;
np = dev->priv;
np = netdev_priv(dev);
phy_addr = np->phy_addr;
do {
......@@ -1512,7 +1512,7 @@ mii_get_media (struct net_device *dev)
int phy_addr;
struct netdev_private *np;
np = dev->priv;
np = netdev_priv(dev);
phy_addr = np->phy_addr;
bmsr.image = mii_read (dev, phy_addr, MII_BMSR);
......@@ -1594,7 +1594,7 @@ mii_set_media (struct net_device *dev)
ANAR_t anar;
int phy_addr;
struct netdev_private *np;
np = dev->priv;
np = netdev_priv(dev);
phy_addr = np->phy_addr;
/* Does user set speed? */
......@@ -1684,7 +1684,7 @@ mii_get_media_pcs (struct net_device *dev)
int phy_addr;
struct netdev_private *np;
np = dev->priv;
np = netdev_priv(dev);
phy_addr = np->phy_addr;
bmsr.image = mii_read (dev, phy_addr, PCS_BMSR);
......@@ -1740,7 +1740,7 @@ mii_set_media_pcs (struct net_device *dev)
ANAR_PCS_t anar;
int phy_addr;
struct netdev_private *np;
np = dev->priv;
np = netdev_priv(dev);
phy_addr = np->phy_addr;
/* Auto-Negotiation? */
......@@ -1794,7 +1794,7 @@ static int
rio_close (struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
struct sk_buff *skb;
int i;
......@@ -1840,7 +1840,7 @@ rio_remove1 (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata (pdev);
if (dev) {
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
unregister_netdev (dev);
pci_free_consistent (pdev, RX_TOTAL_SIZE, np->rx_ring,
......
......@@ -631,7 +631,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
read_eeprom(ioaddr, i), i % 16 != 15 ? " " : "\n");
#endif
hmp = dev->priv;
hmp = netdev_priv(dev);
spin_lock_init(&hmp->lock);
hmp->mii_if.dev = dev;
......@@ -851,7 +851,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
static int hamachi_open(struct net_device *dev)
{
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int i;
u32 rx_int_var, tx_int_var;
......@@ -1000,7 +1000,7 @@ static int hamachi_open(struct net_device *dev)
static inline int hamachi_tx(struct net_device *dev)
{
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
/* Update the dirty pointer until we find an entry that is
still owned by the card */
......@@ -1032,7 +1032,7 @@ static inline int hamachi_tx(struct net_device *dev)
static void hamachi_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 10*HZ;
......@@ -1057,7 +1057,7 @@ static void hamachi_timer(unsigned long data)
static void hamachi_tx_timeout(struct net_device *dev)
{
int i;
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr;
printk(KERN_WARNING "%s: Hamachi transmit timed out, status %8.8x,"
......@@ -1163,7 +1163,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void hamachi_init_ring(struct net_device *dev)
{
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
int i;
hmp->tx_full = 0;
......@@ -1255,7 +1255,7 @@ do { \
static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
unsigned entry;
u16 status;
......@@ -1383,7 +1383,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
#endif
ioaddr = dev->base_addr;
hmp = dev->priv;
hmp = netdev_priv(dev);
spin_lock(&hmp->lock);
do {
......@@ -1477,7 +1477,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
for clarity and better register allocation. */
static int hamachi_rx(struct net_device *dev)
{
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
int entry = hmp->cur_rx % RX_RING_SIZE;
int boguscnt = (hmp->dirty_rx + RX_RING_SIZE) - hmp->cur_rx;
......@@ -1693,7 +1693,7 @@ static int hamachi_rx(struct net_device *dev)
static void hamachi_error(struct net_device *dev, int intr_status)
{
long ioaddr = dev->base_addr;
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
if (intr_status & (LinkChange|NegotiationChange)) {
if (hamachi_debug > 1)
......@@ -1727,7 +1727,7 @@ static void hamachi_error(struct net_device *dev, int intr_status)
static int hamachi_close(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
struct sk_buff *skb;
int i;
......@@ -1813,7 +1813,7 @@ static int hamachi_close(struct net_device *dev)
static struct net_device_stats *hamachi_get_stats(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
/* We should lock this segment of code for SMP eventually, although
the vulnerability window is very small and statistics are
......@@ -1869,7 +1869,7 @@ static void set_rx_mode(struct net_device *dev)
static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
{
struct hamachi_private *np = dev->priv;
struct hamachi_private *np = netdev_priv(dev);
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
......@@ -1934,7 +1934,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct hamachi_private *np = dev->priv;
struct hamachi_private *np = netdev_priv(dev);
struct mii_ioctl_data *data = if_mii(rq);
int rc;
......@@ -1976,7 +1976,7 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev);
if (dev) {
struct hamachi_private *hmp = dev->priv;
struct hamachi_private *hmp = netdev_priv(dev);
pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring,
hmp->rx_ring_dma);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment