]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wan/farsync.c
Merge branch 'tracing/sysprof' into auto-ftrace-next
[mv-sheeva.git] / drivers / net / wan / farsync.c
index 58a53b6d9b429181a40dca4aa597890086e73bd2..547368e9633d7bd511ceb3a4820146bd87e12486 100644 (file)
@@ -1498,9 +1498,9 @@ do_bottom_half_rx(struct fst_card_info *card)
  *      Dev_id is our fst_card_info pointer
  */
 static irqreturn_t
-fst_intr(int irq, void *dev_id)
+fst_intr(int dummy, void *dev_id)
 {
-       struct fst_card_info *card;
+       struct fst_card_info *card = dev_id;
        struct fst_port_info *port;
        int rdidx;              /* Event buffer indices */
        int wridx;
@@ -1509,17 +1509,12 @@ fst_intr(int irq, void *dev_id)
        unsigned int do_card_interrupt;
        unsigned int int_retry_count;
 
-       if ((card = dev_id) == NULL) {
-               dbg(DBG_INTR, "intr: spurious %d\n", irq);
-               return IRQ_NONE;
-       }
-
        /*
         * Check to see if the interrupt was for this card
         * return if not
         * Note that the call to clear the interrupt is important
         */
-       dbg(DBG_INTR, "intr: %d %p\n", irq, card);
+       dbg(DBG_INTR, "intr: %d %p\n", card->irq, card);
        if (card->state != FST_RUNNING) {
                printk_err
                    ("Interrupt received for card %d in a non running state (%d)\n",
@@ -2029,6 +2024,7 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        struct fstioc_write wrthdr;
        struct fstioc_info info;
        unsigned long flags;
+       void *buf;
 
        dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data);
 
@@ -2070,16 +2066,22 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                        return -ENXIO;
                }
 
-               /* Now copy the data to the card.
-                * This will probably break on some architectures.
-                * I'll fix it when I have something to test on.
-                */
-               if (copy_from_user(card->mem + wrthdr.offset,
+               /* Now copy the data to the card. */
+
+               buf = kmalloc(wrthdr.size, GFP_KERNEL);
+               if (!buf)
+                       return -ENOMEM;
+
+               if (copy_from_user(buf,
                                   ifr->ifr_data + sizeof (struct fstioc_write),
                                   wrthdr.size)) {
+                       kfree(buf);
                        return -EFAULT;
                }
 
+               memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size);
+               kfree(buf);
+
                /* Writes to the memory of a card in the reset state constitute
                 * a download
                 */
@@ -2476,13 +2478,12 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        /* Allocate driver private data */
-       card = kmalloc(sizeof (struct fst_card_info), GFP_KERNEL);
+       card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL);
        if (card == NULL) {
                printk_err("FarSync card found but insufficient memory for"
                           " driver storage\n");
                return -ENOMEM;
        }
-       memset(card, 0, sizeof (struct fst_card_info));
 
        /* Try to enable the device */
        if ((err = pci_enable_device(pdev)) != 0) {