Skip to contentSkip to conversation

mmc: davinci: Fix -Wpointer-to-int-cast on compile test

PATCH In review Krzysztof Kozlowski 2 participants 6 messages Sep 2, 2020 – Sep 3, 2020 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mmc: davinci: Fix -Wpointer-to-int-cast on compile test

Store in interrupt service routine always '1' in end_command, not the value of host->cmd to fix compile test warnings on RISC-V:

drivers/mmc/host/davinci_mmc.c:999:17: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]

---

Follow up to:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#t

 drivers/mmc/host/davinci_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/davinci_mmc.c +1 -1
index fad1010fb52b..66d740ee7d45 100644
@@ -996,7 +996,7 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
 
 	if (qstatus & MMCST0_RSPDNE) {
 		/* End of command phase */
-		end_command = (int) host->cmd;
+		end_command = host->cmd ? 1 : 0;
 	}
 
 	if (end_command)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 mmc: s3cmci: Use proper printk format for iomem pointer

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compile testing for 64-bit architecture:

drivers/mmc/host/s3cmci.c:1355:46: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]

---
 drivers/mmc/host/s3cmci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/s3cmci.c +1 -1
index dcd458649338..3fb597095079 100644
@@ -1352,7 +1352,7 @@ static int s3cmci_state_show(struct seq_file *seq, void *v)
 {
 	struct s3cmci_host *host = seq->private;
 
-	seq_printf(seq, "Register base = 0x%08x\n", (u32)host->base);
+	seq_printf(seq, "Register base = 0x%p\n", host->base);
 	seq_printf(seq, "Clock rate = %ld\n", host->clk_rate);
 	seq_printf(seq, "Prescale = %d\n", host->prescaler);
 	seq_printf(seq, "is2440 = %d\n", host->is2440);
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/3] mmc: s3cmci: Use proper printk format for iomem pointer

Quoted 9 lines · Krzysztof Kozlowski

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compile testing for 64-bit architecture:

drivers/mmc/host/s3cmci.c:1355:46: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]

Applied for next, thanks!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/host/s3cmci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/s3cmci.c +1 -2
index dcd458649338..3fb597095079 100644
@@ -1352,7 +1352,7 @@ static int s3cmci_state_show(struct seq_file *seq, void *v)
 {
        struct s3cmci_host *host = seq->private;
 
-       seq_printf(seq, "Register base = 0x%08x\n", (u32)host->base);
+       seq_printf(seq, "Register base = 0x%p\n", host->base);
        seq_printf(seq, "Clock rate = %ld\n", host->clk_rate);
        seq_printf(seq, "Prescale = %d\n", host->prescaler);
        seq_printf(seq, "is2440 = %d\n", host->is2440);
--

2.17.1

#3 lore raw

PATCH 3/3 mmc: s3cmci: Cast driver data through long

In reply to Krzysztof Kozlowski

Since driver data is a pointer, direct casting to integer causes warning when compile testing for 64-bit architecture:

drivers/mmc/host/s3cmci.c:1495:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

The actual driver data can be only 0 or 1, so cast it via long and do not care about any loss of value.

---
 drivers/mmc/host/s3cmci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/s3cmci.c +1 -1
index 3fb597095079..ac94f926624d 100644
@@ -1492,7 +1492,7 @@ static int s3cmci_probe_dt(struct s3cmci_host *host)
 	struct mmc_host *mmc = host->mmc;
 	int ret;
 
-	host->is2440 = (int) of_device_get_match_data(&pdev->dev);
+	host->is2440 = (long) of_device_get_match_data(&pdev->dev);
 
 	ret = mmc_of_parse(mmc);
 	if (ret)
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH 3/3] mmc: s3cmci: Cast driver data through long

Quoted 10 lines · Krzysztof Kozlowski

Since driver data is a pointer, direct casting to integer causes warning when compile testing for 64-bit architecture:

drivers/mmc/host/s3cmci.c:1495:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

The actual driver data can be only 0 or 1, so cast it via long and do not care about any loss of value.

Applied for next, thanks!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/host/s3cmci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/s3cmci.c +1 -2
index 3fb597095079..ac94f926624d 100644
@@ -1492,7 +1492,7 @@ static int s3cmci_probe_dt(struct s3cmci_host *host)
        struct mmc_host *mmc = host->mmc;
        int ret;
 
-       host->is2440 = (int) of_device_get_match_data(&pdev->dev);
+       host->is2440 = (long) of_device_get_match_data(&pdev->dev);
 
        ret = mmc_of_parse(mmc);
        if (ret)
--

2.17.1

#5 lore raw
In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski

Store in interrupt service routine always '1' in end_command, not the value of host->cmd to fix compile test warnings on RISC-V:

drivers/mmc/host/davinci_mmc.c:999:17: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]

Applied for next, thanks!

Kind regards
Uffe

Quoted 24 lines

---

Follow up to:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#t

 drivers/mmc/host/davinci_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/davinci_mmc.c +1 -2
index fad1010fb52b..66d740ee7d45 100644
@@ -996,7 +996,7 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
 
        if (qstatus & MMCST0_RSPDNE) {
                /* End of command phase */
-               end_command = (int) host->cmd;
+               end_command = host->cmd ? 1 : 0;
        }
 
        if (end_command)
--

2.17.1