rt2x00: Merge PCI and USB versions of write_tx_data into single function.
authorGertjan van Wingerde <gwingerde@gmail.com>
Tue, 29 Jun 2010 19:41:05 +0000 (21:41 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 30 Jun 2010 19:00:50 +0000 (15:00 -0400)
Now that rt2x00pci_write_tx_data and rt2x00usb_write_tx_data are similar
we can merge them in a single function in rt2x00queue.c.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 files changed:
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00pci.h
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 1eb882e15fb454c325a0b5772408456527dc9aba..1ad3596cb41e13fd91e1fc00668c50cef335a946 100644 (file)
@@ -1588,7 +1588,6 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
        .reset_tuner            = rt2400pci_reset_tuner,
        .link_tuner             = rt2400pci_link_tuner,
        .write_tx_desc          = rt2400pci_write_tx_desc,
-       .write_tx_data          = rt2x00pci_write_tx_data,
        .write_beacon           = rt2400pci_write_beacon,
        .kick_tx_queue          = rt2400pci_kick_tx_queue,
        .kill_tx_queue          = rt2400pci_kill_tx_queue,
index a29cb212f89ad61819ce2fd2d19c468add0b8428..2771ae707a3414bcd07ae640e71c13dd0cb2ada3 100644 (file)
@@ -1886,7 +1886,6 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
        .reset_tuner            = rt2500pci_reset_tuner,
        .link_tuner             = rt2500pci_link_tuner,
        .write_tx_desc          = rt2500pci_write_tx_desc,
-       .write_tx_data          = rt2x00pci_write_tx_data,
        .write_beacon           = rt2500pci_write_beacon,
        .kick_tx_queue          = rt2500pci_kick_tx_queue,
        .kill_tx_queue          = rt2500pci_kill_tx_queue,
index 963238c890806dbd1fe1c297dd0ede71073ddcb9..44205526013f78ac10a46c9c76ab307a1d430711 100644 (file)
@@ -1779,7 +1779,6 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
        .link_stats             = rt2500usb_link_stats,
        .reset_tuner            = rt2500usb_reset_tuner,
        .write_tx_desc          = rt2500usb_write_tx_desc,
-       .write_tx_data          = rt2x00usb_write_tx_data,
        .write_beacon           = rt2500usb_write_beacon,
        .get_tx_data_len        = rt2500usb_get_tx_data_len,
        .kick_tx_queue          = rt2x00usb_kick_tx_queue,
index e5ea670a18db9c2576b0c90a8ff1d48fff1e1246..615a865351a22df92ca352d7961f985eec82d9b3 100644 (file)
@@ -1044,7 +1044,6 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
        .reset_tuner            = rt2800_reset_tuner,
        .link_tuner             = rt2800_link_tuner,
        .write_tx_desc          = rt2800pci_write_tx_desc,
-       .write_tx_data          = rt2x00pci_write_tx_data,
        .write_tx_datadesc      = rt2800pci_write_tx_datadesc,
        .write_beacon           = rt2800_write_beacon,
        .kick_tx_queue          = rt2800pci_kick_tx_queue,
index f18c12a19cc9a9d630ca3b0161b93f262ff401b0..6d4de6080040e6e63b450e1c1757f3eac1f5d533 100644 (file)
@@ -652,7 +652,6 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
        .reset_tuner            = rt2800_reset_tuner,
        .link_tuner             = rt2800_link_tuner,
        .write_tx_desc          = rt2800usb_write_tx_desc,
-       .write_tx_data          = rt2x00usb_write_tx_data,
        .write_beacon           = rt2800_write_beacon,
        .get_tx_data_len        = rt2800usb_get_tx_data_len,
        .kick_tx_queue          = rt2x00usb_kick_tx_queue,
index 10eaffd12b1b9faa387748b7e9392d9294f5861d..1c9ccc30b6a47a31e521f356677c69bad6420a0d 100644 (file)
@@ -60,49 +60,6 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
 }
 EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read);
 
-/*
- * TX data handlers.
- */
-int rt2x00pci_write_tx_data(struct queue_entry *entry,
-                           struct txentry_desc *txdesc)
-{
-       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-
-       /*
-        * This should not happen, we already checked the entry
-        * was ours. When the hardware disagrees there has been
-        * a queue corruption!
-        */
-       if (unlikely(rt2x00dev->ops->lib->get_entry_state(entry))) {
-               ERROR(rt2x00dev,
-                     "Corrupt queue %d, accessing entry which is not ours.\n"
-                     "Please file bug report to %s.\n",
-                     entry->queue->qid, DRV_PROJECT);
-               return -EINVAL;
-       }
-
-       /*
-        * Add the requested extra tx headroom in front of the skb.
-        */
-       skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom);
-       memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom);
-
-       /*
-        * Call the driver's write_tx_datadesc function, if it exists.
-        */
-       if (rt2x00dev->ops->lib->write_tx_datadesc)
-               rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
-
-       /*
-        * Map the skb to DMA.
-        */
-       if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
-               rt2x00queue_map_txskb(rt2x00dev, entry->skb);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data);
-
 /*
  * TX/RX data handlers.
  */
index 00528b8a754daf166f084c7d676fdf9ee1ab5b7c..2dca18532f2ecc479f1ef86e9ba05a0179f286e7 100644 (file)
@@ -85,16 +85,6 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
                           const struct rt2x00_field32 field,
                           u32 *reg);
 
-/**
- * rt2x00pci_write_tx_data - Initialize data for TX operation
- * @entry: The entry where the frame is located
- *
- * This function will initialize the DMA and skb descriptor
- * to prepare the entry for the actual TX operation.
- */
-int rt2x00pci_write_tx_data(struct queue_entry *entry,
-                           struct txentry_desc *txdesc);
-
 /**
  * struct queue_entry_priv_pci: Per entry PCI specific information
  *
index f9163714711638b09aad259ed581cb1e45909ce3..b9cc253cf96273b7bbccab95b874b95ccfb7b57b 100644 (file)
@@ -404,6 +404,46 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
        rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
 }
 
+static int rt2x00queue_write_tx_data(struct queue_entry *entry,
+                                    struct txentry_desc *txdesc)
+{
+       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
+
+       /*
+        * This should not happen, we already checked the entry
+        * was ours. When the hardware disagrees there has been
+        * a queue corruption!
+        */
+       if (unlikely(rt2x00dev->ops->lib->get_entry_state &&
+                    rt2x00dev->ops->lib->get_entry_state(entry))) {
+               ERROR(rt2x00dev,
+                     "Corrupt queue %d, accessing entry which is not ours.\n"
+                     "Please file bug report to %s.\n",
+                     entry->queue->qid, DRV_PROJECT);
+               return -EINVAL;
+       }
+
+       /*
+        * Add the requested extra tx headroom in front of the skb.
+        */
+       skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom);
+       memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom);
+
+       /*
+        * Call the driver's write_tx_datadesc function, if it exists.
+        */
+       if (rt2x00dev->ops->lib->write_tx_datadesc)
+               rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
+
+       /*
+        * Map the skb to DMA.
+        */
+       if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+               rt2x00queue_map_txskb(rt2x00dev, entry->skb);
+
+       return 0;
+}
+
 static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
                                            struct txentry_desc *txdesc)
 {
@@ -515,8 +555,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
         * call failed. Since we always return NETDEV_TX_OK to mac80211,
         * this frame will simply be dropped.
         */
-       if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry,
-                                                              &txdesc))) {
+       if (unlikely(rt2x00queue_write_tx_data(entry, &txdesc))) {
                clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
                entry->skb = NULL;
                return -EIO;
index 1c91812df1739c9ec76a06c1bdd3b04f76a61b6d..f78ebb4d8cf19b03588a5f5fd556443ecdb440bc 100644 (file)
@@ -207,27 +207,6 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
        rt2x00lib_txdone(entry, &txdesc);
 }
 
-int rt2x00usb_write_tx_data(struct queue_entry *entry,
-                           struct txentry_desc *txdesc)
-{
-       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-
-       /*
-        * Add the descriptor in front of the skb.
-        */
-       skb_push(entry->skb, entry->queue->desc_size);
-       memset(entry->skb->data, 0, entry->queue->desc_size);
-
-       /*
-        * Call the driver's write_tx_datadesc function, if it exists.
-        */
-       if (rt2x00dev->ops->lib->write_tx_datadesc)
-               rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data);
-
 static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
index 255b81ef95308ff16a145b57d7b49af72eb2a7de..2b7a1889e72f75dcaaa8e885ef0ad09d60e08283 100644 (file)
@@ -350,16 +350,6 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
  */
 void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev);
 
-/**
- * rt2x00usb_write_tx_data - Initialize URB for TX operation
- * @entry: The entry where the frame is located
- *
- * This function will initialize the URB and skb descriptor
- * to prepare the entry for the actual TX operation.
- */
-int rt2x00usb_write_tx_data(struct queue_entry *entry,
-                           struct txentry_desc *txdesc);
-
 /**
  * struct queue_entry_priv_usb: Per entry USB specific information
  *
index 7ca383478eeb9a24d8d15d87968ec325619b7f4f..cb6e20a1046e1e32047e8d2159abf91fe85e9ab9 100644 (file)
@@ -2800,7 +2800,6 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
        .reset_tuner            = rt61pci_reset_tuner,
        .link_tuner             = rt61pci_link_tuner,
        .write_tx_desc          = rt61pci_write_tx_desc,
-       .write_tx_data          = rt2x00pci_write_tx_data,
        .write_beacon           = rt61pci_write_beacon,
        .kick_tx_queue          = rt61pci_kick_tx_queue,
        .kill_tx_queue          = rt61pci_kill_tx_queue,
index d06d90f003e742453a1076498a12733231c70b16..286dd97e51d89c6beaaecdbd0689b95133618970 100644 (file)
@@ -2249,7 +2249,6 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
        .reset_tuner            = rt73usb_reset_tuner,
        .link_tuner             = rt73usb_link_tuner,
        .write_tx_desc          = rt73usb_write_tx_desc,
-       .write_tx_data          = rt2x00usb_write_tx_data,
        .write_beacon           = rt73usb_write_beacon,
        .get_tx_data_len        = rt73usb_get_tx_data_len,
        .kick_tx_queue          = rt2x00usb_kick_tx_queue,