drivers/net/sfc/falcon.c: fix min() warnings
Subsystems (2)
PATCH 6/7 drivers/net/sfc/falcon.c: fix min() warnings
From: Andrew Morton <[email protected]>
drivers/net/sfc/falcon.c: In function 'falcon_spi_write_limit':drivers/net/sfc/falcon.c:1679: warning: comparison of distinct pointer types lacks a cast drivers/net/sfc/falcon.c: In function 'falcon_spi_read':drivers/net/sfc/falcon.c:1720: warning: comparison of distinct pointer types lacks a cast
Driver seems rather confused about types. Try to help it.
---
drivers/net/sfc/falcon.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/sfc/falcon.c renamed from drivers/net/sfc/falcon.c~drivers-net-sfc-falconc-fix-min-warnings +4 -5
@@ -1685,8 +1685,8 @@ static int falcon_spi_cmd(const struct ereturn 0 ; } -static unsigned int -falcon_spi_write_limit (const struct efx_spi_device *spi,unsigned int start) +static size_t +falcon_spi_write_limit (const struct efx_spi_device *spi,size_t start) {return min (FALCON_SPI_MAX_LEN , (spi->block_size - (start & (spi->block_size -1 ))));
@@ -1729,8 +1729,7 @@ int falcon_spi_read(const struct efx_spiint rc =0 ;while (pos < len) { - block_len =min ((unsigned int )len - pos, -FALCON_SPI_MAX_LEN ); + block_len =min (len - pos,FALCON_SPI_MAX_LEN ); command =efx_spi_munge_command (spi,SPI_READ , start + pos); rc = falcon_spi_cmd(spi, command, start + pos, NULL,
@@ -1764,7 +1763,7 @@ int falcon_spi_write(const struct efx_spif (rc)break ; - block_len =min ((unsigned int )len - pos, + block_len =min (len - pos,falcon_spi_write_limit (spi, start + pos)); command =efx_spi_munge_command (spi,SPI_WRITE , start + pos); rc = falcon_spi_cmd(spi, command, start + pos,
_
Quoted 6 lines · On Wed, 2008-10-29 at 14:22 -0700, [email protected] wrote:
From: Andrew Morton <[email protected]>
drivers/net/sfc/falcon.c: In function 'falcon_spi_write_limit':drivers/net/sfc/falcon.c:1679: warning: comparison of distinct pointer types lacks a castdrivers/net/sfc/falcon.c: In function 'falcon_spi_read':drivers/net/sfc/falcon.c:1720: warning: comparison of distinct pointer types lacks a cast
These were already fixed by 31b760202a0911384fa07796df9d1905e9e89a7f.
Quoted 1 line
Driver seems rather confused about types. Try to help it.
[...]
Maybe, but in order to fix that you'll need to revert 31b760202a0911384fa07796df9d1905e9e89a7f along with making these changes.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 9 lines · On Wed, 29 Oct 2008 21:29:04 +0000 Ben Hutchings <[email protected]>…
Quoted 6 lines · On Wed, 2008-10-29 at 14:22 -0700, [email protected] wrote:
From: Andrew Morton <[email protected]>
drivers/net/sfc/falcon.c: In function 'falcon_spi_write_limit':drivers/net/sfc/falcon.c:1679: warning: comparison of distinct pointer types lacks a castdrivers/net/sfc/falcon.c: In function 'falcon_spi_read':drivers/net/sfc/falcon.c:1720: warning: comparison of distinct pointer types lacks a castThese were already fixed by
31b760202a0911384fa07796df9d1905e9e89a7f.
That patch worsened things.
Quoted 6 lines
Quoted 1 line
Driver seems rather confused about types. Try to help it.
[...]
Maybe, but in order to fix that you'll need to revert
31b760202a0911384fa07796df9d1905e9e89a7falong with making these changes.
I have plenty of things to be going on with.
Quoted 42 lines · [email protected] wrote:
From: Andrew Morton <[email protected]>
drivers/net/sfc/falcon.c: In function 'falcon_spi_write_limit':drivers/net/sfc/falcon.c:1679: warning: comparison of distinct pointer types lacks a castdrivers/net/sfc/falcon.c: In function 'falcon_spi_read':drivers/net/sfc/falcon.c:1720: warning: comparison of distinct pointer types lacks a castDriver seems rather confused about types. Try to help it.
Cc Ben Hutchings <[email protected]>Cc Jeff Garzik <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/net/sfc/falcon.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)diff -puN
drivers/net/sfc/falcon.c~drivers-net-sfc-falconc-fix-min-warningsdrivers/net/sfc/falcon.cdrivers/net/sfc/falcon.c renamed from drivers/net/sfc/falcon.c~drivers-net-sfc-falconc-fix-min-warnings +3
-4@@ -1685,8 +1685,8 @@ static int falcon_spi_cmd(const struct ereturn 0 ; } -static unsigned int -falcon_spi_write_limit (const struct efx_spi_device *spi,unsigned int start) +static size_t +falcon_spi_write_limit (const struct efx_spi_device *spi,size_t start) {return min (FALCON_SPI_MAX_LEN , (spi->block_size - (start & (spi->block_size -1 ))));@@ -1729,8 +1729,7 @@ int falcon_spi_read(const struct efx_spiint rc =0 ;while (pos < len) { - block_len =min ((unsigned int )len - pos, -FALCON_SPI_MAX_LEN ); + block_len =min (len - pos,FALCON_SPI_MAX_LEN ); command =efx_spi_munge_command (spi,SPI_READ , start + pos); rc = falcon_spi_cmd(spi, command, start + pos, NULL,
drivers/net/sfc/falcon.c int falcon_spi_write(const struct efx_sp · line 1767
Quoted 6 lines
drivers/net/sfc/falcon.c renamed from drivers/net/sfc/falcon.c~drivers-net-sfc-falconc-fix-min-warnings +1
-1@@ -1764,7 +1763,7 @@ int falcon_spi_write(const struct efx_spif (rc)break ; - block_len =min ((unsigned int )len - pos, + block_len =min (len - pos,falcon_spi_write_limit (spi, start + pos));
I would prefer min_t()...
Quoted 9 lines · Jeff Garzik
Quoted 8 lines · [email protected] wrote:
From: Andrew Morton <[email protected]>
drivers/net/sfc/falcon.c: In function 'falcon_spi_write_limit':drivers/net/sfc/falcon.c:1679: warning: comparison of distinct pointer types lacks a castdrivers/net/sfc/falcon.c: In function 'falcon_spi_read':drivers/net/sfc/falcon.c:1720: warning: comparison of distinct pointer types lacks a castDriver seems rather confused about types. Try to help it.
[...]
Quoted 1 line
I would prefer
min_t()...
Andrew has dropped this patch as it is no longer applicable. I do have a patch to clean up the length types which I'll submit later.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.