* [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings
@ 2008-10-29 21:22 akpm
2008-10-29 21:29 ` Ben Hutchings
2008-11-06 5:39 ` Jeff Garzik
0 siblings, 2 replies; 5+ messages in thread
From: akpm @ 2008-10-29 21:22 UTC (permalink / raw)
To: jeff; +Cc: netdev, akpm, bhutchings, jgarzik
From: Andrew Morton <akpm@linux-foundation.org>
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.
Cc: Ben Hutchings <bhutchings@solarflare.com>
Cc: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
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-warnings drivers/net/sfc/falcon.c
--- a/drivers/net/sfc/falcon.c~drivers-net-sfc-falconc-fix-min-warnings
+++ a/drivers/net/sfc/falcon.c
@@ -1685,8 +1685,8 @@ static int falcon_spi_cmd(const struct e
return 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_spi
int 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_sp
if (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,
_
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings
2008-10-29 21:22 [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings akpm
@ 2008-10-29 21:29 ` Ben Hutchings
2008-10-29 21:35 ` Andrew Morton
2008-11-06 5:39 ` Jeff Garzik
1 sibling, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2008-10-29 21:29 UTC (permalink / raw)
To: akpm; +Cc: jeff, netdev
On Wed, 2008-10-29 at 14:22 -0700, akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
>
> 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
These were already fixed by 31b760202a0911384fa07796df9d1905e9e89a7f.
> 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.
--
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings
2008-10-29 21:29 ` Ben Hutchings
@ 2008-10-29 21:35 ` Andrew Morton
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2008-10-29 21:35 UTC (permalink / raw)
To: Ben Hutchings; +Cc: jeff, netdev
On Wed, 29 Oct 2008 21:29:04 +0000
Ben Hutchings <bhutchings@solarflare.com> wrote:
> On Wed, 2008-10-29 at 14:22 -0700, akpm@linux-foundation.org wrote:
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> > 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
>
> These were already fixed by 31b760202a0911384fa07796df9d1905e9e89a7f.
That patch worsened things.
> > 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.
I have plenty of things to be going on with.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings
2008-10-29 21:22 [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings akpm
2008-10-29 21:29 ` Ben Hutchings
@ 2008-11-06 5:39 ` Jeff Garzik
2008-11-06 12:33 ` Ben Hutchings
1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2008-11-06 5:39 UTC (permalink / raw)
To: akpm; +Cc: netdev, bhutchings, jgarzik
akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
>
> 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.
>
> Cc: Ben Hutchings <bhutchings@solarflare.com>
> Cc: Jeff Garzik <jgarzik@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> 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-warnings drivers/net/sfc/falcon.c
> --- a/drivers/net/sfc/falcon.c~drivers-net-sfc-falconc-fix-min-warnings
> +++ a/drivers/net/sfc/falcon.c
> @@ -1685,8 +1685,8 @@ static int falcon_spi_cmd(const struct e
> return 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_spi
> int 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_sp
> if (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()...
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings
2008-11-06 5:39 ` Jeff Garzik
@ 2008-11-06 12:33 ` Ben Hutchings
0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2008-11-06 12:33 UTC (permalink / raw)
To: Jeff Garzik; +Cc: akpm, netdev, jgarzik
On Thu, 2008-11-06 at 00:39 -0500, Jeff Garzik wrote:
> akpm@linux-foundation.org wrote:
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> > 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.
[...]
> 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.
--
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-11-06 12:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 21:22 [patch 6/7] drivers/net/sfc/falcon.c: fix min() warnings akpm
2008-10-29 21:29 ` Ben Hutchings
2008-10-29 21:35 ` Andrew Morton
2008-11-06 5:39 ` Jeff Garzik
2008-11-06 12:33 ` Ben Hutchings
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).