]> err.no Git - linux-2.6/commitdiff
rt2x00: Remove data_desc structure
authorIvo van Doorn <IvDoorn@gmail.com>
Thu, 24 Jan 2008 08:48:03 +0000 (00:48 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:03:03 +0000 (15:03 -0800)
Coverty indicated that data_desc with a single
element array is bad coding style. This removes
the structure and forces everybody to use __le32.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 files changed:
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2400pci.h
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500pci.h
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2500usb.h
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00ring.h
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt61pci.h
drivers/net/wireless/rt2x00/rt73usb.c
drivers/net/wireless/rt2x00/rt73usb.h

index f2d0febbec491a105ffd8459223658cd6257c383..8889f6d18dce33dc15c5a1803ff7469292ce5a84 100644 (file)
@@ -600,7 +600,7 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
 static void rt2400pci_init_rxring(struct rt2x00_dev *rt2x00dev)
 {
        struct data_ring *ring = rt2x00dev->rx;
-       struct data_desc *rxd;
+       __le32 *rxd;
        unsigned int i;
        u32 word;
 
@@ -630,7 +630,7 @@ static void rt2400pci_init_rxring(struct rt2x00_dev *rt2x00dev)
 static void rt2400pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue)
 {
        struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue);
-       struct data_desc *txd;
+       __le32 *txd;
        unsigned int i;
        u32 word;
 
@@ -1017,7 +1017,7 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,
  * TX descriptor initialization
  */
 static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                                   struct data_desc *txd,
+                                   __le32 *txd,
                                    struct txdata_entry_desc *desc,
                                    struct ieee80211_hdr *ieee80211hdr,
                                    unsigned int length,
@@ -1117,7 +1117,7 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
 static void rt2400pci_fill_rxdone(struct data_entry *entry,
                                  struct rxdata_entry_desc *desc)
 {
-       struct data_desc *rxd = entry->priv;
+       __le32 *rxd = entry->priv;
        u32 word0;
        u32 word2;
 
@@ -1147,7 +1147,7 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue)
 {
        struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue);
        struct data_entry *entry;
-       struct data_desc *txd;
+       __le32 *txd;
        u32 word;
        int tx_status;
        int retry;
index ae22501f085d20ea42db5cc93160912ad037b9d1..f5dbde7b2015e72fcf461d5b29f74a87f63f6c2c 100644 (file)
 /*
  * DMA descriptor defines.
  */
-#define TXD_DESC_SIZE                  ( 8 * sizeof(struct data_desc) )
-#define RXD_DESC_SIZE                  ( 8 * sizeof(struct data_desc) )
+#define TXD_DESC_SIZE                  ( 8 * sizeof(__le32) )
+#define RXD_DESC_SIZE                  ( 8 * sizeof(__le32) )
 
 /*
  * TX descriptor format for TX, PRIO, ATIM and Beacon Ring.
index 3d02c0d297e8578523d7baa098a8e01f1bc7f4be..1dea9d800d4781f9710aea065f56d8a954382974 100644 (file)
@@ -691,7 +691,7 @@ dynamic_cca_tune:
 static void rt2500pci_init_rxring(struct rt2x00_dev *rt2x00dev)
 {
        struct data_ring *ring = rt2x00dev->rx;
-       struct data_desc *rxd;
+       __le32 *rxd;
        unsigned int i;
        u32 word;
 
@@ -716,7 +716,7 @@ static void rt2500pci_init_rxring(struct rt2x00_dev *rt2x00dev)
 static void rt2500pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue)
 {
        struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue);
-       struct data_desc *txd;
+       __le32 *txd;
        unsigned int i;
        u32 word;
 
@@ -1167,7 +1167,7 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
  * TX descriptor initialization
  */
 static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                                   struct data_desc *txd,
+                                   __le32 *txd,
                                    struct txdata_entry_desc *desc,
                                    struct ieee80211_hdr *ieee80211hdr,
                                    unsigned int length,
@@ -1251,7 +1251,7 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
 static void rt2500pci_fill_rxdone(struct data_entry *entry,
                                  struct rxdata_entry_desc *desc)
 {
-       struct data_desc *rxd = entry->priv;
+       __le32 *rxd = entry->priv;
        u32 word0;
        u32 word2;
 
@@ -1278,7 +1278,7 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue)
 {
        struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue);
        struct data_entry *entry;
-       struct data_desc *txd;
+       __le32 *txd;
        u32 word;
        int tx_status;
        int retry;
index d92aa56b2f4b01f54fcea7feec61ca347717341d..92ba0902d107254725cbb0b6c230b2e1acbc57f4 100644 (file)
 /*
  * DMA descriptor defines.
  */
-#define TXD_DESC_SIZE                  ( 11 * sizeof(struct data_desc) )
-#define RXD_DESC_SIZE                  ( 11 * sizeof(struct data_desc) )
+#define TXD_DESC_SIZE                  ( 11 * sizeof(__le32) )
+#define RXD_DESC_SIZE                  ( 11 * sizeof(__le32) )
 
 /*
  * TX descriptor format for TX, PRIO, ATIM and Beacon Ring.
index 164548fd22b7f8fa840d9fd3f97ae1503ceb8d30..c89103786b1cba8d7d607bb8228b47ce6e00e7ff 100644 (file)
@@ -990,7 +990,7 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,
  * TX descriptor initialization
  */
 static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                                   struct data_desc *txd,
+                                   __le32 *txd,
                                    struct txdata_entry_desc *desc,
                                    struct ieee80211_hdr *ieee80211hdr,
                                    unsigned int length,
@@ -1082,9 +1082,8 @@ static void rt2500usb_fill_rxdone(struct data_entry *entry,
                                  struct rxdata_entry_desc *desc)
 {
        struct urb *urb = entry->priv;
-       struct data_desc *rxd = (struct data_desc *)(entry->skb->data +
-                                                    (urb->actual_length -
-                                                     entry->ring->desc_size));
+       __le32 *rxd = (__le32 *)(entry->skb->data +
+                                (urb->actual_length - entry->ring->desc_size));
        u32 word0;
        u32 word1;
 
@@ -1682,7 +1681,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
        skb_push(skb, ring->desc_size);
        memset(skb->data, 0, ring->desc_size);
 
-       rt2x00lib_write_tx_desc(rt2x00dev, (struct data_desc *)skb->data,
+       rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data,
                                (struct ieee80211_hdr *)(skb->data +
                                                         ring->desc_size),
                                skb->len - ring->desc_size, control);
index 2741840fa14acbaeb9820c971e3e7c3285c27362..9e0433722e3d713baee398f2a63ca2777ee19522 100644 (file)
 /*
  * DMA descriptor defines.
  */
-#define TXD_DESC_SIZE                  ( 5 * sizeof(struct data_desc) )
-#define RXD_DESC_SIZE                  ( 4 * sizeof(struct data_desc) )
+#define TXD_DESC_SIZE                  ( 5 * sizeof(__le32) )
+#define RXD_DESC_SIZE                  ( 4 * sizeof(__le32) )
 
 /*
  * TX descriptor format for TX, PRIO, ATIM and Beacon Ring.
index d18cca89eede70a1cee1309b94412e60bcd0cc63..2cd2c9fab1a59915a3d928ea9a80af04c923a67d 100644 (file)
@@ -488,7 +488,7 @@ struct rt2x00lib_ops {
         * TX control handlers
         */
        void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev,
-                              struct data_desc *txd,
+                              __le32 *txd,
                               struct txdata_entry_desc *desc,
                               struct ieee80211_hdr *ieee80211hdr,
                               unsigned int length,
@@ -889,7 +889,7 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
  * TX descriptor initializer
  */
 void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                            struct data_desc *txd,
+                            __le32 *txd,
                             struct ieee80211_hdr *ieee80211hdr,
                             unsigned int length,
                             struct ieee80211_tx_control *control);
index 360f03ae17a5c5457ffd25ff07d290af2fcfd4ab..304830b8d16ddd9a2e63de1c81dbc78509183c33 100644 (file)
@@ -578,7 +578,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_rxdone);
  * TX descriptor initializer
  */
 void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                            struct data_desc *txd,
+                            __le32 *txd,
                             struct ieee80211_hdr *ieee80211hdr,
                             unsigned int length,
                             struct ieee80211_tx_control *control)
index 04663eb319504f53d31af8e8fc0dfa509a836570..fa85771cbf4738f6eda6299e8960475bb3f6f300 100644 (file)
@@ -80,7 +80,7 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
 {
        struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
        struct data_entry *entry = rt2x00_get_data_entry(ring);
-       struct data_desc *txd = entry->priv;
+       __le32 *txd = entry->priv;
        u32 word;
 
        if (rt2x00_ring_full(ring)) {
@@ -122,11 +122,11 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
 {
        struct data_ring *ring = rt2x00dev->rx;
        struct data_entry *entry;
-       struct data_desc *rxd;
        struct sk_buff *skb;
        struct ieee80211_hdr *hdr;
        struct rxdata_entry_desc desc;
        int header_size;
+       __le32 *rxd;
        int align;
        u32 word;
 
index 1a864d32cfbd2a9615169c87d7967d2877f95378..ee6c423a53d98a3a705f79089348788bf6bd5c5d 100644 (file)
 #ifndef RT2X00RING_H
 #define RT2X00RING_H
 
-/*
- * data_desc
- * Each data entry also contains a descriptor which is used by the
- * device to determine what should be done with the packet and
- * what the current status is.
- * This structure is greatly simplified, but the descriptors
- * are basically a list of little endian 32 bit values.
- * Make the array by default 1 word big, this will allow us
- * to use sizeof() correctly.
- */
-struct data_desc {
-       __le32 word[1];
-};
-
 /*
  * rxdata_entry_desc
  * Summary of information that has been read from the
@@ -253,16 +239,16 @@ static inline int rt2x00_ring_free(struct data_ring *ring)
 /*
  * TX/RX Descriptor access functions.
  */
-static inline void rt2x00_desc_read(struct data_desc *desc,
+static inline void rt2x00_desc_read(__le32 *desc,
                                    const u8 word, u32 *value)
 {
-       *value = le32_to_cpu(desc->word[word]);
+       *value = le32_to_cpu(desc[word]);
 }
 
-static inline void rt2x00_desc_write(struct data_desc *desc,
+static inline void rt2x00_desc_write(__le32 *desc,
                                     const u8 word, const u32 value)
 {
-       desc->word[word] = cpu_to_le32(value);
+       desc[word] = cpu_to_le32(value);
 }
 
 #endif /* RT2X00RING_H */
index d16f0a79d985987161d82099e27846209290a756..ab97b0600ec8b3ecd07ef07392b6d38189fe7885 100644 (file)
@@ -113,7 +113,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
        struct data_entry *entry = (struct data_entry *)urb->context;
        struct data_ring *ring = entry->ring;
        struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
-       struct data_desc *txd = (struct data_desc *)entry->skb->data;
+       __le32 *txd = (__le32 *)entry->skb->data;
        u32 word;
        int tx_status;
 
@@ -181,7 +181,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
        skb_push(skb, ring->desc_size);
        memset(skb->data, 0, ring->desc_size);
 
-       rt2x00lib_write_tx_desc(rt2x00dev, (struct data_desc *)skb->data,
+       rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data,
                                (struct ieee80211_hdr *)(skb->data +
                                                         ring->desc_size),
                                skb->len - ring->desc_size, control);
index a38a96230eca1fc410f8af5b6c57bc1bad39c164..f3c4cbe734ec22deb3b33428344da7fb9f322ff9 100644 (file)
@@ -996,7 +996,7 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,
 static void rt61pci_init_rxring(struct rt2x00_dev *rt2x00dev)
 {
        struct data_ring *ring = rt2x00dev->rx;
-       struct data_desc *rxd;
+       __le32 *rxd;
        unsigned int i;
        u32 word;
 
@@ -1021,7 +1021,7 @@ static void rt61pci_init_rxring(struct rt2x00_dev *rt2x00dev)
 static void rt61pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue)
 {
        struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue);
-       struct data_desc *txd;
+       __le32 *txd;
        unsigned int i;
        u32 word;
 
@@ -1535,7 +1535,7 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,
  * TX descriptor initialization
  */
 static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                                 struct data_desc *txd,
+                                 __le32 *txd,
                                  struct txdata_entry_desc *desc,
                                  struct ieee80211_hdr *ieee80211hdr,
                                  unsigned int length,
@@ -1679,7 +1679,7 @@ static int rt61pci_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
 static void rt61pci_fill_rxdone(struct data_entry *entry,
                                struct rxdata_entry_desc *desc)
 {
-       struct data_desc *rxd = entry->priv;
+       __le32 *rxd = entry->priv;
        u32 word0;
        u32 word1;
 
@@ -1709,7 +1709,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
        struct data_ring *ring;
        struct data_entry *entry;
        struct data_entry *entry_done;
-       struct data_desc *txd;
+       __le32 *txd;
        u32 word;
        u32 reg;
        u32 old_reg;
@@ -2455,7 +2455,7 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
        skb_push(skb, TXD_DESC_SIZE);
        memset(skb->data, 0, TXD_DESC_SIZE);
 
-       rt2x00lib_write_tx_desc(rt2x00dev, (struct data_desc *)skb->data,
+       rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data,
                                (struct ieee80211_hdr *)(skb->data +
                                                         TXD_DESC_SIZE),
                                skb->len - TXD_DESC_SIZE, control);
index 50d9f6aa62ed90e5e53aee504c26c21daf1c1626..4c6524eedad0d219ca6ed3bb8e1f7267cb6b1520 100644 (file)
@@ -1246,8 +1246,8 @@ struct hw_pairwise_ta_entry {
 /*
  * DMA descriptor defines.
  */
-#define TXD_DESC_SIZE                  ( 16 * sizeof(struct data_desc) )
-#define RXD_DESC_SIZE                  ( 16 * sizeof(struct data_desc) )
+#define TXD_DESC_SIZE                  ( 16 * sizeof(__le32) )
+#define RXD_DESC_SIZE                  ( 16 * sizeof(__le32) )
 
 /*
  * TX descriptor format for TX, PRIO and Beacon Ring.
index 0cc815000d620a9fecc19a9bb83ec0771e254d96..d89db266757c6c466877061f3dbe4193041ad642 100644 (file)
@@ -1203,7 +1203,7 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,
  * TX descriptor initialization
  */
 static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                                 struct data_desc *txd,
+                                 __le32 *txd,
                                  struct txdata_entry_desc *desc,
                                  struct ieee80211_hdr *ieee80211hdr,
                                  unsigned int length,
@@ -1350,7 +1350,7 @@ static int rt73usb_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1)
 static void rt73usb_fill_rxdone(struct data_entry *entry,
                                struct rxdata_entry_desc *desc)
 {
-       struct data_desc *rxd = (struct data_desc *)entry->skb->data;
+       __le32 *rxd = (__le32 *)entry->skb->data;
        u32 word0;
        u32 word1;
 
@@ -1953,7 +1953,7 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
        skb_push(skb, TXD_DESC_SIZE);
        memset(skb->data, 0, TXD_DESC_SIZE);
 
-       rt2x00lib_write_tx_desc(rt2x00dev, (struct data_desc *)skb->data,
+       rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data,
                                (struct ieee80211_hdr *)(skb->data +
                                                         TXD_DESC_SIZE),
                                skb->len - TXD_DESC_SIZE, control);
index b967df27886adda90d5ecee0c3c14a1c1435dcf7..d49dcaaceceec65066b7a816412969adb7063201 100644 (file)
@@ -866,8 +866,8 @@ struct hw_pairwise_ta_entry {
 /*
  * DMA descriptor defines.
  */
-#define TXD_DESC_SIZE                  ( 6 * sizeof(struct data_desc) )
-#define RXD_DESC_SIZE                  ( 6 * sizeof(struct data_desc) )
+#define TXD_DESC_SIZE                  ( 6 * sizeof(__le32) )
+#define RXD_DESC_SIZE                  ( 6 * sizeof(__le32) )
 
 /*
  * TX descriptor format for TX, PRIO and Beacon Ring.