]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - drivers/net/sb1000.c
drivers/net: Convert unbounded kzalloc calls to kcalloc
[linux-2.6.git] / drivers / net / sb1000.c
index 5986cec17f19eff6b3aa06ba9f4d500ef953b8bd..a9ae505e1baf1e0fb35e32c940a5c63d17e8d7ff 100644 (file)
@@ -36,12 +36,12 @@ static char version[] = "sb1000.c:v1.1.2 6/01/98 (fventuri@mediaone.net)\n";
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
 #include <linux/if_cablemodem.h> /* for SIOGCM/SIOSCM stuff */
 #include <linux/in.h>
-#include <linux/slab.h>
 #include <linux/ioport.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
@@ -51,6 +51,7 @@ static char version[] = "sb1000.c:v1.1.2 6/01/98 (fventuri@mediaone.net)\n";
 #include <linux/pnp.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/gfp.h>
 
 #include <asm/io.h>
 #include <asm/processor.h>
@@ -82,7 +83,8 @@ struct sb1000_private {
 extern int sb1000_probe(struct net_device *dev);
 static int sb1000_open(struct net_device *dev);
 static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd);
-static int sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t sb1000_start_xmit(struct sk_buff *skb,
+                                    struct net_device *dev);
 static irqreturn_t sb1000_interrupt(int irq, void *dev_id);
 static int sb1000_close(struct net_device *dev);
 
@@ -134,6 +136,16 @@ static const struct pnp_device_id sb1000_pnp_ids[] = {
 };
 MODULE_DEVICE_TABLE(pnp, sb1000_pnp_ids);
 
+static const struct net_device_ops sb1000_netdev_ops = {
+       .ndo_open               = sb1000_open,
+       .ndo_start_xmit         = sb1000_start_xmit,
+       .ndo_do_ioctl           = sb1000_dev_ioctl,
+       .ndo_stop               = sb1000_close,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 static int
 sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id)
 {
@@ -192,11 +204,7 @@ sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id)
        if (sb1000_debug > 0)
                printk(KERN_NOTICE "%s", version);
 
-       /* The SB1000-specific entries in the device structure. */
-       dev->open               = sb1000_open;
-       dev->do_ioctl           = sb1000_dev_ioctl;
-       dev->hard_start_xmit    = sb1000_start_xmit;
-       dev->stop               = sb1000_close;
+       dev->netdev_ops = &sb1000_netdev_ops;
 
        /* hardware address is 0:0:serial_number */
        dev->dev_addr[2]        = serial_number >> 24 & 0xff;
@@ -418,7 +426,6 @@ sb1000_send_command(const int ioaddr[], const char* name,
        if (sb1000_debug > 3)
                printk(KERN_DEBUG "%s: sb1000_send_command out: %02x%02x%02x%02x"
                        "%02x%02x\n", name, out[0], out[1], out[2], out[3], out[4], out[5]);
-       return;
 }
 
 /* Card Read Status (to be used during frame rx) */
@@ -430,7 +437,6 @@ sb1000_read_status(const int ioaddr[], unsigned char in[])
        in[3] = inb(ioaddr[0] + 3);
        in[4] = inb(ioaddr[0] + 4);
        in[0] = inb(ioaddr[0] + 5);
-       return;
 }
 
 /* Issue Read Command (to be used during frame rx) */
@@ -442,7 +448,6 @@ sb1000_issue_read_command(const int ioaddr[], const char* name)
        sb1000_wait_for_ready_clear(ioaddr, name);
        outb(0xa0, ioaddr[0] + 6);
        sb1000_send_command(ioaddr, name, Command0);
-       return;
 }
 
 
@@ -725,7 +730,6 @@ sb1000_print_status_buffer(const char* name, unsigned char st[],
                        printk("\n");
                }
        }
-       return;
 }
 
 /*
@@ -869,7 +873,6 @@ printk("cm0: IP identification: %02x%02x  fragment offset: %02x%02x\n", buffer[3
        /* datagram completed: send to upper level */
        skb_trim(skb, dlen);
        netif_rx(skb);
-       dev->last_rx = jiffies;
        stats->rx_bytes+=dlen;
        stats->rx_packets++;
        lp->rx_skb[ns] = NULL;
@@ -919,7 +922,6 @@ sb1000_error_dpc(struct net_device *dev)
        sb1000_read_status(ioaddr, st);
        if (st[1] & 0x10)
                lp->rx_error_dpc_count = ErrorDpcCounterInitialize;
-       return;
 }
 
 
@@ -966,7 +968,7 @@ sb1000_open(struct net_device *dev)
        lp->rx_frame_id[1] = 0;
        lp->rx_frame_id[2] = 0;
        lp->rx_frame_id[3] = 0;
-       if (request_irq(dev->irq, &sb1000_interrupt, 0, "sb1000", dev)) {
+       if (request_irq(dev->irq, sb1000_interrupt, 0, "sb1000", dev)) {
                return -EAGAIN;
        }
 
@@ -1075,13 +1077,13 @@ static int sb1000_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 }
 
 /* transmit function: do nothing since SB1000 can't send anything out */
-static int
+static netdev_tx_t
 sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        printk(KERN_WARNING "%s: trying to transmit!!!\n", dev->name);
        /* sb1000 can't xmit datagrams */
        dev_kfree_skb(skb);
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /* SB1000 interrupt handler. */