[U-Boot] [PATCH 5/5] driver: USB: Fix pointer conversion warnings for xilinx_zynqmp_ep
Prabhakar Kushwaha
prabhakar at freescale.com
Sun Oct 25 08:49:07 CET 2015
Fix below warnings happening for xilinx_zynqmp_ep_defconfig
drivers/usb/dwc3/core.c: In function ‘dwc3_setup_scratch_buffers’:
drivers/usb/dwc3/core.c:284:19: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch *
^
drivers/usb/dwc3/core.c: In function ‘dwc3_free_scratch_buffers’:
drivers/usb/dwc3/core.c:299:19: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch *
^
drivers/usb/dwc3/core.c: In function ‘dwc3_uboot_init’:
drivers/usb/dwc3/core.c:632:14: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
dwc->regs = (int *)(dwc3_dev->base + DWC3_GLOBALS_REGS_START);
^
drivers/usb/gadget/udc/udc-core.c: In function ‘usb_gadget_unmap_request’:
drivers/usb/gadget/udc/udc-core.c:68:19: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
dma_unmap_single((void *)req->dma, req->length,
^
drivers/usb/dwc3/gadget.c: In function ‘dwc3_prepare_one_trb’:
drivers/usb/dwc3/gadget.c:775:19: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)trb, sizeof(*trb));
^
drivers/usb/dwc3/gadget.c: In function ‘dwc3_cleanup_done_reqs’:
drivers/usb/dwc3/gadget.c:1772:19: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)trb, sizeof(*trb));
^
drivers/usb/dwc3/gadget.c: In function ‘dwc3_gadget_uboot_handle_interrupt’:
drivers/usb/dwc3/gadget.c:2673:21: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)evt->buf, evt->length);
^
drivers/usb/dwc3/ep0.c: In function ‘dwc3_ep0_start_trans’:
drivers/usb/dwc3/ep0.c:85:19: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)trb, sizeof(*trb));
^
drivers/usb/dwc3/ep0.c: In function ‘dwc3_ep0_complete_data’:
drivers/usb/dwc3/ep0.c:793:19: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)trb, sizeof(*trb));
^
drivers/usb/dwc3/ep0.c:824:21: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)trb, sizeof(*trb));
^
drivers/usb/dwc3/ep0.c:834:20: warning: cast from pointer to integer
of different size [-Wpointer-to-int-cast]
dwc3_flush_cache((int)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
^
drivers/usb/gadget/f_thor.c: In function ‘thor_tx_data’:
drivers/usb/gadget/f_thor.c:572:2: warning: format ‘%d’ expects argument of
type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
debug("%s: dev->in_req->length:%d to_cpy:%d\n", __func__,
Signed-off-by: Prabhakar Kushwaha <prabhakar at freescale.com>
---
drivers/usb/dwc3/core.c | 7 ++++---
drivers/usb/dwc3/ep0.c | 8 ++++----
drivers/usb/dwc3/gadget.c | 6 +++---
drivers/usb/gadget/f_thor.c | 2 +-
drivers/usb/gadget/udc/udc-core.c | 2 +-
5 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index ab3c94e..610bbc4 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -281,7 +281,7 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
return 0;
err1:
- dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch *
+ dma_unmap_single((void *)(ulong)dwc->scratch_addr, dwc->nr_scratch *
DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
err0:
@@ -296,7 +296,7 @@ static void dwc3_free_scratch_buffers(struct dwc3 *dwc)
if (!dwc->nr_scratch)
return;
- dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch *
+ dma_unmap_single((void *)(ulong)dwc->scratch_addr, dwc->nr_scratch *
DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
kfree(dwc->scratchbuf);
}
@@ -629,7 +629,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1);
dwc->mem = mem;
- dwc->regs = (int *)(dwc3_dev->base + DWC3_GLOBALS_REGS_START);
+ dwc->regs = (void __iomem *)(ulong)(dwc3_dev->base +
+ DWC3_GLOBALS_REGS_START);
/* default to highest possible threshold */
lpm_nyet_threshold = 0xff;
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index aba614f..d583d89 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -82,7 +82,7 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
| DWC3_TRB_CTRL_LST);
dwc3_flush_cache((int)buf_dma, len);
- dwc3_flush_cache((int)trb, sizeof(*trb));
+ dwc3_flush_cache((ulong)trb, sizeof(*trb));
if (chain)
return 0;
@@ -790,7 +790,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
if (!r)
return;
- dwc3_flush_cache((int)trb, sizeof(*trb));
+ dwc3_flush_cache((ulong)trb, sizeof(*trb));
status = DWC3_TRB_SIZE_TRBSTS(trb->size);
if (status == DWC3_TRBSTS_SETUP_PENDING) {
@@ -821,7 +821,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
ur->actual += transferred;
trb++;
- dwc3_flush_cache((int)trb, sizeof(*trb));
+ dwc3_flush_cache((ulong)trb, sizeof(*trb));
length = trb->size & DWC3_TRB_SIZE_MASK;
ep0->free_slot = 0;
@@ -831,7 +831,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
maxp);
transferred = min_t(u32, ur->length - transferred,
transfer_size - length);
- dwc3_flush_cache((int)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
+ dwc3_flush_cache((ulong)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
memcpy(buf, dwc->ep0_bounce, transferred);
} else {
transferred = ur->length - length;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index f3d649a..e6a9a5f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -772,7 +772,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
trb->ctrl |= DWC3_TRB_CTRL_HWO;
dwc3_flush_cache((int)dma, length);
- dwc3_flush_cache((int)trb, sizeof(*trb));
+ dwc3_flush_cache((ulong)trb, sizeof(*trb));
}
/*
@@ -1769,7 +1769,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
slot %= DWC3_TRB_NUM;
trb = &dep->trb_pool[slot];
- dwc3_flush_cache((int)trb, sizeof(*trb));
+ dwc3_flush_cache((ulong)trb, sizeof(*trb));
__dwc3_cleanup_done_trbs(dwc, dep, req, trb, event, status);
dwc3_gadget_giveback(dep, req, status);
@@ -2670,7 +2670,7 @@ void dwc3_gadget_uboot_handle_interrupt(struct dwc3 *dwc)
for (i = 0; i < dwc->num_event_buffers; i++) {
evt = dwc->ev_buffs[i];
- dwc3_flush_cache((int)evt->buf, evt->length);
+ dwc3_flush_cache((ulong)evt->buf, evt->length);
}
dwc3_thread_interrupt(0, dwc);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index ff1481b..9493cb9 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -570,7 +570,7 @@ static void thor_tx_data(unsigned char *data, int len)
dev->in_req->length = len;
debug("%s: dev->in_req->length:%d to_cpy:%d\n", __func__,
- dev->in_req->length, sizeof(data));
+ dev->in_req->length, (int)sizeof(data));
status = usb_ep_queue(dev->in_ep, dev->in_req, 0);
if (status) {
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index 875e998..01bdfbc 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -65,7 +65,7 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
if (req->length == 0)
return;
- dma_unmap_single((void *)req->dma, req->length,
+ dma_unmap_single((void *)(ulong)req->dma, req->length,
is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
}
EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
--
1.9.1
More information about the U-Boot
mailing list