X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fnet%2Fplip.c;h=71afb274498f5558f1c2f33334441503d43a1a19;hb=87ca4e5b8d729fc157a0a599d78ccab245fc0602;hp=f4b62405d2e5997a2639e53424481d136e776961;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/net/plip.c b/drivers/net/plip.c index f4b6240..71afb27 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c @@ -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: @@ -98,7 +98,6 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n" #include #include #include -#include #include #include #include @@ -106,7 +105,6 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n" #include #include #include -#include #include #include #include @@ -125,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) @@ -145,7 +143,7 @@ static void plip_bh(struct net_device *dev); static void plip_timer_bh(struct net_device *dev); /* Interrupt handler */ -static void plip_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static void plip_interrupt(int irq, void *dev_id); /* Functions for DEV methods */ static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev); @@ -160,7 +158,7 @@ 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); - + enum plip_connection_state { PLIP_CN_NONE=0, PLIP_CN_RECEIVE, @@ -231,8 +229,8 @@ struct net_local { atomic_t kill_timer; struct semaphore killed_timer_sem; }; - -inline static void enable_parport_interrupts (struct net_device *dev) + +static inline void enable_parport_interrupts (struct net_device *dev) { if (dev->irq != -1) { @@ -242,7 +240,7 @@ inline static void enable_parport_interrupts (struct net_device *dev) } } -inline static void disable_parport_interrupts (struct net_device *dev) +static inline void disable_parport_interrupts (struct net_device *dev) { if (dev->irq != -1) { @@ -252,7 +250,7 @@ inline static void disable_parport_interrupts (struct net_device *dev) } } -inline static void write_data (struct net_device *dev, unsigned char data) +static inline void write_data (struct net_device *dev, unsigned char data) { struct parport *port = ((struct net_local *)dev->priv)->pardev->port; @@ -260,14 +258,14 @@ inline static void write_data (struct net_device *dev, unsigned char data) port->ops->write_data (port, data); } -inline static unsigned char read_status (struct net_device *dev) +static inline unsigned char read_status (struct net_device *dev) { struct parport *port = ((struct net_local *)dev->priv)->pardev->port; return port->ops->read_status (port); } - + /* Entry point of PLIP driver. Probe the hardware, and register/initialize the driver. @@ -316,7 +314,7 @@ plip_init_netdev(struct net_device *dev) spin_lock_init(&nl->lock); } - + /* Bottom half handler for the delayed request. This routine is kicked by do_timer(). Request `plip_bh' to be invoked. */ @@ -353,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, @@ -385,9 +383,9 @@ static void plip_timer_bh(struct net_device *dev) { struct net_local *nl = netdev_priv(dev); - + if (!(atomic_read (&nl->kill_timer))) { - plip_interrupt (-1, dev, NULL); + plip_interrupt (-1, dev); schedule_delayed_work(&nl->timer, 1); } @@ -471,7 +469,7 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl, return TIMEOUT; } - + static int plip_none(struct net_device *dev, struct net_local *nl, struct plip_local *snd, struct plip_local *rcv) @@ -481,7 +479,7 @@ plip_none(struct net_device *dev, struct net_local *nl, /* PLIP_RECEIVE --- receive a byte(two nibbles) Returns OK on success, TIMEOUT on timeout */ -inline static int +static inline int plip_receive(unsigned short nibble_timeout, struct net_device *dev, enum plip_nibble_state *ns_p, unsigned char *data_p) { @@ -529,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. * @@ -539,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 unsigned short plip_type_trans(struct sk_buff *skb, struct net_device *dev) + +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_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) @@ -556,17 +554,17 @@ static unsigned short plip_type_trans(struct sk_buff *skb, struct net_device *de 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 @@ -575,14 +573,13 @@ static unsigned short plip_type_trans(struct sk_buff *skb, struct net_device *de */ if (*(unsigned short *)rawp == 0xFFFF) return htons(ETH_P_802_3); - + /* * Real 802.2 LLC */ return htons(ETH_P_802_2); } - /* PLIP_RECEIVE_PACKET --- receive a packet */ static int plip_receive_packet(struct net_device *dev, struct net_local *nl, @@ -702,7 +699,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl, /* PLIP_SEND --- send a byte (two nibbles) Returns OK on success, TIMEOUT when timeout */ -inline static int +static inline int plip_send(unsigned short nibble_timeout, struct net_device *dev, enum plip_nibble_state *ns_p, unsigned char data) { @@ -902,21 +899,16 @@ plip_error(struct net_device *dev, struct net_local *nl, return OK; } - + /* Handle the parallel port interrupts. */ static void -plip_interrupt(int irq, void *dev_id, struct pt_regs * regs) +plip_interrupt(int irq, 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; - } - nl = netdev_priv(dev); rcv = &nl->rcv_data; @@ -957,7 +949,7 @@ plip_interrupt(int irq, void *dev_id, struct pt_regs * regs) spin_unlock_irq(&nl->lock); } - + static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev) { @@ -975,7 +967,7 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev) } 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); @@ -996,7 +988,7 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev) } schedule_work(&nl->immediate); spin_unlock_irq(&nl->lock); - + return 0; } @@ -1035,7 +1027,7 @@ int plip_hard_header_cache(struct neighbour *neigh, { struct net_local *nl = neigh->dev->priv; int ret; - + if ((ret = nl->orig_hard_header_cache(neigh, hh)) == 0) { struct ethhdr *eth; @@ -1044,9 +1036,9 @@ int plip_hard_header_cache(struct neighbour *neigh, 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. @@ -1190,7 +1182,7 @@ plip_wakeup(void *handle) else return; } - + if (!(dev->flags & IFF_UP)) /* Don't need the port when the interface is down */ return; @@ -1238,7 +1230,7 @@ plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } return 0; } - + static int parport[PLIP_MAX] = { [0 ... PLIP_MAX-1] = -1 }; static int timid; @@ -1267,7 +1259,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"); @@ -1280,7 +1272,7 @@ static void plip_attach (struct parport *port) printk(KERN_ERR "plip: memory squeeze\n"); return; } - + strcpy(dev->name, name); SET_MODULE_OWNER(dev); @@ -1293,7 +1285,7 @@ static void plip_attach (struct parport *port) nl = netdev_priv(dev); nl->pardev = parport_register_device(port, name, plip_preempt, - plip_wakeup, plip_interrupt, + plip_wakeup, plip_interrupt, 0, dev); if (!nl->pardev) { @@ -1387,7 +1379,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]); } }