Skip to content

Commit 266439c

Browse files
tndavedavem330
authored andcommitted
sunqe: Fix compiler warnings
sunqe uses '__u32' for dma handle while invoking kernel DMA APIs, instead of using dma_addr_t. This hasn't caused any 'incompatible pointer type' warning on SPARC because until now dma_addr_t is of type u32. However, recent changes in SPARC ATU (iommu) enables 64bit DMA and therefore dma_addr_t becomes of type u64. This makes 'incompatible pointer type' warnings inevitable. e.g. drivers/net/ethernet/sun/sunqe.c: In function ‘qec_ether_init’: drivers/net/ethernet/sun/sunqe.c:883: warning: passing argument 3 of ‘dma_alloc_coherent’ from incompatible pointer type ./include/linux/dma-mapping.h:445: note: expected ‘dma_addr_t *’ but argument is of type ‘__u32 *’ drivers/net/ethernet/sun/sunqe.c:885: warning: passing argument 3 of ‘dma_alloc_coherent’ from incompatible pointer type ./include/linux/dma-mapping.h:445: note: expected ‘dma_addr_t *’ but argument is of type ‘__u32 *’ This patch resolves above compiler warnings. Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com> Reviewed-by: chris hyser <chris.hyser@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 49cc0c4 commit 266439c

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

drivers/net/ethernet/sun/sunqe.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void qe_init_rings(struct sunqe *qep)
124124
{
125125
struct qe_init_block *qb = qep->qe_block;
126126
struct sunqe_buffers *qbufs = qep->buffers;
127-
__u32 qbufs_dvma = qep->buffers_dvma;
127+
__u32 qbufs_dvma = (__u32)qep->buffers_dvma;
128128
int i;
129129

130130
qep->rx_new = qep->rx_old = qep->tx_new = qep->tx_old = 0;
@@ -144,6 +144,7 @@ static int qe_init(struct sunqe *qep, int from_irq)
144144
void __iomem *mregs = qep->mregs;
145145
void __iomem *gregs = qecp->gregs;
146146
unsigned char *e = &qep->dev->dev_addr[0];
147+
__u32 qblk_dvma = (__u32)qep->qblock_dvma;
147148
u32 tmp;
148149
int i;
149150

@@ -152,8 +153,8 @@ static int qe_init(struct sunqe *qep, int from_irq)
152153
return -EAGAIN;
153154

154155
/* Setup initial rx/tx init block pointers. */
155-
sbus_writel(qep->qblock_dvma + qib_offset(qe_rxd, 0), cregs + CREG_RXDS);
156-
sbus_writel(qep->qblock_dvma + qib_offset(qe_txd, 0), cregs + CREG_TXDS);
156+
sbus_writel(qblk_dvma + qib_offset(qe_rxd, 0), cregs + CREG_RXDS);
157+
sbus_writel(qblk_dvma + qib_offset(qe_txd, 0), cregs + CREG_TXDS);
157158

158159
/* Enable/mask the various irq's. */
159160
sbus_writel(0, cregs + CREG_RIMASK);
@@ -413,7 +414,7 @@ static void qe_rx(struct sunqe *qep)
413414
struct net_device *dev = qep->dev;
414415
struct qe_rxd *this;
415416
struct sunqe_buffers *qbufs = qep->buffers;
416-
__u32 qbufs_dvma = qep->buffers_dvma;
417+
__u32 qbufs_dvma = (__u32)qep->buffers_dvma;
417418
int elem = qep->rx_new;
418419
u32 flags;
419420

@@ -572,7 +573,7 @@ static int qe_start_xmit(struct sk_buff *skb, struct net_device *dev)
572573
{
573574
struct sunqe *qep = netdev_priv(dev);
574575
struct sunqe_buffers *qbufs = qep->buffers;
575-
__u32 txbuf_dvma, qbufs_dvma = qep->buffers_dvma;
576+
__u32 txbuf_dvma, qbufs_dvma = (__u32)qep->buffers_dvma;
576577
unsigned char *txbuf;
577578
int len, entry;
578579

drivers/net/ethernet/sun/sunqe.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ struct sunqe {
334334
void __iomem *qcregs; /* QEC per-channel Registers */
335335
void __iomem *mregs; /* Per-channel MACE Registers */
336336
struct qe_init_block *qe_block; /* RX and TX descriptors */
337-
__u32 qblock_dvma; /* RX and TX descriptors */
337+
dma_addr_t qblock_dvma; /* RX and TX descriptors */
338338
spinlock_t lock; /* Protects txfull state */
339339
int rx_new, rx_old; /* RX ring extents */
340340
int tx_new, tx_old; /* TX ring extents */
341341
struct sunqe_buffers *buffers; /* CPU visible address. */
342-
__u32 buffers_dvma; /* DVMA visible address. */
342+
dma_addr_t buffers_dvma; /* DVMA visible address. */
343343
struct sunqec *parent;
344344
u8 mconfig; /* Base MACE mconfig value */
345345
struct platform_device *op; /* QE's OF device struct */

0 commit comments

Comments
 (0)