mmc: davinci: Fix -Wpointer-to-int-cast on compile test
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
@@ -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
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
@@ -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
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]Signed-off-by Krzysztof Kozlowski <[email protected]>
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@@ -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
PATCH 3/3 mmc: s3cmci: Cast driver data through long
In reply to Krzysztof KozlowskiSince 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
@@ -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
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.
Signed-off-by Krzysztof Kozlowski <[email protected]>
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@@ -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
Quoted 8 lines · Krzysztof Kozlowski
Store in interrupt service routine always '1' in
end_command, not the value ofhost->cmdto 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]Signed-off-by Krzysztof Kozlowski <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 24 lines
---
Follow up to:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#tdrivers/mmc/host/davinci_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/host/davinci_mmc.c +1
-2@@ -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