cxgb4: clean up a type issue
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 8 Oct 2014 13:44:34 +0000 (16:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Oct 2014 20:08:04 +0000 (16:08 -0400)
The tx_desc struct holds 8 __be64 values.  The original code in
ring_tx_db() took a tx_desc pointer then casted it to an int pointer and
then casted it to a u64 pointer.  It was confusing and triggered some
static checker warnings.

I have changed the cxgb_pio_copy() function to only take tx_desc
pointers.  This isn't really a loss of flexibility because anything else
was buggy to begin with.

I also removed the casting on the destination pointer since that was
unnecessary and a bit messy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/sge.c

index e8e90ce3ae159f4ffef0a77c37d7b1057d43574f..fab4c84a1da4c5fa8313f6c133613c245b7846be 100644 (file)
@@ -850,13 +850,14 @@ static void write_sgl(const struct sk_buff *skb, struct sge_txq *q,
                *end = 0;
 }
 
-/* This function copies 64 byte coalesced work request to
- * memory mapped BAR2 space(user space writes).
- * For coalesced WR SGE, fetches data from the FIFO instead of from Host.
+/* This function copies a tx_desc struct to memory mapped BAR2 space(user space
+ * writes). For coalesced WR SGE, fetches data from the FIFO instead of from
+ * Host.
  */
-static void cxgb_pio_copy(u64 __iomem *dst, u64 *src)
+static void cxgb_pio_copy(u64 __iomem *dst, struct tx_desc *desc)
 {
-       int count = 8;
+       int count = sizeof(*desc) / sizeof(u64);
+       u64 *src = (u64 *)desc;
 
        while (count) {
                writeq(*src, dst);
@@ -914,12 +915,9 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n)
                        int index = (q->pidx
                                     ? (q->pidx - 1)
                                     : (q->size - 1));
-                       unsigned int *wr = (unsigned int *)&q->desc[index];
 
-                       cxgb_pio_copy((u64 __iomem *)
-                                     (adap->bar2 + q->udb +
-                                      SGE_UDB_WCDOORBELL),
-                                     (u64 *)wr);
+                       cxgb_pio_copy(adap->bar2 + q->udb + SGE_UDB_WCDOORBELL,
+                                     q->desc + index);
                } else {
                        writel(val,  adap->bar2 + q->udb + SGE_UDB_KDOORBELL);
                }