i2c: Document the message size limit
[safe/jmp/linux-2.6] / drivers / net / plip.c
index 87ee327..3327e9f 100644 (file)
@@ -16,7 +16,7 @@
  *             parport-sharing awareness code by Philip Blundell.
  *             SMP locking by Niibe Yutaka.
  *             Support for parallel ports with no IRQ (poll mode),
- *             Modifications to use the parallel port API 
+ *             Modifications to use the parallel port API
  *             by Nimrod Zimerman.
  *
  * Fixes:
@@ -106,6 +106,7 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n"
 #include <linux/if_plip.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
+#include <linux/completion.h>
 #include <linux/parport.h>
 #include <linux/bitops.h>
 
@@ -114,7 +115,6 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n"
 #include <asm/system.h>
 #include <asm/irq.h>
 #include <asm/byteorder.h>
-#include <asm/semaphore.h>
 
 /* Maximum number of devices to support. */
 #define PLIP_MAX  8
@@ -123,7 +123,7 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n"
 #ifndef NET_DEBUG
 #define NET_DEBUG 1
 #endif
-static unsigned int net_debug = NET_DEBUG;
+static const unsigned int net_debug = NET_DEBUG;
 
 #define ENABLE(irq)  if (irq != -1) enable_irq(irq)
 #define DISABLE(irq) if (irq != -1) disable_irq(irq)
@@ -138,23 +138,22 @@ static unsigned int net_debug = NET_DEBUG;
 #define PLIP_NIBBLE_WAIT        3000
 
 /* Bottom halves */
-static void plip_kick_bh(struct net_device *dev);
-static void plip_bh(struct net_device *dev);
-static void plip_timer_bh(struct net_device *dev);
+static void plip_kick_bh(struct work_struct *work);
+static void plip_bh(struct work_struct *work);
+static void plip_timer_bh(struct work_struct *work);
 
 /* Interrupt handler */
-static void plip_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static void plip_interrupt(void *dev_id);
 
 /* Functions for DEV methods */
 static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev);
 static int plip_hard_header(struct sk_buff *skb, struct net_device *dev,
-                            unsigned short type, void *daddr,
-                            void *saddr, unsigned len);
-static int plip_hard_header_cache(struct neighbour *neigh,
+                            unsigned short type, const void *daddr,
+                           const void *saddr, unsigned len);
+static int plip_hard_header_cache(const struct neighbour *neigh,
                                   struct hh_cache *hh);
 static int plip_open(struct net_device *dev);
 static int plip_close(struct net_device *dev);
-static struct net_device_stats *plip_get_stats(struct net_device *dev);
 static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 static int plip_preempt(void *handle);
 static void plip_wakeup(void *handle);
@@ -206,10 +205,10 @@ struct plip_local {
 };
 
 struct net_local {
-       struct net_device_stats enet_stats;
+       struct net_device *dev;
        struct work_struct immediate;
-       struct work_struct deferred;
-       struct work_struct timer;
+       struct delayed_work deferred;
+       struct delayed_work timer;
        struct plip_local snd_data;
        struct plip_local rcv_data;
        struct pardevice *pardev;
@@ -220,14 +219,9 @@ struct net_local {
        int is_deferred;
        int port_owner;
        int should_relinquish;
-       int (*orig_hard_header)(struct sk_buff *skb, struct net_device *dev,
-                               unsigned short type, void *daddr,
-                               void *saddr, unsigned len);
-       int (*orig_hard_header_cache)(struct neighbour *neigh,
-                                     struct hh_cache *hh);
        spinlock_t lock;
        atomic_t kill_timer;
-       struct semaphore killed_timer_sem;
+       struct completion killed_timer_cmp;
 };
 
 static inline void enable_parport_interrupts (struct net_device *dev)
@@ -235,7 +229,7 @@ static inline void enable_parport_interrupts (struct net_device *dev)
        if (dev->irq != -1)
        {
                struct parport *port =
-                  ((struct net_local *)dev->priv)->pardev->port;
+                  ((struct net_local *)netdev_priv(dev))->pardev->port;
                port->ops->enable_irq (port);
        }
 }
@@ -245,7 +239,7 @@ static inline void disable_parport_interrupts (struct net_device *dev)
        if (dev->irq != -1)
        {
                struct parport *port =
-                  ((struct net_local *)dev->priv)->pardev->port;
+                  ((struct net_local *)netdev_priv(dev))->pardev->port;
                port->ops->disable_irq (port);
        }
 }
@@ -253,7 +247,7 @@ static inline void disable_parport_interrupts (struct net_device *dev)
 static inline void write_data (struct net_device *dev, unsigned char data)
 {
        struct parport *port =
-          ((struct net_local *)dev->priv)->pardev->port;
+          ((struct net_local *)netdev_priv(dev))->pardev->port;
 
        port->ops->write_data (port, data);
 }
@@ -261,11 +255,26 @@ static inline void write_data (struct net_device *dev, unsigned char data)
 static inline unsigned char read_status (struct net_device *dev)
 {
        struct parport *port =
-          ((struct net_local *)dev->priv)->pardev->port;
+          ((struct net_local *)netdev_priv(dev))->pardev->port;
 
        return port->ops->read_status (port);
 }
 
+static const struct header_ops plip_header_ops = {
+       .create = plip_hard_header,
+       .cache  = plip_hard_header_cache,
+};
+
+static const struct net_device_ops plip_netdev_ops = {
+       .ndo_open                = plip_open,
+       .ndo_stop                = plip_close,
+       .ndo_start_xmit          = plip_tx_packet,
+       .ndo_do_ioctl            = plip_ioctl,
+       .ndo_change_mtu          = eth_change_mtu,
+       .ndo_set_mac_address     = eth_mac_addr,
+       .ndo_validate_addr       = eth_validate_addr,
+};
+
 /* Entry point of PLIP driver.
    Probe the hardware, and register/initialize the driver.
 
@@ -281,22 +290,12 @@ plip_init_netdev(struct net_device *dev)
        struct net_local *nl = netdev_priv(dev);
 
        /* Then, override parts of it */
-       dev->hard_start_xmit     = plip_tx_packet;
-       dev->open                = plip_open;
-       dev->stop                = plip_close;
-       dev->get_stats           = plip_get_stats;
-       dev->do_ioctl            = plip_ioctl;
-       dev->header_cache_update = NULL;
        dev->tx_queue_len        = 10;
        dev->flags               = IFF_POINTOPOINT|IFF_NOARP;
        memset(dev->dev_addr, 0xfc, ETH_ALEN);
 
-       /* Set the private structure */
-       nl->orig_hard_header    = dev->hard_header;
-       dev->hard_header        = plip_hard_header;
-
-       nl->orig_hard_header_cache = dev->hard_header_cache;
-       dev->hard_header_cache     = plip_hard_header_cache;
+       dev->netdev_ops          = &plip_netdev_ops;
+       dev->header_ops          = &plip_header_ops;
 
 
        nl->port_owner = 0;
@@ -306,11 +305,11 @@ plip_init_netdev(struct net_device *dev)
        nl->nibble      = PLIP_NIBBLE_WAIT;
 
        /* Initialize task queue structures */
-       INIT_WORK(&nl->immediate, (void (*)(void *))plip_bh, dev);
-       INIT_WORK(&nl->deferred, (void (*)(void *))plip_kick_bh, dev);
+       INIT_WORK(&nl->immediate, plip_bh);
+       INIT_DELAYED_WORK(&nl->deferred, plip_kick_bh);
 
        if (dev->irq == -1)
-               INIT_WORK(&nl->timer, (void (*)(void *))plip_timer_bh, dev);
+               INIT_DELAYED_WORK(&nl->timer, plip_timer_bh);
 
        spin_lock_init(&nl->lock);
 }
@@ -319,9 +318,10 @@ plip_init_netdev(struct net_device *dev)
    This routine is kicked by do_timer().
    Request `plip_bh' to be invoked. */
 static void
-plip_kick_bh(struct net_device *dev)
+plip_kick_bh(struct work_struct *work)
 {
-       struct net_local *nl = netdev_priv(dev);
+       struct net_local *nl =
+               container_of(work, struct net_local, deferred.work);
 
        if (nl->is_deferred)
                schedule_work(&nl->immediate);
@@ -351,7 +351,7 @@ static int plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
 typedef int (*plip_func)(struct net_device *dev, struct net_local *nl,
                         struct plip_local *snd, struct plip_local *rcv);
 
-static plip_func connection_state_table[] =
+static const plip_func connection_state_table[] =
 {
        plip_none,
        plip_receive_packet,
@@ -362,9 +362,9 @@ static plip_func connection_state_table[] =
 
 /* Bottom half handler of PLIP. */
 static void
-plip_bh(struct net_device *dev)
+plip_bh(struct work_struct *work)
 {
-       struct net_local *nl = netdev_priv(dev);
+       struct net_local *nl = container_of(work, struct net_local, immediate);
        struct plip_local *snd = &nl->snd_data;
        struct plip_local *rcv = &nl->rcv_data;
        plip_func f;
@@ -372,25 +372,26 @@ plip_bh(struct net_device *dev)
 
        nl->is_deferred = 0;
        f = connection_state_table[nl->connection];
-       if ((r = (*f)(dev, nl, snd, rcv)) != OK
-           && (r = plip_bh_timeout_error(dev, nl, snd, rcv, r)) != OK) {
+       if ((r = (*f)(nl->dev, nl, snd, rcv)) != OK &&
+           (r = plip_bh_timeout_error(nl->dev, nl, snd, rcv, r)) != OK) {
                nl->is_deferred = 1;
                schedule_delayed_work(&nl->deferred, 1);
        }
 }
 
 static void
-plip_timer_bh(struct net_device *dev)
+plip_timer_bh(struct work_struct *work)
 {
-       struct net_local *nl = netdev_priv(dev);
-       
+       struct net_local *nl =
+               container_of(work, struct net_local, timer.work);
+
        if (!(atomic_read (&nl->kill_timer))) {
-               plip_interrupt (-1, dev, NULL);
+               plip_interrupt (nl->dev);
 
                schedule_delayed_work(&nl->timer, 1);
        }
        else {
-               up (&nl->killed_timer_sem);
+               complete(&nl->killed_timer_cmp);
        }
 }
 
@@ -415,9 +416,8 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
 
                if (error != ERROR) { /* Timeout */
                        nl->timeout_count++;
-                       if ((error == HS_TIMEOUT
-                            && nl->timeout_count <= 10)
-                           || nl->timeout_count <= 3) {
+                       if ((error == HS_TIMEOUT && nl->timeout_count <= 10) ||
+                           nl->timeout_count <= 3) {
                                spin_unlock_irq(&nl->lock);
                                /* Try again later */
                                return TIMEOUT;
@@ -427,8 +427,8 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
                               dev->name, snd->state, c0);
                } else
                        error = HS_TIMEOUT;
-               nl->enet_stats.tx_errors++;
-               nl->enet_stats.tx_aborted_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_aborted_errors++;
        } else if (nl->connection == PLIP_CN_RECEIVE) {
                if (rcv->state == PLIP_PK_TRIGGER) {
                        /* Transmission was interrupted. */
@@ -445,7 +445,7 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
                        printk(KERN_WARNING "%s: receive timeout(%d,%02x)\n",
                               dev->name, rcv->state, c0);
                }
-               nl->enet_stats.rx_dropped++;
+               dev->stats.rx_dropped++;
        }
        rcv->state = PLIP_PK_DONE;
        if (rcv->skb) {
@@ -527,7 +527,7 @@ plip_receive(unsigned short nibble_timeout, struct net_device *dev,
 }
 
 /*
- *     Determine the packet's protocol ID. The rule here is that we 
+ *     Determine the packet's protocol ID. The rule here is that we
  *     assume 802.3 if the type field is short enough to be a length.
  *     This is normal practice and works for any 'now in use' protocol.
  *
@@ -537,16 +537,16 @@ plip_receive(unsigned short nibble_timeout, struct net_device *dev,
  *     We can't fix the daddr thing as that quirk (more bug) is embedded
  *     in far too many old systems not all even running Linux.
  */
+
 static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
        struct ethhdr *eth;
        unsigned char *rawp;
-       
-       skb->mac.raw=skb->data;
+
+       skb_reset_mac_header(skb);
        skb_pull(skb,dev->hard_header_len);
        eth = eth_hdr(skb);
-       
+
        if(*eth->h_dest&1)
        {
                if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
@@ -554,17 +554,17 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev)
                else
                        skb->pkt_type=PACKET_MULTICAST;
        }
-       
+
        /*
         *      This ALLMULTI check should be redundant by 1.4
         *      so don't forget to remove it.
         */
-        
+
        if (ntohs(eth->h_proto) >= 1536)
                return eth->h_proto;
-               
+
        rawp = skb->data;
-       
+
        /*
         *      This is a magic hack to spot IPX packets. Older Novell breaks
         *      the protocol design and runs IPX over 802.3 without an 802.2 LLC
@@ -573,7 +573,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev)
         */
        if (*(unsigned short *)rawp == 0xFFFF)
                return htons(ETH_P_802_3);
-               
+
        /*
         *      Real 802.2 LLC
         */
@@ -623,8 +623,8 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                if (plip_receive(nibble_timeout, dev,
                                 &rcv->nibble, &rcv->length.b.msb))
                        return TIMEOUT;
-               if (rcv->length.h > dev->mtu + dev->hard_header_len
-                   || rcv->length.h < 8) {
+               if (rcv->length.h > dev->mtu + dev->hard_header_len ||
+                   rcv->length.h < 8) {
                        printk(KERN_WARNING "%s: bogus packet size %d.\n", dev->name, rcv->length.h);
                        return ERROR;
                }
@@ -643,14 +643,14 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
 
        case PLIP_PK_DATA:
                lbuf = rcv->skb->data;
-               do
+               do {
                        if (plip_receive(nibble_timeout, dev,
                                         &rcv->nibble, &lbuf[rcv->byte]))
                                return TIMEOUT;
-               while (++rcv->byte < rcv->length.h);
-               do
+               while (++rcv->byte < rcv->length.h);
+               do {
                        rcv->checksum += lbuf[--rcv->byte];
-               while (rcv->byte);
+               while (rcv->byte);
                rcv->state = PLIP_PK_CHECKSUM;
 
        case PLIP_PK_CHECKSUM:
@@ -658,7 +658,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                                 &rcv->nibble, &rcv->data))
                        return TIMEOUT;
                if (rcv->data != rcv->checksum) {
-                       nl->enet_stats.rx_crc_errors++;
+                       dev->stats.rx_crc_errors++;
                        if (net_debug)
                                printk(KERN_DEBUG "%s: checksum error\n", dev->name);
                        return ERROR;
@@ -668,10 +668,9 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
        case PLIP_PK_DONE:
                /* Inform the upper layer for the arrival of a packet. */
                rcv->skb->protocol=plip_type_trans(rcv->skb, dev);
-               netif_rx(rcv->skb);
-               dev->last_rx = jiffies;
-               nl->enet_stats.rx_bytes += rcv->length.h;
-               nl->enet_stats.rx_packets++;
+               netif_rx_ni(rcv->skb);
+               dev->stats.rx_bytes += rcv->length.h;
+               dev->stats.rx_packets++;
                rcv->skb = NULL;
                if (net_debug > 2)
                        printk(KERN_DEBUG "%s: receive end\n", dev->name);
@@ -773,7 +772,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                        if (nl->connection == PLIP_CN_RECEIVE) {
                                spin_unlock_irq(&nl->lock);
                                /* Interrupted. */
-                               nl->enet_stats.collisions++;
+                               dev->stats.collisions++;
                                return OK;
                        }
                        c0 = read_status(dev);
@@ -789,7 +788,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                                           {enable,disable}_irq *counts*
                                           them.  -- AV  */
                                        ENABLE(dev->irq);
-                                       nl->enet_stats.collisions++;
+                                       dev->stats.collisions++;
                                        return OK;
                                }
                                disable_parport_interrupts (dev);
@@ -822,14 +821,14 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                snd->checksum = 0;
 
        case PLIP_PK_DATA:
-               do
+               do {
                        if (plip_send(nibble_timeout, dev,
                                      &snd->nibble, lbuf[snd->byte]))
                                return TIMEOUT;
-               while (++snd->byte < snd->length.h);
-               do
+               while (++snd->byte < snd->length.h);
+               do {
                        snd->checksum += lbuf[--snd->byte];
-               while (snd->byte);
+               while (snd->byte);
                snd->state = PLIP_PK_CHECKSUM;
 
        case PLIP_PK_CHECKSUM:
@@ -837,9 +836,9 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                              &snd->nibble, snd->checksum))
                        return TIMEOUT;
 
-               nl->enet_stats.tx_bytes += snd->skb->len;
+               dev->stats.tx_bytes += snd->skb->len;
                dev_kfree_skb(snd->skb);
-               nl->enet_stats.tx_packets++;
+               dev->stats.tx_packets++;
                snd->state = PLIP_PK_DONE;
 
        case PLIP_PK_DONE:
@@ -902,28 +901,24 @@ plip_error(struct net_device *dev, struct net_local *nl,
 
 /* Handle the parallel port interrupts. */
 static void
-plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+plip_interrupt(void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct net_local *nl;
        struct plip_local *rcv;
        unsigned char c0;
-
-       if (dev == NULL) {
-               printk(KERN_DEBUG "plip_interrupt: irq %d for unknown device.\n", irq);
-               return;
-       }
+       unsigned long flags;
 
        nl = netdev_priv(dev);
        rcv = &nl->rcv_data;
 
-       spin_lock_irq (&nl->lock);
+       spin_lock_irqsave (&nl->lock, flags);
 
        c0 = read_status(dev);
        if ((c0 & 0xf8) != 0xc0) {
                if ((dev->irq != -1) && (net_debug > 1))
                        printk(KERN_DEBUG "%s: spurious interrupt\n", dev->name);
-               spin_unlock_irq (&nl->lock);
+               spin_unlock_irqrestore (&nl->lock, flags);
                return;
        }
 
@@ -952,7 +947,7 @@ plip_interrupt(int irq, void *dev_id, struct pt_regs * regs)
                break;
        }
 
-       spin_unlock_irq(&nl->lock);
+       spin_unlock_irqrestore(&nl->lock, flags);
 }
 
 static int
@@ -962,21 +957,21 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev)
        struct plip_local *snd = &nl->snd_data;
 
        if (netif_queue_stopped(dev))
-               return 1;
+               return NETDEV_TX_BUSY;
 
        /* We may need to grab the bus */
        if (!nl->port_owner) {
                if (parport_claim(nl->pardev))
-                       return 1;
+                       return NETDEV_TX_BUSY;
                nl->port_owner = 1;
        }
 
        netif_stop_queue (dev);
-       
+
        if (skb->len > dev->mtu + dev->hard_header_len) {
                printk(KERN_WARNING "%s: packet too big, %d.\n", dev->name, (int)skb->len);
                netif_start_queue (dev);
-               return 1;
+               return NETDEV_TX_BUSY;
        }
 
        if (net_debug > 2)
@@ -993,19 +988,19 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev)
        }
        schedule_work(&nl->immediate);
        spin_unlock_irq(&nl->lock);
-       
-       return 0;
+
+       return NETDEV_TX_OK;
 }
 
 static void
-plip_rewrite_address(struct net_device *dev, struct ethhdr *eth)
+plip_rewrite_address(const struct net_device *dev, struct ethhdr *eth)
 {
-       struct in_device *in_dev;
+       const struct in_device *in_dev = dev->ip_ptr;
 
-       if ((in_dev=dev->ip_ptr) != NULL) {
+       if (in_dev) {
                /* Any address will do - we take the first */
-               struct in_ifaddr *ifa=in_dev->ifa_list;
-               if (ifa != NULL) {
+               const struct in_ifaddr *ifa = in_dev->ifa_list;
+               if (ifa) {
                        memcpy(eth->h_source, dev->dev_addr, 6);
                        memset(eth->h_dest, 0xfc, 2);
                        memcpy(eth->h_dest+2, &ifa->ifa_address, 4);
@@ -1015,35 +1010,34 @@ plip_rewrite_address(struct net_device *dev, struct ethhdr *eth)
 
 static int
 plip_hard_header(struct sk_buff *skb, struct net_device *dev,
-                 unsigned short type, void *daddr,
-                void *saddr, unsigned len)
+                unsigned short type, const void *daddr,
+                const void *saddr, unsigned len)
 {
-       struct net_local *nl = netdev_priv(dev);
        int ret;
 
-       if ((ret = nl->orig_hard_header(skb, dev, type, daddr, saddr, len)) >= 0)
+       ret = eth_header(skb, dev, type, daddr, saddr, len);
+       if (ret >= 0)
                plip_rewrite_address (dev, (struct ethhdr *)skb->data);
 
        return ret;
 }
 
-int plip_hard_header_cache(struct neighbour *neigh,
-                           struct hh_cache *hh)
+static int plip_hard_header_cache(const struct neighbour *neigh,
+                                 struct hh_cache *hh)
 {
-       struct net_local *nl = neigh->dev->priv;
        int ret;
-       
-       if ((ret = nl->orig_hard_header_cache(neigh, hh)) == 0)
-       {
+
+       ret = eth_header_cache(neigh, hh);
+       if (ret == 0) {
                struct ethhdr *eth;
 
                eth = (struct ethhdr*)(((u8*)hh->hh_data) +
                                       HH_DATA_OFF(sizeof(*eth)));
                plip_rewrite_address (neigh->dev, eth);
        }
-       
+
        return ret;
-}                          
+}
 
 /* Open/initialize the board.  This is called (in the current kernel)
    sometime after booting when the 'ifconfig' program is run.
@@ -1123,9 +1117,9 @@ plip_close(struct net_device *dev)
 
        if (dev->irq == -1)
        {
-               init_MUTEX_LOCKED (&nl->killed_timer_sem);
+               init_completion(&nl->killed_timer_cmp);
                atomic_set (&nl->kill_timer, 1);
-               down (&nl->killed_timer_sem);
+               wait_for_completion(&nl->killed_timer_cmp);
        }
 
 #ifdef NOTDEF
@@ -1187,7 +1181,7 @@ plip_wakeup(void *handle)
                else
                        return;
        }
-       
+
        if (!(dev->flags & IFF_UP))
                /* Don't need the port when the interface is down */
                return;
@@ -1201,15 +1195,6 @@ plip_wakeup(void *handle)
        return;
 }
 
-static struct net_device_stats *
-plip_get_stats(struct net_device *dev)
-{
-       struct net_local *nl = netdev_priv(dev);
-       struct net_device_stats *r = &nl->enet_stats;
-
-       return r;
-}
-
 static int
 plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
@@ -1264,7 +1249,7 @@ static void plip_attach (struct parport *port)
        struct net_local *nl;
        char name[IFNAMSIZ];
 
-       if ((parport[0] == -1 && (!timid || !port->devices)) || 
+       if ((parport[0] == -1 && (!timid || !port->devices)) ||
            plip_searchfor(parport, port->number)) {
                if (unit == PLIP_MAX) {
                        printk(KERN_ERR "plip: too many devices\n");
@@ -1277,10 +1262,9 @@ static void plip_attach (struct parport *port)
                        printk(KERN_ERR "plip: memory squeeze\n");
                        return;
                }
-               
+
                strcpy(dev->name, name);
 
-               SET_MODULE_OWNER(dev);
                dev->irq = port->irq;
                dev->base_addr = port->base;
                if (port->irq == -1) {
@@ -1289,8 +1273,9 @@ static void plip_attach (struct parport *port)
                }
 
                nl = netdev_priv(dev);
-               nl->pardev = parport_register_device(port, name, plip_preempt,
-                                                plip_wakeup, plip_interrupt, 
+               nl->dev = dev;
+               nl->pardev = parport_register_device(port, dev->name, plip_preempt,
+                                                plip_wakeup, plip_interrupt,
                                                 0, dev);
 
                if (!nl->pardev) {
@@ -1384,7 +1369,7 @@ static int __init plip_setup(char *str)
                        /* disable driver on "plip=" or "plip=0" */
                        parport[0] = -2;
                } else {
-                       printk(KERN_WARNING "warning: 'plip=0x%x' ignored\n", 
+                       printk(KERN_WARNING "warning: 'plip=0x%x' ignored\n",
                               ints[1]);
                }
        }
@@ -1416,9 +1401,3 @@ static int __init plip_init (void)
 module_init(plip_init);
 module_exit(plip_cleanup_module);
 MODULE_LICENSE("GPL");
-
-/*
- * Local variables:
- * compile-command: "gcc -DMODULE -DMODVERSIONS -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -g -fomit-frame-pointer -pipe -c plip.c"
- * End:
- */