usb: dwc3: Fix warnings on 64-bit builds
Subsystems (2)
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
Change aritmentics to use 64bit types to be compatible with 64bit builds.
---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)
drivers/usb/dwc3/core.c +4 -3
@@ -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 *)(uintptr_t )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 *)(uintptr_t )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 *)(uintptr_t )(dwc3_dev->base + +DWC3_GLOBALS_REGS_START );/* default to highest possible threshold */ lpm_nyet_threshold =0xff ;
drivers/usb/dwc3/ep0.c +5 -5
@@ -81,8 +81,8 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, trb->ctrl |= (DWC3_TRB_CTRL_IOC |DWC3_TRB_CTRL_LST ); -dwc3_flush_cache ((int )buf_dma, len); -dwc3_flush_cache ((int )trb,sizeof (*trb)); +dwc3_flush_cache ((long )buf_dma, len); +dwc3_flush_cache ((long )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 ((long )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 ((long )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 ((long )dwc->ep0_bounce,DWC3_EP0_BOUNCE_SIZE );memcpy (buf, dwc->ep0_bounce, transferred); }else { transferred = ur->length - length;
drivers/usb/dwc3/gadget.c +5 -5
@@ -244,7 +244,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,list_del (&req->list); req->trb =NULL ; -dwc3_flush_cache ((int )req->request.dma, req->request.length); +dwc3_flush_cache ((long )req->request.dma, req->request.length);if (req->request.status == -EINPROGRESS ) req->request.status = status;
@@ -771,8 +771,8 @@ 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 ((long )dma, length); +dwc3_flush_cache ((long )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 ((long )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 ((long )evt->buf, evt->length); }dwc3_thread_interrupt (0 , dwc);
drivers/usb/dwc3/io.h +2 -2
@@ -23,7 +23,7 @@#define CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZEstatic inline u32 dwc3_readl (void __iomem *base,u32 offset) { -u32 offs = offset -DWC3_GLOBALS_REGS_START ; +unsigned long offs = offset -DWC3_GLOBALS_REGS_START ;u32 value;/*
@@ -38,7 +38,7 @@ static inline u32 dwc3_readl(void __iomem *base, u32 offset)static inline void dwc3_writel (void __iomem *base,u32 offset,u32 value) { -u32 offs = offset -DWC3_GLOBALS_REGS_START ; +unsigned long offs = offset -DWC3_GLOBALS_REGS_START ;/* * We requested the mem region starting from the Globals address
Signature · 1 line
2.5.0
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
Quoted 17 lines · Michal Simek
Change aritmentics to use 64bit types to be compatible with 64bit builds.
Signed-off-by Michal Simek <[email protected]>---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)drivers/usb/dwc3/core.c +0
-0
drivers/usb/dwc3/core.c static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) · line 284
Quoted 5 lines
drivers/usb/dwc3/core.c +1
-1@@ -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 *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch *
Is this double type-cast necessary ?
drivers/usb/dwc3/core.c static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) · line 287
Quoted 3 lines
drivers/usb/dwc3/core.c +0
-0DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); err0:
[...]
Best regards,
Marek Vasut
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
Quoted 20 lines · Marek Vasut
Quoted 19 lines · Michal Simek
Change aritmentics to use 64bit types to be compatible with 64bit builds.
Signed-off-by Michal Simek <[email protected]>---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)drivers/usb/dwc3/core.c +0
-0@@ -281,7 +281,7 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)return 0 ;
Quoted 5 lines
drivers/usb/dwc3/core.c static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) · line 284
Quoted 3 lines
drivers/usb/dwc3/core.c +1
-1err1: - dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch * + dma_unmap_single((void *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch *Is this double type-cast necessary ?
Do you know better way how to do it?
Thanks,
Michal
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
Quoted 23 lines · Michal Simek
Quoted 22 lines · Marek Vasut
Quoted 21 lines · Michal Simek
Change aritmentics to use 64bit types to be compatible with 64bit builds.
Signed-off-by Michal Simek <[email protected]>---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)drivers/usb/dwc3/core.c +0
-0@@ -281,7 +281,7 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)return 0 ;
Quoted 8 lines
Quoted 6 lines
drivers/usb/dwc3/core.c static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
Quoted 4 lines
drivers/usb/dwc3/core.c +1
-1err1: - dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch * + dma_unmap_single((void *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch *Is this double type-cast necessary ?
Do you know better way how to do it?
I guess I don't, sorry.
Best regards,
Marek Vasut
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
Quoted 31 lines · Marek Vasut
Quoted 30 lines · Michal Simek
Quoted 28 lines · Marek Vasut
Quoted 17 lines · Michal Simek
Change aritmentics to use 64bit types to be compatible with 64bit builds.
Signed-off-by Michal Simek <[email protected]>---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)drivers/usb/dwc3/core.c +0
-0drivers/usb/dwc3/core.c static int dwc3_setup_scratch_buffers(struct dwc3 · line 287
Quoted 8 lines
drivers/usb/dwc3/core.c +1
-1@@ -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 *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch *Is this double type-cast necessary ?
Quoted 3 lines
Quoted 1 line
Do you know better way how to do it?
I guess I don't, sorry.
ok. Then can you please apply it?
Thanks,
Michal
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
Quoted 32 lines · Michal Simek
Quoted 31 lines · Marek Vasut
Quoted 30 lines · Michal Simek
Quoted 28 lines · Marek Vasut
Quoted 24 lines · Michal Simek
Change aritmentics to use 64bit types to be compatible with 64bit builds.
Signed-off-by Michal Simek <[email protected]>---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)drivers/usb/dwc3/core.c +1
-1@@ -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 *)(uintptr_t)dwc->scratch_addr,Quoted 1 line
dwc->nr_scratch*Is this double type-cast necessary ?
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Do you know better way how to do it?
I guess I don't, sorry.
ok. Then can you please apply it?
Applied all three.
Best regards,
Marek Vasut
PATCH 1/1 usb: dwc3: Fix warnings on 64-bit builds
In reply to Michal SimekHi Michal,
Quoted 152 lines
Change aritmentics to use 64bit types to be compatible with 64bit builds.
Signed-off-by Michal Simek <[email protected]>---
drivers/usb/dwc3/core.c | 7 ++++--- drivers/usb/dwc3/ep0.c | 10 +++++----- drivers/usb/dwc3/gadget.c | 10 +++++----- drivers/usb/dwc3/io.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-)drivers/usb/dwc3/core.c +4
-3@@ -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 *)(uintptr_t )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 *)(uintptr_t )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 *)(uintptr_t )(dwc3_dev->base + +DWC3_GLOBALS_REGS_START );/* default to highest possible threshold */ drivers/usb/dwc3/core.c +0
-0lpm_nyet_threshold =0xff ;drivers/usb/dwc3/ep0.c +0
-0@@ -81,8 +81,8 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc,u8 epnum,
dma_addr_tbuf_dma,trb->ctrl|= (DWC3_TRB_CTRL_IOCdrivers/usb/dwc3/ep0.c +5
-5| DWC3_TRB_CTRL_LST); -dwc3_flush_cache ((int )buf_dma, len); -dwc3_flush_cache ((int )trb,sizeof (*trb)); +dwc3_flush_cache ((long )buf_dma, len); +dwc3_flush_cache ((long )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 ((long )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 ((long )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 ((long )dwc->ep0_bounce,DWC3_EP0_BOUNCE_SIZE );memcpy (buf, dwc->ep0_bounce, transferred); }else {drivers/usb/dwc3/ep0.c +0
-0transferred = ur->length - length;drivers/usb/dwc3/gadget.c +5
-5@@ -244,7 +244,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep,struct dwc3_request *req, list_del(&req->list); req->trb =NULL ; -dwc3_flush_cache ((int )req->request.dma, req->request.length); +dwc3_flush_cache ((long )req->request.dma, req->request.length);if (req->request.status == -EINPROGRESS ) req->request.status = status;@@ -771,8 +771,8 @@ 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 ((long )dma, length); +dwc3_flush_cache ((long )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 ((long )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 ((long )evt->buf, evt->length); }dwc3_thread_interrupt (0 , dwc);drivers/usb/dwc3/io.h +0
-0@@ -23,7 +23,7 @@#define CACHELINE_SIZE
CONFIG_SYS_CACHELINE_SIZEstatic inline u32dwc3_readl(void __iomem *base, u32 offset){drivers/usb/dwc3/io.h +2
-2-u32 offs = offset -DWC3_GLOBALS_REGS_START ; +unsigned long offs = offset -DWC3_GLOBALS_REGS_START ;u32 value;/* @@ -38,7 +38,7 @@ static inline u32 dwc3_readl(void __iomem *base, u32 offset)static inline void dwc3_writel (void __iomem *base,u32 offset,u32 value) { -u32 offs = offset -DWC3_GLOBALS_REGS_START ; +unsigned long offs = offset -DWC3_GLOBALS_REGS_START ;/* * We requested the mem region starting from the Globals
Quoted 1 line
address
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group