All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning
@ 2018-06-01  8:52 Ley Foon Tan
  2018-06-01  8:52 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix warning cast from pointer to integer of different size Ley Foon Tan
  2018-06-01  9:55 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning Marek Vasut
  0 siblings, 2 replies; 7+ messages in thread
From: Ley Foon Tan @ 2018-06-01  8:52 UTC (permalink / raw)
  To: u-boot

Use "%lu" for size_t data type.

Compilation warning as below:

In file included from include/linux/bug.h:7:0,
                 from include/common.h:26,
                 from drivers/spi/cadence_qspi.c:8:
drivers/spi/cadence_qspi.c: In function ‘cadence_spi_xfer’:
drivers/spi/cadence_qspi.c:211:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
  debug("%s: len=%d [bytes]\n", __func__, data_bytes);
        ^
include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’
 #define pr_fmt(fmt) fmt
                     ^~~
include/log.h:142:2: note: in expansion of macro ‘debug_cond’
  debug_cond(_DEBUG, fmt, ##args)
  ^~~~~~~~~~
drivers/spi/cadence_qspi.c:211:2: note: in expansion of macro ‘debug’
  debug("%s: len=%d [bytes]\n", __func__, data_bytes);

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>

---
v2: use "%lu" instead of cast data type to ulong.
---
 drivers/spi/cadence_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 91742ba..63249c5 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -207,7 +207,7 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned int bitlen,
 	} else {
 		data_bytes = bitlen / 8;
 	}
-	debug("%s: len=%d [bytes]\n", __func__, data_bytes);
+	debug("%s: len=%lu [bytes]\n", __func__, data_bytes);
 
 	/* Set Chip select */
 	cadence_qspi_apb_chipselect(base, spi_chip_select(dev),
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] spi: cadence_qspi: Change to use devfdt_get_addr_index()
@ 2018-05-07  9:42 Ley Foon Tan
  2018-05-07  9:42 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix warning cast from pointer to integer of different size Ley Foon Tan
  0 siblings, 1 reply; 7+ messages in thread
From: Ley Foon Tan @ 2018-05-07  9:42 UTC (permalink / raw)
  To: u-boot

Change to use devfdt_get_addr_index() function to get fdt address.

Original code has compilation warning below:

drivers/spi/cadence_qspi.c: In function ‘cadence_spi_ofdata_to_platdata’:
drivers/spi/cadence_qspi.c:297:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  plat->regbase = (void *)data[0];
                  ^
drivers/spi/cadence_qspi.c:298:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  plat->ahbbase = (void *)data[2];
                  ^
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 drivers/spi/cadence_qspi.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 7b312f8..f80d073 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -284,18 +284,9 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
 	const void *blob = gd->fdt_blob;
 	int node = dev_of_offset(bus);
 	int subnode;
-	u32 data[4];
-	int ret;
 
-	/* 2 base addresses are needed, lets get them from the DT */
-	ret = fdtdec_get_int_array(blob, node, "reg", data, ARRAY_SIZE(data));
-	if (ret) {
-		printf("Error: Can't get base addresses (ret=%d)!\n", ret);
-		return -ENODEV;
-	}
-
-	plat->regbase = (void *)data[0];
-	plat->ahbbase = (void *)data[2];
+	plat->regbase = (void *)devfdt_get_addr_index(bus, 0);
+	plat->ahbbase = (void *)devfdt_get_addr_index(bus, 1);
 	plat->is_decoded_cs = fdtdec_get_bool(blob, node, "cdns,is-decoded-cs");
 	plat->fifo_depth = fdtdec_get_uint(blob, node, "cdns,fifo-depth", 128);
 	plat->fifo_width = fdtdec_get_uint(blob, node, "cdns,fifo-width", 4);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-01  9:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01  8:52 [U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning Ley Foon Tan
2018-06-01  8:52 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix warning cast from pointer to integer of different size Ley Foon Tan
2018-06-01  9:55   ` Marek Vasut
2018-06-01  9:55 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning Marek Vasut
  -- strict thread matches above, loose matches on Subject: below --
2018-05-07  9:42 [U-Boot] [PATCH] spi: cadence_qspi: Change to use devfdt_get_addr_index() Ley Foon Tan
2018-05-07  9:42 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix warning cast from pointer to integer of different size Ley Foon Tan
2018-06-01  8:07   ` Marek Vasut
2018-06-01  8:24     ` Ley Foon Tan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.