diff mbox

[v2,2/2] spi: core: Use min_t(size_t,..)

Message ID 1455730948-24938-2-git-send-email-fabio.estevam@nxp.com (mailing list archive)
State Accepted
Commit c8dab77a1f92095674e4d7fcb151cac4630e10f9
Headers show

Commit Message

Fabio Estevam Feb. 17, 2016, 5:42 p.m. UTC
Use min_t(size_t,..) 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);

Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Changes since v1:
- Use min_t(size_t (Geert).

 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Sperl Feb. 17, 2016, 6:23 p.m. UTC | #1
> On 17.02.2016, at 18:42, Fabio Estevam <fabio.estevam@nxp.com> wrote:
> 
> Use min_t(size_t,..) 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);
> 
> Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Thanks, was busy with other stuff and thus could not 
create a patch myself.

Acked-by: Martin Sperl <kernel@martin.sperl.org>--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0725ffa..4f42f09 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_t(size_t, maxsize, xfer[0].len);
 
 	/* all the others need rx_buf/tx_buf also set */
 	for (i = 1, offset = maxsize; i < count; offset += maxsize, i++) {