Skip to contentSkip to conversation

usb: dwc2: make casts of ep->dma_buf consistent

PATCH New Tom Rini 3 participants 4 messages Feb 5, 2018 USB

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 usb: dwc2: make casts of ep->dma_buf consistent

In most places in the code we cast this to an unsigned long, but in one place we cast to an unsigned int. For consistency and to fix a warning on 64bit targets, always cast this to unsigned long. For the long term we should however change the declaration of dma_buf.

Cc Lukasz Majewski <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Philipp Tomsich <[email protected]>
---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +1 -1
index b6164afa9245..57dbbd5ebfa1 100644
@@ -114,7 +114,7 @@ static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req)
 				(unsigned long) ep->dma_buf +
 				ROUND(ep->len, CONFIG_SYS_CACHELINE_SIZE));
 
-	writel((unsigned int) ep->dma_buf, &reg->out_endp[ep_num].doepdma);
+	writel((unsigned long) ep->dma_buf, &reg->out_endp[ep_num].doepdma);
 	writel(DOEPT_SIZ_PKT_CNT(pktcnt) | DOEPT_SIZ_XFER_SIZE(length),
 	       &reg->out_endp[ep_num].doeptsiz);
 	writel(DEPCTL_EPENA|DEPCTL_CNAK|ctrl, &reg->out_endp[ep_num].doepctl);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 usb: dwc2: make casts of ep->dma_buf consistent

Quoted 19 lines · Tom Rini

In most places in the code we cast this to an unsigned long, but in one place we cast to an unsigned int. For consistency and to fix a warning on 64bit targets, always cast this to unsigned long. For the long term we should however change the declaration of dma_buf.

Cc Lukasz Majewski <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Philipp Tomsich <[email protected]>
---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +0 -0
index b6164afa9245..57dbbd5ebfa1 100644

drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req) · line 120

Quoted 8 lines
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +1 -1
@@ -114,7 +114,7 @@ static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req)
 				(unsigned long) ep->dma_buf +
 				ROUND(ep->len, CONFIG_SYS_CACHELINE_SIZE));
 
-	writel((unsigned int) ep->dma_buf, &reg->out_endp[ep_num].doepdma);
+	writel((unsigned long) ep->dma_buf, &reg->out_endp[ep_num].doepdma);
 	writel(DOEPT_SIZ_PKT_CNT(pktcnt) | DOEPT_SIZ_XFER_SIZE(length),
 	       &reg->out_endp[ep_num].doeptsiz);
 	writel(DEPCTL_EPENA|DEPCTL_CNAK|ctrl, &reg->out_endp[ep_num].doepctl);
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/1 usb: dwc2: make casts of ep->dma_buf consistent

In reply to Tom Rini
Quoted 24 lines · On Mon, 5 Feb 2018 09:54:51 -0500 Tom Rini <[email protected]> wrote:

In most places in the code we cast this to an unsigned long, but in one place we cast to an unsigned int. For consistency and to fix a warning on 64bit targets, always cast this to unsigned long. For the long term we should however change the declaration of dma_buf.

Cc Lukasz Majewski <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Philipp Tomsich <[email protected]>
---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c index b6164afa9245..57dbbd5ebfa1 100644 --- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c @@ -114,7 +114,7 @@ static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req) (unsigned long) ep->dma_buf + ROUND(ep->len, CONFIG_SYS_CACHELINE_SIZE));

(quoted diff) +0 -1
-	writel((unsigned int) ep->dma_buf,

&reg->out_endp[ep_num].doepdma);

(quoted diff) +1 -0
+	writel((unsigned long) ep->dma_buf,
Quoted 4 lines

&reg->out_endp[ep_num].doepdma); writel(DOEPT_SIZ_PKT_CNT(pktcnt) | DOEPT_SIZ_XFER_SIZE(length), &reg->out_endp[ep_num].doeptsiz);
writel(DEPCTL_EPENA|DEPCTL_CNAK|ctrl,
&reg->out_endp[ep_num].doepctl);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/0ba47a6f/attachment.sig>

author
#3 lore raw

PATCH 1/1 usb: dwc2: make casts of ep->dma_buf consistent

In reply to Tom Rini
Quoted 9 lines · Tom Rini

In most places in the code we cast this to an unsigned long, but in one place we cast to an unsigned int. For consistency and to fix a warning on 64bit targets, always cast this to unsigned long. For the long term we should however change the declaration of dma_buf.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180205/474df1a3/attachment.sig>