ARM: tegra: Fix build failures and warnings on 64-bit
Subsystems (11)
PATCH 1/13 ARM: tegra: Fix build failures and warnings on 64-bit
From: Thierry Reding <[email protected]>
This fixes some build errors and warnings caused by inline assembly and pointer to integer cast size mismatches. The inline assembly build error in config_cache() is easy to fix because the code isn't meaningful on 64 bit ARM. For the assembly-level reset_cpu() implementation, provide a version that uses ARMv8 register names, but is otherwise identical.
The remaining warnings about pointer to integer cast size mismatches can be fixed by simply using explicit casts where appropriate, or using long unsigned integers rather than 32-bit sized types where an actual address is stored.
--- arch/arm/mach-tegra/ap.c | 4 ++-- arch/arm/mach-tegra/cache.c | 2 ++ arch/arm/mach-tegra/lowlevel_init.S | 15 +++++++++++++++ arch/arm/mach-tegra/pinmux-common.c | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-)
arch/arm/mach-tegra/ap.c +2 -2
@@ -135,8 +135,8 @@ static u32 get_odmdata(void)* on BCTs for currently supported SoCs, which are locked down. * If this changes in new chips, we can revisit this algorithm. */ - -u32 bct_start, odmdata; +unsigned long bct_start; +u32 odmdata; bct_start =readl (NV_PA_BASE_SRAM +NVBOOTINFOTABLE_BCTPTR ); odmdata =readl (bct_start +BCT_ODMDATA_OFFSET );
arch/arm/mach-tegra/cache.c +2 -0
@@ -21,6 +21,7 @@#include <asm/arch-tegra/ap.h> #include <asm/arch/gp_padctrl.h> +#ifndef CONFIG_ARM64 void config_cache (void ) {u32 reg =0 ;
@@ -44,3 +45,4 @@ void config_cache(void) reg |=2 ; asm("mcr p15, 1, %0, c9, c0, 2" : : "r" (reg)); } +#endif
arch/arm/mach-tegra/lowlevel_init.S +15 -0
@@ -11,6 +11,20 @@ #include <version.h> #include <linux/linkage.h> +#ifdef CONFIG_ARM64 + .align 5 +ENTRY(reset_cpu) + /* get address for global reset register */ + ldr x1, =PRM_RSTCTRL + ldr w3, [x1] + /* force reset */ + orr w3, w3, #0x10 + str w3, [x1] + mov w0, w0 +1: + b 1b +ENDPROC(reset_cpu) +#else .align 5 ENTRY(reset_cpu) ldr r1, rstctl @ get addr for global reset
@@ -24,3 +38,4 @@ _loop_forever: rstctl: .word PRM_RSTCTRL ENDPROC(reset_cpu) +#endif
arch/arm/mach-tegra/pinmux-common.c +1 -1
@@ -78,7 +78,7 @@ (((hsm) >= PMUX_HSM_DISABLE) && ((hsm) <= PMUX_HSM_ENABLE))#endif -#define _R (offset) (u32 *)(NV_PA_APB_MISC_BASE + (offset)) +#define _R (offset) (u32 *)((unsigned long)NV_PA_APB_MISC_BASE + (offset))#if defined(CONFIG_TEGRA20 )
Signature · 1 line
2.3.2
PATCH 2/13 usb: Build warning fixes for 64-bit
From: Thierry Reding <[email protected]>
Fix an pointer to integer cast size mismatch warning by casting to unsigned long instead of unsigned int and fix up the corresponding printf format string to use %lx instead of %x.
Also remove a pointless cast producing a size mismatch warning.
--- common/usb_storage.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
common/usb_storage.c +3 -3
@@ -336,8 +336,8 @@ static int us_one_transfer(struct us_data *us, int pipe, char *buf, int length)/* set up the transfer loop */ do { /* transfer the data */ - debug("Bulk xfer 0x%x(%d) try #%d\n", - (unsigned int)buf, this_xfer, 11 - maxtry); + debug("Bulk xfer 0x%lx(%d) try #%d\n", + (unsigned long)buf, this_xfer, 11 - maxtry); result = usb_bulk_msg(us->pusb_dev, pipe, buf, this_xfer, &partial, USB_CNTL_TIMEOUT * 5);
@@ -603,7 +603,7 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data *us) (void *) &us->ip_data, us->irqmaxp, us->irqinterval); timeout =1000 ;while (timeout--) { -if ((volatile int *) us->ip_wanted ==NULL ) +if (us->ip_wanted ==0 )break ;mdelay (10 ); }
Signature · 1 line
2.3.2
PATCH 3/13 dfu: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Explicitly cast the result of a pointer arithmetic to unsigned int so that it matches the corresponding printf format string. While at it, use %p to print a buffer address rather than %x and an explicit cast (which causes a warning in this case because it's cast to unsigned int instead of unsigned long).
--- drivers/dfu/dfu.c | 2 +- drivers/dfu/dfu_mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/dfu/dfu.c +1 -1
@@ -200,7 +200,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)debug ("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%x\n" , __func__, dfu->name, buf, size, blk_seq_num, dfu->offset, - dfu->i_buf - dfu->i_buf_start); + (unsigned int )(dfu->i_buf - dfu->i_buf_start));if (!dfu->inited) {/* initial state */
drivers/dfu/dfu_mmc.c +1 -1
@@ -156,7 +156,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, dfu->data.mmc.dev, dfu->data.mmc.part);if (op !=DFU_OP_SIZE ) -sprintf (cmd_buf +strlen (cmd_buf)," 0x%x" , (unsigned int )buf); +sprintf (cmd_buf +strlen (cmd_buf)," %p" , buf);sprintf (cmd_buf +strlen (cmd_buf)," %s" , dfu->name);
Signature · 1 line
2.3.2
PATCH 3/13 dfu: Build warning fixes for 64-bit
Hi Thierry,
Quoted 35 lines
From: Thierry Reding <[email protected]>
Explicitly cast the result of a pointer arithmetic to unsigned int so that it matches the corresponding printf format string. While at it, use %p to print a buffer address rather than %x and an explicit cast (which causes a warning in this case because it's cast to unsigned int instead of unsigned long).
Cc ?ukasz Majewski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/dfu/dfu.c | 2 +- drivers/dfu/dfu_mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/dfu/dfu.c +1
-1@@ -200,7 +200,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%x\n", __func__, dfu->name, buf, size, blk_seq_num, dfu->offset, - dfu->i_buf - dfu->i_buf_start); + (unsigned int)(dfu->i_buf - dfu->i_buf_start));if (!dfu->inited) {drivers/dfu/dfu.c +0
-0/* initial state */ drivers/dfu/dfu_mmc.c +0
-0
drivers/dfu/dfu_mmc.c static int mmc_file_op(enum dfu_op op, struct · line 162
Quoted 8 lines
drivers/dfu/dfu_mmc.c +1
-1@@ -156,7 +156,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, dfu->data.mmc.dev, dfu->data.mmc.part);if (op !=DFU_OP_SIZE ) -sprintf (cmd_buf +strlen (cmd_buf)," 0x%x" , (unsigned int)buf); +sprintf (cmd_buf +strlen (cmd_buf)," %p" , buf);sprintf (cmd_buf +strlen (cmd_buf)," %s" , dfu->name);
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 4/13 i2c: tegra: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fix a couple of pointer to integer size mismatch warnings by casting pointers to unsigned long rather than unsigned int.
--- drivers/i2c/tegra_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/tegra_i2c.c +2 -2
@@ -235,7 +235,7 @@ static int send_recv_packets(struct i2c_bus *i2c_bus,if ((words ==1 ) && last_bytes) { local =0 ;memcpy (&local, dptr, last_bytes); - }else if ((unsigned )dptr &3 ) { + }else if ((unsigned long )dptr &3 ) {memcpy (&local, dptr,sizeof (u32)); }else { local = *wptr;
@@ -258,7 +258,7 @@ static int send_recv_packets(struct i2c_bus *i2c_bus, local =readl (&control->rx_fifo);if ((words ==1 ) && last_bytes)memcpy (dptr, (char *)&local, last_bytes); -else if ((unsigned )dptr &3 ) +else if ((unsigned long )dptr &3 )memcpy (dptr, &local,sizeof (u32));else *wptr = local;
Signature · 1 line
2.3.2
PATCH 5/13 mmc: tegra: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fix a couple of pointer to integer size mismatch warnings by casting pointers to unsigned long rather than unsigned int.
--- drivers/mmc/tegra_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/tegra_mmc.c +3 -3
@@ -67,7 +67,7 @@ static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data, bbstate->bounce_buffer, bbstate->user_buffer, data->blocks, data->blocksize); -writel ((u32 )bbstate->bounce_buffer, &host->reg->sysad); +writel ((u32 )(unsigned long )bbstate->bounce_buffer, &host->reg->sysad);/* * DMASEL[4:3] * 00 = Selects SDMA
@@ -233,8 +233,8 @@ static int mmc_send_cmd_bounced(struct mmc *mmc, struct mmc_cmd *cmd,if (cmd->resp_type &MMC_RSP_136 ) {/* CRC is stripped so we need to do some shifting. */ for (i =0 ; i <4 ; i++) { -unsigned int offset = - (unsigned int )(&host->reg->rspreg3 - i); +unsigned long offset = + (unsigned long )(&host->reg->rspreg3 - i); cmd->response[i] =readl (offset) <<8 ;if (i !=3 ) {
Signature · 1 line
2.3.2
PATCH 6/13 net: rtl8169: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Turn ioaddr into an unsigned long rather than a sized 32-bit variable. While at it, fix a couple of pointer to integer cast size mismatch warnings by casting through unsigned long going from pointers to integers and vice versa.
--- drivers/net/rtl8169.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/rtl8169.c +6 -6
@@ -55,7 +55,7 @@#define drv_version "v1.5"#define drv_date "01-17-2004" -static u32 ioaddr; +static unsigned long ioaddr;/* Condensed operations for readability. */ #define currticks () get_timer(0)
@@ -97,14 +97,14 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };#define RTL_W32 (reg, val32) writel ((val32), ioaddr + (reg))#define RTL_R8 (reg) readb (ioaddr + (reg))#define RTL_R16 (reg) readw (ioaddr + (reg)) -#define RTL_R32 (reg) ((unsigned long) readl (ioaddr + (reg))) +#define RTL_R32 (reg) readl (ioaddr + (reg))#define ETH_FRAME_LEN MAX_ETH_FRAME_SIZE#define ETH_ALEN MAC_ADDR_LEN#define ETH_ZLEN 60 -#define bus_to_phys (a) pci_mem_to_phys((pci_dev_t)dev->priv, (pci_addr_t)a) -#define phys_to_bus (a) pci_phys_to_mem((pci_dev_t)dev->priv, (phys_addr_t)a) +#define bus_to_phys (a) pci_mem_to_phys((pci_dev_t)(unsigned long)dev->priv, (pci_addr_t)(unsigned long)a) +#define phys_to_bus (a) pci_phys_to_mem((pci_dev_t)(unsigned long)dev->priv, (phys_addr_t)a)enum RTL8169_registers {MAC0 =0 ,/* Ethernet hardware address. */
@@ -852,7 +852,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)#ifdef DEBUG_RTL8169 /* Print out some hardware info */ -printf ("%s: at ioaddr 0x%x\n" , dev->name, ioaddr); +printf ("%s: at ioaddr 0x%lx\n" , dev->name, ioaddr);#endif /* if TBI is not endbled */
@@ -1008,7 +1008,7 @@ int rtl8169_initialize(bd_t *bis)memset (dev,0 ,sizeof (*dev));sprintf (dev->name,"RTL8169#%d" , card_number); - dev->priv = (void *) devno; + dev->priv = (void *)(unsigned long )devno; dev->iobase = (int )pci_mem_to_phys (devno, iobase); dev->init = rtl_reset;
Signature · 1 line
2.3.2
PATCH 6/13 net: rtl8169: Build warning fixes for 64-bit
Hi Thierry,
Quoted 10 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Turn ioaddr into an unsigned long rather than a sized 32-bit variable. While at it, fix a couple of pointer to integer cast size mismatch warnings by casting through unsigned long going from pointers to integers and vice versa.
Cc Joe Hershberger <[email protected]>Signed-off-by Thierry Reding <[email protected]>
Fixed checkpatch failures and applied to next, thanks! -Joe
PATCH 7/13 pci: tegra: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use the %pa specifier to print physical addresses rather than %x. The latter causes build warnings on 64-bit.
--- drivers/pci/pci_tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pci_tegra.c +5 -5
@@ -462,11 +462,11 @@ static int tegra_pcie_parse_dt_ranges(const void *fdt, int node, }debug ("PCI regions:\n" ); -debug (" I/O: %#x-%#x\n" , pcie->io.start, pcie->io.end); -debug (" non-prefetchable memory: %#x-%#x\n" , pcie->mem.start, - pcie->mem.end); -debug (" prefetchable memory: %#x-%#x\n" , pcie->prefetch.start, - pcie->prefetch.end); +debug (" I/O: %pa-%pa\n" , &pcie->io.start, &pcie->io.end); +debug (" non-prefetchable memory: %pa-%pa\n" , &pcie->mem.start, + &pcie->mem.end); +debug (" prefetchable memory: %pa-%pa\n" , &pcie->prefetch.start, + &pcie->prefetch.end);return 0 ; }
Signature · 1 line
2.3.2
PATCH 8/13 usb: eth: asix: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fix a type mismatch in a printf format string.
--- drivers/usb/eth/asix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/eth/asix.c +1 -1
@@ -475,7 +475,7 @@ static int asix_send(struct eth_device *eth, void *packet, int length) length +sizeof (packet_len), &actual_len, USB_BULK_SEND_TIMEOUT); -debug ("Tx: len = %u, actual = %u, err = %d\n" , +debug ("Tx: len = %zu, actual = %u, err = %d\n" , length +sizeof (packet_len), actual_len, err);return err;
Signature · 1 line
2.3.2
Marek Vasut
AppliedPATCH 8/13 usb: eth: asix: Build warning fixes for 64-bit
Quoted 15 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Fix a type mismatch in a printf format string.
Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/usb/eth/asix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/eth/asix.c +0
-0
drivers/usb/eth/asix.c static int asix_send(struct eth_device *eth, void · line 481
Quoted 8 lines
drivers/usb/eth/asix.c +1
-1@@ -475,7 +475,7 @@ static int asix_send(struct eth_device *eth, void *packet, int length) length + sizeof(packet_len), &actual_len, USB_BULK_SEND_TIMEOUT); -debug ("Tx: len = %u, actual = %u, err = %d\n" , +debug ("Tx: len = %zu, actual = %u, err = %d\n" , length +sizeof (packet_len), actual_len, err);return err;
Applied, thanks!
Best regards,
Marek Vasut
PATCH 9/13 usb: ci_udc: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
--- drivers/usb/gadget/ci_udc.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/usb/gadget/ci_udc.c +21 -21
@@ -160,8 +160,8 @@ static struct ept_queue_item *ci_get_qtd(int ep_num, int dir_in)static void ci_flush_qh (int ep_num) {struct ept_queue_head *head =ci_get_qh (ep_num,0 ); -const uint32_t start = (uint32_t )head; -const uint32_t end = start +2 *sizeof (*head); +unsigned long start = (unsigned long )head; +unsigned long end = start +2 *sizeof (*head);flush_dcache_range (start, end); }
@@ -175,8 +175,8 @@ static void ci_flush_qh(int ep_num)static void ci_invalidate_qh (int ep_num) {struct ept_queue_head *head =ci_get_qh (ep_num,0 ); -uint32_t start = (uint32_t )head; -uint32_t end = start +2 *sizeof (*head); +unsigned long start = (unsigned long )head; +unsigned long end = start +2 *sizeof (*head);invalidate_dcache_range (start, end); }
@@ -190,8 +190,8 @@ static void ci_invalidate_qh(int ep_num)static void ci_flush_qtd (int ep_num) {struct ept_queue_item *item =ci_get_qtd (ep_num,0 ); -const uint32_t start = (uint32_t )item; -const uint32_t end = start +2 *ILIST_ENT_SZ ; +unsigned long start = (unsigned long )item; +unsigned long end = start +2 *ILIST_ENT_SZ ;flush_dcache_range (start, end); }
@@ -205,8 +205,8 @@ static void ci_flush_qtd(int ep_num)static void ci_invalidate_qtd (int ep_num) {struct ept_queue_item *item =ci_get_qtd (ep_num,0 ); -const uint32_t start = (uint32_t )item; -const uint32_t end = start +2 *ILIST_ENT_SZ ; +const unsigned long start = (unsigned long )item; +const unsigned long end = start +2 *ILIST_ENT_SZ ;invalidate_dcache_range (start, end); }
@@ -308,8 +308,8 @@ static int ci_ep_disable(struct usb_ep *ep)static int ci_bounce (struct ci_req *ci_req,int in) {struct usb_request *req = &ci_req->req; -uint32_t addr = (uint32_t )req->buf; -uint32_t hwaddr; +unsigned long addr = (unsigned long )req->buf; +unsigned long hwaddr;uint32_t aligned_used_len;/* Input buffer address is not aligned. */
@@ -343,7 +343,7 @@ align:memcpy (ci_req->hw_buf, req->buf, req->length); flush: - hwaddr = (uint32_t )ci_req->hw_buf; + hwaddr = (unsigned long )ci_req->hw_buf; aligned_used_len =roundup (req->length,ARCH_DMA_MINALIGN );flush_dcache_range (hwaddr, hwaddr + aligned_used_len);
@@ -353,8 +353,8 @@ flush:static void ci_debounce (struct ci_req *ci_req,int in) {struct usb_request *req = &ci_req->req; -uint32_t addr = (uint32_t )req->buf; -uint32_t hwaddr = (uint32_t )ci_req->hw_buf; +unsigned long addr = (unsigned long )req->buf; +unsigned long hwaddr = (unsigned long )ci_req->hw_buf;uint32_t aligned_used_len;if (in)
@@ -388,13 +388,13 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep) len = ci_req->req.length; item->info =INFO_BYTES (len) |INFO_ACTIVE ; - item->page0 = (uint32_t )ci_req->hw_buf; - item->page1 = ((uint32_t )ci_req->hw_buf &0xfffff000 ) +0x1000 ; - item->page2 = ((uint32_t )ci_req->hw_buf &0xfffff000 ) +0x2000 ; - item->page3 = ((uint32_t )ci_req->hw_buf &0xfffff000 ) +0x3000 ; - item->page4 = ((uint32_t )ci_req->hw_buf &0xfffff000 ) +0x4000 ; + item->page0 = (unsigned long )ci_req->hw_buf; + item->page1 = ((unsigned long )ci_req->hw_buf &0xfffff000 ) +0x1000 ; + item->page2 = ((unsigned long )ci_req->hw_buf &0xfffff000 ) +0x2000 ; + item->page3 = ((unsigned long )ci_req->hw_buf &0xfffff000 ) +0x3000 ; + item->page4 = ((unsigned long )ci_req->hw_buf &0xfffff000 ) +0x4000 ; - head->next = (unsigned ) item; + head->next = (unsigned long )item; head->info =0 ;/*
@@ -422,7 +422,7 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)* can use the other to transmit the extra zero-length packet. */ struct ept_queue_item *other_item =ci_get_qtd (num,0 ); - item->next = (unsigned )other_item; + item->next = (unsigned long )other_item; item = other_item; item->info =INFO_ACTIVE ; }
@@ -772,7 +772,7 @@ static int ci_pullup(struct usb_gadget *gadget, int is_on)writel (USBCMD_ITC (MICRO_8FRAME ) |USBCMD_RST , &udc->usbcmd);udelay (200 ); -writel ((unsigned )controller.epts, &udc->epinitaddr); +writel ((unsigned long )controller.epts, &udc->epinitaddr);/* select DEVICE mode */ writel (USBMODE_DEVICE , &udc->usbmode);
Signature · 1 line
2.3.2
PATCH 9/13 usb: ci_udc: Build warning fixes for 64-bit
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Seems reasonable at a quick glance,
PATCH 9/13 usb: ci_udc: Build warning fixes for 64-bit
In reply to Thierry RedingQuoted 11 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Cc ?ukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>
I'll be picking the one from Rob here.
Best regards,
Marek Vasut
PATCH 10/13 usb: mass-storage: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fix a printf format mismatch warning seen on 64-bit builds.
--- drivers/usb/gadget/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_mass_storage.c +1 -1
@@ -973,7 +973,7 @@ static int do_write(struct fsg_common *common)/* If an error occurred, report it and its position */ if (nwritten < amount) { -printf ("nwritten:%d amount:%d\n" , nwritten, +printf ("nwritten:%zd amount:%u\n" , nwritten, amount); curlun->sense_data =SS_WRITE_ERROR ; curlun->info_valid =1 ;
Signature · 1 line
2.3.2
PATCH 10/13 usb: mass-storage: Build warning fixes for 64-bit
Hi Thierry,
Quoted 23 lines
From: Thierry Reding <[email protected]>
Fix a printf format mismatch warning seen on 64-bit builds.
Cc ?ukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/usb/gadget/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindexe045957d0723..71fd49db7f24100644 ---a/drivers/usb/gadget/f_mass_storage.c+++b/drivers/usb/gadget/f_mass_storage.c@@ -973,7 +973,7 @@ static intdo_write(struct fsg_common *common)
/* If an error occurred, report it and its
position */ if (nwritten < amount) {(quoted diff) +0
-1- printf("nwritten:%d amount:%d\n",nwritten,
(quoted diff) +1
-0+ printf("nwritten:%zd amount:%u\n",nwritten, amount);
drivers/usb/gadget/f_mass_storage.c static int do_write(struct fsg_common *common) · line 979
Quoted 2 lines
drivers/usb/gadget/f_mass_storage.c +0
-0curlun->sense_data =SS_WRITE_ERROR ; curlun->info_valid =1 ;
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 10/13 usb: mass-storage: Build warning fixes for 64-bit
In reply to Thierry RedingHi Thierry,
Quoted 23 lines
From: Thierry Reding <[email protected]>
Fix a printf format mismatch warning seen on 64-bit builds.
Cc ?ukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/usb/gadget/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindexe045957d0723..71fd49db7f24100644 ---a/drivers/usb/gadget/f_mass_storage.c+++b/drivers/usb/gadget/f_mass_storage.c@@ -973,7 +973,7 @@ static intdo_write(struct fsg_common *common)
/* If an error occurred, report it and its
position */ if (nwritten < amount) {(quoted diff) +0
-1- printf("nwritten:%d amount:%d\n",nwritten,
(quoted diff) +1
-0+ printf("nwritten:%zd amount:%u\n",nwritten, amount);
drivers/usb/gadget/f_mass_storage.c static int do_write(struct fsg_common *common) · line 979
Quoted 2 lines
drivers/usb/gadget/f_mass_storage.c +0
-0curlun->sense_data =SS_WRITE_ERROR ; curlun->info_valid =1 ;
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Marek Vasut
AppliedPATCH 10/13 usb: mass-storage: Build warning fixes for 64-bit
In reply to Thierry RedingQuoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Fix a printf format mismatch warning seen on 64-bit builds.
Cc ?ukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>
Applied, thanks!
Best regards,
Marek Vasut
PATCH 11/13 usb: ehci-hcd: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
--- drivers/usb/host/ehci-hcd.c | 84 ++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 42 deletions(-)
drivers/usb/host/ehci-hcd.c +42 -42
@@ -45,7 +45,7 @@static struct ehci_ctrl ehcic[CONFIG_USB_MAX_CONTROLLER_COUNT ];#define ALIGN_END_ADDR (type, ptr, size) \ - ((uint32_t)(ptr) + roundup((size) * sizeof(type), USB_DMA_MINALIGN)) + ((unsigned long)(ptr) + roundup((size) * sizeof(type), USB_DMA_MINALIGN)) static struct descriptor { struct usb_hub_descriptor hub;
@@ -223,7 +223,7 @@ static int ehci_shutdown(struct ehci_ctrl *ctrl)static int ehci_td_buffer (struct qTD *td,void *buf,size_t sz) {uint32_t delta, next; -uint32_t addr = (uint32_t )buf; +unsigned long addr = (unsigned long )buf;int idx;if (addr !=ALIGN (addr,ARCH_DMA_MINALIGN ))
@@ -245,7 +245,7 @@ static int ehci_td_buffer(struct qTD *td, void *buf, size_t sz) }if (idx ==QT_BUFFER_CNT ) { -printf ("out of buffer pointers (%u bytes left)\n" , sz); +printf ("out of buffer pointers (%zu bytes left)\n" , sz);return -1 ; }
@@ -354,7 +354,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,* qTD transfer size will be one page shorter, and the first qTD * data buffer of each transfer will be page-unaligned. */ -if ((uint32_t )buffer & (PKT_ALIGN -1 )) +if ((unsigned long )buffer & (PKT_ALIGN -1 )) xfr_sz--;/* Convert the qTD transfer size to bytes. */ xfr_sz *=EHCI_PAGE_SIZE ;
@@ -394,7 +394,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,* qh_overlay.qt_next ...... 13-10 H * - qh_overlay.qt_altnext */ - qh->qh_link =cpu_to_hc32 ((uint32_t )&ctrl->qh_list |QH_LINK_TYPE_QH ); + qh->qh_link =cpu_to_hc32 ((unsigned long )&ctrl->qh_list |QH_LINK_TYPE_QH ); c = (dev->speed !=USB_SPEED_HIGH ) && !usb_pipeendpoint (pipe); maxpacket =usb_maxpacket (dev, pipe); endpt = QH_ENDPT1_RL(8) | QH_ENDPT1_C(c) |
@@ -434,7 +434,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, goto fail; }/* Update previous qTD! */ - *tdp =cpu_to_hc32 ((uint32_t )&qtd[qtd_counter]); + *tdp =cpu_to_hc32 ((unsigned long )&qtd[qtd_counter]); tdp = &qtd[qtd_counter++].qt_next; toggle =1 ; }
@@ -454,7 +454,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,* portion of the first page before the buffer start * offset within that page is unusable. */ - xfr_bytes -= (uint32_t )buf_ptr & (EHCI_PAGE_SIZE -1 ); + xfr_bytes -= (unsigned long )buf_ptr & (EHCI_PAGE_SIZE -1 );/* * In order to keep each packet within a qTD transfer, * align the qTD transfer size to PKT_ALIGN.
@@ -493,7 +493,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, goto fail; }/* Update previous qTD! */ - *tdp =cpu_to_hc32 ((uint32_t )&qtd[qtd_counter]); + *tdp =cpu_to_hc32 ((unsigned long )&qtd[qtd_counter]); tdp = &qtd[qtd_counter++].qt_next;/* * Data toggle has to be adjusted since the qTD transfer
@@ -524,21 +524,21 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,QT_TOKEN_STATUS (QT_TOKEN_STATUS_ACTIVE ); qtd[qtd_counter].qt_token =cpu_to_hc32 (token);/* Update previous qTD! */ - *tdp =cpu_to_hc32 ((uint32_t )&qtd[qtd_counter]); + *tdp =cpu_to_hc32 ((unsigned long )&qtd[qtd_counter]); tdp = &qtd[qtd_counter++].qt_next; } - ctrl->qh_list.qh_link =cpu_to_hc32 ((uint32_t )qh |QH_LINK_TYPE_QH ); + ctrl->qh_list.qh_link =cpu_to_hc32 ((unsigned long )qh |QH_LINK_TYPE_QH );/* Flush dcache */ -flush_dcache_range ((uint32_t )&ctrl->qh_list, +flush_dcache_range ((unsigned long )&ctrl->qh_list, ALIGN_END_ADDR(struct QH, &ctrl->qh_list, 1)); - flush_dcache_range((uint32_t)qh, ALIGN_END_ADDR(struct QH, qh, 1)); -flush_dcache_range ((uint32_t )qtd, + flush_dcache_range((unsigned long)qh, ALIGN_END_ADDR(struct QH, qh, 1)); +flush_dcache_range ((unsigned long )qtd, ALIGN_END_ADDR(struct qTD, qtd, qtd_count));/* Set async. queue head pointer. */ -ehci_writel (&ctrl->hcor->or_asynclistaddr, (uint32_t )&ctrl->qh_list); +ehci_writel (&ctrl->hcor->or_asynclistaddr, (unsigned long )&ctrl->qh_list); usbsts =ehci_readl (&ctrl->hcor->or_usbsts);ehci_writel (&ctrl->hcor->or_usbsts, (usbsts &0x3f ));
@@ -561,11 +561,11 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, timeout =USB_TIMEOUT_MS (pipe); do { /* Invalidate dcache */ - invalidate_dcache_range((uint32_t)&ctrl->qh_list, + invalidate_dcache_range((unsigned long)&ctrl->qh_list, ALIGN_END_ADDR(struct QH, &ctrl->qh_list, 1)); - invalidate_dcache_range((uint32_t)qh, + invalidate_dcache_range((unsigned long)qh, ALIGN_END_ADDR(struct QH, qh, 1)); - invalidate_dcache_range((uint32_t)qtd, + invalidate_dcache_range((unsigned long)qtd, ALIGN_END_ADDR(struct qTD, qtd, qtd_count)); token = hc32_to_cpu(vtd->qt_token);
@@ -583,8 +583,8 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,* dangerous operation, it's responsibility of the calling * code to make sure enough space is reserved. */ -invalidate_dcache_range ((uint32_t )buffer, -ALIGN ((uint32_t )buffer + length,ARCH_DMA_MINALIGN )); +invalidate_dcache_range ((unsigned long )buffer, +ALIGN ((unsigned long )buffer + length,ARCH_DMA_MINALIGN ));/* Check that the TD processing happened */ if (QT_TOKEN_GET_STATUS (token) &QT_TOKEN_STATUS_ACTIVE )
@@ -968,7 +968,7 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)/* Set head of reclaim list */ memset (qh_list,0 ,sizeof (*qh_list)); - qh_list->qh_link =cpu_to_hc32 ((uint32_t )qh_list |QH_LINK_TYPE_QH ); + qh_list->qh_link =cpu_to_hc32 ((unsigned long )qh_list |QH_LINK_TYPE_QH ); qh_list->qh_endpt1 =cpu_to_hc32 (QH_ENDPT1_H (1 ) |QH_ENDPT1_EPS (USB_SPEED_HIGH )); qh_list->qh_overlay.qt_next =cpu_to_hc32 (QT_NEXT_TERMINATE );
@@ -976,11 +976,11 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) qh_list->qh_overlay.qt_token =cpu_to_hc32 (QT_TOKEN_STATUS (QT_TOKEN_STATUS_HALTED )); -flush_dcache_range ((uint32_t )qh_list, +flush_dcache_range ((unsigned long )qh_list, ALIGN_END_ADDR(struct QH, qh_list, 1));/* Set async. queue head pointer. */ -ehci_writel (&ehcic[index].hcor->or_asynclistaddr, (uint32_t )qh_list); +ehci_writel (&ehcic[index].hcor->or_asynclistaddr, (unsigned long )qh_list);/* * Set up periodic list
@@ -993,7 +993,7 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) periodic->qh_overlay.qt_next =cpu_to_hc32 (QT_NEXT_TERMINATE ); periodic->qh_overlay.qt_altnext =cpu_to_hc32 (QT_NEXT_TERMINATE ); -flush_dcache_range ((uint32_t )periodic, +flush_dcache_range ((unsigned long )periodic, ALIGN_END_ADDR(struct QH, periodic, 1));/*
@@ -1011,17 +1011,17 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)if (!ehcic[index].periodic_list)return -ENOMEM ;for (i =0 ; i <1024 ; i++) { - ehcic[index].periodic_list[i] =cpu_to_hc32 ((uint32_t )periodic - |QH_LINK_TYPE_QH ); + ehcic[index].periodic_list[i] = +cpu_to_hc32 ((unsigned long )periodic |QH_LINK_TYPE_QH ); } -flush_dcache_range ((uint32_t )ehcic[index].periodic_list, +flush_dcache_range ((unsigned long )ehcic[index].periodic_list,ALIGN_END_ADDR (uint32_t, ehcic[index].periodic_list,1024 ));/* Set periodic list base address */ ehci_writel (&ehcic[index].hcor->or_periodiclistbase, - (uint32_t )ehcic[index].periodic_list); + (unsigned long )ehcic[index].periodic_list); reg =ehci_readl (&ehcic[index].hccr->cr_hcsparams); descriptor.hub.bNbrPorts =HCS_N_PORTS (reg);
@@ -1103,7 +1103,7 @@ struct int_queue {struct qTD *tds; }; -#define NEXT_QH (qh) (struct QH *)(hc32_to_cpu((qh)->qh_link) & ~0x1f) +#define NEXT_QH (qh) (struct QH *)(unsigned long)(hc32_to_cpu((qh)->qh_link) & ~0x1f)static int enable_periodic (struct ehci_ctrl *ctrl)
@@ -1214,11 +1214,11 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize,struct qTD *td = result->tds + i;void **buf = &qh->buffer; - qh->qh_link =cpu_to_hc32 ((uint32_t )(qh+1 ) |QH_LINK_TYPE_QH ); + qh->qh_link =cpu_to_hc32 ((unsigned long )(qh+1 ) |QH_LINK_TYPE_QH );if (i == queuesize -1 ) qh->qh_link =cpu_to_hc32 (QH_LINK_TERMINATE ); - qh->qh_overlay.qt_next =cpu_to_hc32 ((uint32_t )td); + qh->qh_overlay.qt_next =cpu_to_hc32 ((unsigned long )td); qh->qh_overlay.qt_altnext =cpu_to_hc32 (QT_NEXT_TERMINATE ); qh->qh_endpt1 = cpu_to_hc32((0 << 28) | /* No NAK reload (ehci 4.9) */
@@ -1244,7 +1244,7 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, ((usb_pipein (pipe) ?1 :0 ) <<8 ) |/* IN/OUT token */ 0x80); /* active */ td->qt_buffer[0 ] = -cpu_to_hc32 ((uint32_t )buffer + i * elementsize); +cpu_to_hc32 ((unsigned long )buffer + i * elementsize); td->qt_buffer[1 ] =cpu_to_hc32 ((td->qt_buffer[0 ] +0x1000 ) & ~0xfff ); td->qt_buffer[2] =
@@ -1257,13 +1257,13 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize, *buf = buffer + i * elementsize; } -flush_dcache_range ((uint32_t )buffer, +flush_dcache_range ((unsigned long )buffer,ALIGN_END_ADDR (char, buffer, queuesize * elementsize)); -flush_dcache_range ((uint32_t )result->first, +flush_dcache_range ((unsigned long )result->first, ALIGN_END_ADDR(struct QH, result->first, queuesize)); -flush_dcache_range ((uint32_t )result->tds, +flush_dcache_range ((unsigned long )result->tds, ALIGN_END_ADDR(struct qTD, result->tds, queuesize));
@@ -1277,11 +1277,11 @@ create_int_queue(struct usb_device *dev, unsigned long pipe, int queuesize,/* hook up to periodic list */ struct QH *list = &ctrl->periodic_queue; result->last->qh_link = list->qh_link; - list->qh_link =cpu_to_hc32 ((uint32_t )result->first |QH_LINK_TYPE_QH ); + list->qh_link =cpu_to_hc32 ((unsigned long )result->first |QH_LINK_TYPE_QH ); -flush_dcache_range ((uint32_t )result->last, +flush_dcache_range ((unsigned long )result->last, ALIGN_END_ADDR(struct QH, result->last, 1)); -flush_dcache_range ((uint32_t )list, +flush_dcache_range ((unsigned long )list, ALIGN_END_ADDR(struct QH, list, 1));if (enable_periodic (ctrl) <0 ) {
@@ -1316,7 +1316,7 @@ void *poll_int_queue(struct usb_device *dev, struct int_queue *queue) }/* still active */ cur_td = &queue->tds[queue->current - queue->first]; -invalidate_dcache_range ((uint32_t )cur_td, +invalidate_dcache_range ((unsigned long )cur_td, ALIGN_END_ADDR(struct qTD, cur_td, 1));if (QT_TOKEN_GET_STATUS (hc32_to_cpu (cur_td->qt_token)) &QT_TOKEN_STATUS_ACTIVE ) {
@@ -1329,7 +1329,7 @@ void *poll_int_queue(struct usb_device *dev, struct int_queue *queue)else queue->current =NULL ; -invalidate_dcache_range ((uint32_t )cur->buffer, +invalidate_dcache_range ((unsigned long )cur->buffer,ALIGN_END_ADDR (char, cur->buffer, queue->elementsize));
@@ -1359,7 +1359,7 @@ destroy_int_queue(struct usb_device *dev, struct int_queue *queue)if (NEXT_QH (cur) == queue->first) {debug ("found candidate. removing from chain\n" ); cur->qh_link = queue->last->qh_link; -flush_dcache_range ((uint32_t )cur, +flush_dcache_range ((unsigned long )cur, ALIGN_END_ADDR(struct QH, cur, 1)); result =0 ;break ;
@@ -1411,8 +1411,8 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, }if (backbuffer != buffer) { -debug ("got wrong buffer back (%x instead of %x)\n" , - (uint32_t )backbuffer, (uint32_t )buffer); +debug ("got wrong buffer back (%p instead of %p)\n" , + backbuffer, buffer);return -EINVAL ; }
Signature · 1 line
2.3.2
PATCH 11/13 usb: ehci-hcd: Build warning fixes for 64-bit
Quoted 10 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Fix a slew of pointer to integer cast size mismatch warnings caused by this driver explicitly casting pointers to 32-bit integers. While it is true that the hardware can only deal with 32-bit addresses, truncating using a cast isn't the right solution because the pointer could still be outside of the space addressable using 32-bit addresses.
Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>
I'll be picking the one from Rob here instead.
Best regards,
Marek Vasut
PATCH 12/13 usb: ehci-tegra: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Cast pointers to unsigned long instead of a sized 32-bit type to avoid pointer to integer cast size mismatch warnings.
--- drivers/usb/host/ehci-tegra.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-tegra.c +4 -4
@@ -196,7 +196,7 @@ void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)if (controller->has_hostpc) *reg |=EHCI_PS_PE ; -if (((u32 )status_reg &TEGRA_USB_ADDR_MASK ) != port_addr_clear_csc) +if (((unsigned long )status_reg &TEGRA_USB_ADDR_MASK ) != port_addr_clear_csc)return ;/* For EHCI_PS_CSC to be cleared in ehci_hcd.c */ if (ehci_readl (status_reg) &EHCI_PS_CSC )
@@ -434,7 +434,7 @@ static int init_utmi_usb_controller(struct fdt_usb *config,reset_set_enable (PERIPH_ID_USBD ,0 ); } usb1ctlr = (struct usb_ctlr *) - ((u32 )config->reg &USB1_ADDR_MASK ); + ((unsigned long )config->reg &USB1_ADDR_MASK ); val =readl (&usb1ctlr->utmip_bias_cfg0);setbits_le32 (&val,UTMIP_HSDISCON_LEVEL_MSB ); clrsetbits_le32(&val, UTMIP_HSDISCON_LEVEL_MASK,
@@ -537,7 +537,7 @@ static int init_utmi_usb_controller(struct fdt_usb *config,* controllers and can be controlled from USB1 only. */ usb1ctlr = (struct usb_ctlr *) - ((u32 )config->reg &USB1_ADDR_MASK ); + ((unsigned long )config->reg &USB1_ADDR_MASK );clrbits_le32 (&usb1ctlr->utmip_bias_cfg0,UTMIP_BIASPD );udelay (25 ); clrbits_le32(&usb1ctlr->utmip_bias_cfg1,
@@ -675,7 +675,7 @@ static int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config) config->has_legacy_mode =fdtdec_get_bool (blob, node,"nvidia,has-legacy-mode" );if (config->has_legacy_mode) - port_addr_clear_csc = (u32 ) config->reg; + port_addr_clear_csc = (unsigned long )config->reg; config->periph_id =clock_decode_periph_id (blob, node);if (config->periph_id ==PERIPH_ID_NONE ) {debug ("%s: Missing/invalid peripheral ID\n" , __func__);
Signature · 1 line
2.3.2
Marek Vasut
AppliedPATCH 12/13 usb: ehci-tegra: Build warning fixes for 64-bit
Quoted 8 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Cast pointers to unsigned long instead of a sized 32-bit type to avoid pointer to integer cast size mismatch warnings.
Cc Tom Warren <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Thierry Reding <[email protected]>
Applied, thanks!
Best regards,
Marek Vasut
PATCH 13/13 fdt: Build warning fixes for 64-bit
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use the %lx printf specifier to print unsigned long variables to avoid a build warning on 64-bit.
--- lib/fdtdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/fdtdec.c +2 -2
@@ -103,8 +103,8 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node, size = (fdt_size_t *)((char *)cell +sizeof (fdt_addr_t)); *sizep =fdt_size_to_cpu (*size); -debug ("addr=%08lx, size=%08x\n" , - (ulong )addr, *sizep); +debug ("addr=%08lx, size=%08lx\n" , + (ulong )addr, (ulong)*sizep); }else {debug ("%08lx\n" , (ulong )addr); }
Signature · 1 line
2.3.2