* [PATCH 1/2] spi: core: Use %zu for printing 'size_t' type
@ 2016-02-17 15:20 Fabio Estevam
[not found] ` <1455722424-15490-1-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2016-02-17 15:20 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Fabio Estevam
Use %zu for printing 'size_t' type in order to fix the following
build warning on ARM64:
drivers/spi/spi.c: In function '__spi_split_transfer_maxsize':
drivers/spi/spi.c:2278:2: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
Signed-off-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
---
drivers/spi/spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f6c76be..0725ffa 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2276,7 +2276,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
/* warn once about this fact that we are splitting a transfer */
dev_warn_once(&msg->spi->dev,
- "spi_transfer of length %i exceed max length of %i - needed to split transfers\n",
+ "spi_transfer of length %i exceed max length of %zu - needed to split transfers\n",
xfer->len, maxsize);
/* calculate how many we have to replace */
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] spi: core: Use cast inside 'min' macro
[not found] ` <1455722424-15490-1-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
@ 2016-02-17 15:20 ` Fabio Estevam
[not found] ` <1455722424-15490-2-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
2016-02-17 17:35 ` [PATCH 1/2] spi: core: Use %zu for printing 'size_t' type Geert Uytterhoeven
2016-02-17 19:18 ` Applied "spi: core: Use %zu for printing 'size_t' type" to the spi tree Mark Brown
2 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2016-02-17 15:20 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Fabio Estevam
Use cast inside 'min' macro in order to avoid the following
build warning on ARM64:
include/linux/kernel.h:754:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_min1 == &_min2); \
^
drivers/spi/spi.c:2304:17: note: in expansion of macro 'min'
xfers[0].len = min(maxsize, xfer[0].len);
Signed-off-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
---
drivers/spi/spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0725ffa..4498f40 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2301,7 +2301,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
/* the first transfer just needs the length modified, so we
* run it outside the loop
*/
- xfers[0].len = min(maxsize, xfer[0].len);
+ xfers[0].len = min(maxsize, (size_t)xfer[0].len);
/* all the others need rx_buf/tx_buf also set */
for (i = 1, offset = maxsize; i < count; offset += maxsize, i++) {
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] spi: core: Use cast inside 'min' macro
[not found] ` <1455722424-15490-2-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
@ 2016-02-17 17:34 ` Geert Uytterhoeven
0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2016-02-17 17:34 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Mark Brown, linux-spi
On Wed, Feb 17, 2016 at 4:20 PM, Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org> wrote:
> Use cast inside 'min' macro in order to avoid the following
> build warning on ARM64:
>
> include/linux/kernel.h:754:17: warning: comparison of distinct pointer types lacks a cast
> (void) (&_min1 == &_min2); \
> ^
> drivers/spi/spi.c:2304:17: note: in expansion of macro 'min'
> xfers[0].len = min(maxsize, xfer[0].len);
>
> Signed-off-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
> ---
> drivers/spi/spi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 0725ffa..4498f40 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -2301,7 +2301,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
> /* the first transfer just needs the length modified, so we
> * run it outside the loop
> */
> - xfers[0].len = min(maxsize, xfer[0].len);
> + xfers[0].len = min(maxsize, (size_t)xfer[0].len);
Please use "min_t(size_t, ..., ...)" instead of explicit casting.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] spi: core: Use %zu for printing 'size_t' type
[not found] ` <1455722424-15490-1-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
2016-02-17 15:20 ` [PATCH 2/2] spi: core: Use cast inside 'min' macro Fabio Estevam
@ 2016-02-17 17:35 ` Geert Uytterhoeven
2016-02-17 19:18 ` Applied "spi: core: Use %zu for printing 'size_t' type" to the spi tree Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2016-02-17 17:35 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Mark Brown, linux-spi
On Wed, Feb 17, 2016 at 4:20 PM, Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org> wrote:
> Use %zu for printing 'size_t' type in order to fix the following
> build warning on ARM64:
>
> drivers/spi/spi.c: In function '__spi_split_transfer_maxsize':
> drivers/spi/spi.c:2278:2: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
>
> Signed-off-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
Acked-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
However, I'm still wondering whether using size_t for this variable is
the right thing to
do. Maximum SPI transfer length is unsigned int.
> ---
> drivers/spi/spi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index f6c76be..0725ffa 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -2276,7 +2276,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
>
> /* warn once about this fact that we are splitting a transfer */
> dev_warn_once(&msg->spi->dev,
> - "spi_transfer of length %i exceed max length of %i - needed to split transfers\n",
> + "spi_transfer of length %i exceed max length of %zu - needed to split transfers\n",
> xfer->len, maxsize);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Applied "spi: core: Use %zu for printing 'size_t' type" to the spi tree
[not found] ` <1455722424-15490-1-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
2016-02-17 15:20 ` [PATCH 2/2] spi: core: Use cast inside 'min' macro Fabio Estevam
2016-02-17 17:35 ` [PATCH 1/2] spi: core: Use %zu for printing 'size_t' type Geert Uytterhoeven
@ 2016-02-17 19:18 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-02-17 19:18 UTC (permalink / raw)
To: Fabio Estevam, Geert Uytterhoeven, Martin Sperl, Mark Brown
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
The patch
spi: core: Use %zu for printing 'size_t' type
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 7d62f51e74c62afc79f63c70ae48f1b8de57f5d4 Mon Sep 17 00:00:00 2001
From: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
Date: Wed, 17 Feb 2016 15:42:27 -0200
Subject: [PATCH] spi: core: Use %zu for printing 'size_t' type
Use %zu for printing 'size_t' type in order to fix the following
build warning on ARM64:
drivers/spi/spi.c: In function '__spi_split_transfer_maxsize':
drivers/spi/spi.c:2278:2: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
Signed-off-by: Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>
Acked-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
Acked-by: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/spi/spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 9490273ed811..9ae199db171b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2254,7 +2254,7 @@ static int __spi_split_transfer_maxsize(struct spi_master *master,
/* warn once about this fact that we are splitting a transfer */
dev_warn_once(&msg->spi->dev,
- "spi_transfer of length %i exceed max length of %i - needed to split transfers\n",
+ "spi_transfer of length %i exceed max length of %zu - needed to split transfers\n",
xfer->len, maxsize);
/* calculate how many we have to replace */
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-17 19:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 15:20 [PATCH 1/2] spi: core: Use %zu for printing 'size_t' type Fabio Estevam
[not found] ` <1455722424-15490-1-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
2016-02-17 15:20 ` [PATCH 2/2] spi: core: Use cast inside 'min' macro Fabio Estevam
[not found] ` <1455722424-15490-2-git-send-email-fabio.estevam-3arQi8VN3Tc@public.gmane.org>
2016-02-17 17:34 ` Geert Uytterhoeven
2016-02-17 17:35 ` [PATCH 1/2] spi: core: Use %zu for printing 'size_t' type Geert Uytterhoeven
2016-02-17 19:18 ` Applied "spi: core: Use %zu for printing 'size_t' type" to the spi tree Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).