Add pci_ioremap_bar and backport b44. Now it works again with wireless-testing.
authorHauke Mehrtens <hauke@hauke-m.de>
Fri, 16 Jan 2009 14:04:40 +0000 (15:04 +0100)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Fri, 16 Jan 2009 17:03:27 +0000 (09:03 -0800)
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
compat/compat.c
compat/compat.diff
compat/compat.h

index 3a6914c367feb23d8295d5c6df246ea912d9f1d9..a3d44d70033192673cc3544e37b737d0544db671 100644 (file)
 
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) */
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
+
+/* 2.6.28 compat code goes here */
+
+void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
+{
+       /*
+        * Make sure the BAR is actually a memory resource, not an IO resource
+        */
+       if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
+               WARN_ON(1);
+               return NULL;
+       }
+       return ioremap_nocache(pci_resource_start(pdev, bar),
+                                    pci_resource_len(pdev, bar));
+}
+EXPORT_SYMBOL_GPL(pci_ioremap_bar);
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
+
index 5d88e37fd7123e89a0d7c8579a50d368b015de7b..6481f9d93c9e790d368d4765ba6b8463b18ac286 100644 (file)
@@ -246,3 +246,92 @@ index a0c860f..9c6f214 100644
        }
  
        return sent;
+--- a/drivers/net/b44.c
++++ b/drivers/net/b44.c
+@@ -846,6 +846,9 @@ static int b44_rx(struct b44 *bp, int budget)
+ static int b44_poll(struct napi_struct *napi, int budget)
+ {
+       struct b44 *bp = container_of(napi, struct b44, napi);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++      struct net_device *netdev = bp->dev;
++#endif
+       int work_done;
+       spin_lock_irq(&bp->lock);
+@@ -874,7 +877,11 @@ static int b44_poll(struct napi_struct *napi, int budget)
+       }
+       if (work_done < budget) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++              netif_rx_complete(netdev, napi);
++#else
+               netif_rx_complete(napi);
++#endif
+               b44_enable_ints(bp);
+       }
+@@ -906,13 +913,21 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id)
+                       goto irq_ack;
+               }
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++              if (netif_rx_schedule_prep(dev, &bp->napi)) {
++#else
+               if (netif_rx_schedule_prep(&bp->napi)) {
++#endif
+                       /* NOTE: These writes are posted by the readback of
+                        *       the ISTAT register below.
+                        */
+                       bp->istat = istat;
+                       __b44_disable_ints(bp);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++                      __netif_rx_schedule(dev, &bp->napi);
++#else
+                       __netif_rx_schedule(&bp->napi);
++#endif
+               } else {
+                       printk(KERN_ERR PFX "%s: Error, poll already scheduled\n",
+                              dev->name);
+@@ -2108,6 +2123,7 @@ static int __devinit b44_get_invariants(struct b44 *bp)
+       return err;
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ static const struct net_device_ops b44_netdev_ops = {
+       .ndo_open               = b44_open,
+       .ndo_stop               = b44_close,
+@@ -2123,6 +2139,7 @@ static const struct net_device_ops b44_netdev_ops = {
+       .ndo_poll_controller    = b44_poll_controller,
+ #endif
+ };
++#endif
+ static int __devinit b44_init_one(struct ssb_device *sdev,
+                                 const struct ssb_device_id *ent)
+@@ -2161,9 +2178,26 @@ static int __devinit b44_init_one(struct ssb_device *sdev,
+       bp->rx_pending = B44_DEF_RX_RING_PENDING;
+       bp->tx_pending = B44_DEF_TX_RING_PENDING;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++      dev->open = b44_open;
++      dev->stop = b44_close;
++      dev->hard_start_xmit = b44_start_xmit;
++      dev->get_stats = b44_get_stats;
++      dev->set_multicast_list = b44_set_rx_mode;
++      dev->set_mac_address = b44_set_mac_addr;
++      dev->do_ioctl = b44_ioctl;
++      dev->tx_timeout = b44_tx_timeout;
++      netif_napi_add(dev, &bp->napi, b44_poll, 64);
++      dev->watchdog_timeo = B44_TX_TIMEOUT;
++#ifdef CONFIG_NET_POLL_CONTROLLER
++      dev->poll_controller = b44_poll_controller;
++#endif
++      dev->change_mtu = b44_change_mtu;
++#else
+       dev->netdev_ops = &b44_netdev_ops;
+       netif_napi_add(dev, &bp->napi, b44_poll, 64);
+       dev->watchdog_timeo = B44_TX_TIMEOUT;
++#endif
+       dev->irq = sdev->irq;
+       SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
index 0926df6c86d15f5ef73f392db97b15480e0ad5a4..876c318c58cb8526986b5aa90c135f1fe157ff9b 100644 (file)
 #endif
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
+
+#include <linux/pci.h>
+
+void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
+
 #endif /* LINUX_26_COMPAT_H */