2010-11-29 00:53:07

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warning after merge of the mfd tree

Hi Samuel,

After merging the mfd tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'

Introduced by commit a0d4503a044e67ac46adfe8f42eddefd2b60f85e ("mfd: Add
cs5535-mfd driver for AMD Geode's CS5535/CS5536 support").

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (521.00 B)
(No filename) (490.00 B)
Download all attachments

2010-11-30 04:44:21

by Andres Salomon

[permalink] [raw]
Subject: [PATCH] cs5535-mfd: fix warning on x86-64

On Mon, 29 Nov 2010 11:52:57 +1100
Stephen Rothwell <[email protected]> wrote:

> Hi Samuel,
>
> After merging the mfd tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> 'int', but argument 3 has type 'long unsigned int'
>

Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64. The
patch below fixes this.




From: Andres Salomon <[email protected]>

ARRAY_SIZE() returns unsigned long on x86-64 (rather than unsigned int);
cast it to the desired type to shut gcc up.

Signed-off-by: Andres Salomon <[email protected]>
---
drivers/mfd/cs5535-mfd.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
index b141ca7..e6f7ebc 100644
--- a/drivers/mfd/cs5535-mfd.c
+++ b/drivers/mfd/cs5535-mfd.c
@@ -103,8 +103,8 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
goto err_disable;
}

- dev_info(&pdev->dev, "%d devices registered.\n",
- ARRAY_SIZE(cs5535_mfd_cells));
+ dev_info(&pdev->dev, "%u devices registered.\n",
+ (unsigned int) ARRAY_SIZE(cs5535_mfd_cells));

return 0;

--
1.7.2.3


Attachments:
signature.asc (198.00 B)

2010-11-30 10:01:42

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64

Hi Andres,

On Mon, Nov 29, 2010 at 08:44:10PM -0800, Andres Salomon wrote:
> On Mon, 29 Nov 2010 11:52:57 +1100
> Stephen Rothwell <[email protected]> wrote:
>
> > Hi Samuel,
> >
> > After merging the mfd tree, today's linux-next build (x86_64
> > allmodconfig) produced this warning:
> >
> > drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> > drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> > 'int', but argument 3 has type 'long unsigned int'
> >
>
> Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64. The
> patch below fixes this.
>
>
>
>
> From: Andres Salomon <[email protected]>
>
> ARRAY_SIZE() returns unsigned long on x86-64 (rather than unsigned int);
> cast it to the desired type to shut gcc up.
Patch applied, many thanks.
I'll look at your subdevices patches by the end of this week.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/

2010-11-30 10:02:53

by Samuel Ortiz

[permalink] [raw]
Subject: Re: linux-next: build warning after merge of the mfd tree

Hi Stephen,

On Mon, Nov 29, 2010 at 11:52:57AM +1100, Stephen Rothwell wrote:
> Hi Samuel,
>
> After merging the mfd tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'
>
> Introduced by commit a0d4503a044e67ac46adfe8f42eddefd2b60f85e ("mfd: Add
> cs5535-mfd driver for AMD Geode's CS5535/CS5536 support").
That should be fixed by now, thanks for the report.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/

2010-11-30 19:23:50

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64

On Mon, 29 Nov 2010 20:44:10 -0800 Andres Salomon wrote:

> On Mon, 29 Nov 2010 11:52:57 +1100
> Stephen Rothwell <[email protected]> wrote:
>
> > Hi Samuel,
> >
> > After merging the mfd tree, today's linux-next build (x86_64
> > allmodconfig) produced this warning:
> >
> > drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> > drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> > 'int', but argument 3 has type 'long unsigned int'
> >
>
> Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64. The
> patch below fixes this.
>

No, it's a sizeof(), so it should be printed with %zd.
That works on x86_64 or i386.

>
>
>
> From: Andres Salomon <[email protected]>
>
> ARRAY_SIZE() returns unsigned long on x86-64 (rather than unsigned int);
> cast it to the desired type to shut gcc up.
>
> Signed-off-by: Andres Salomon <[email protected]>
> ---
> drivers/mfd/cs5535-mfd.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
> index b141ca7..e6f7ebc 100644
> --- a/drivers/mfd/cs5535-mfd.c
> +++ b/drivers/mfd/cs5535-mfd.c
> @@ -103,8 +103,8 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
> goto err_disable;
> }
>
> - dev_info(&pdev->dev, "%d devices registered.\n",
> - ARRAY_SIZE(cs5535_mfd_cells));
> + dev_info(&pdev->dev, "%u devices registered.\n",
> + (unsigned int) ARRAY_SIZE(cs5535_mfd_cells));
>
> return 0;
>
> --
> 1.7.2.3
>


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

2010-11-30 21:44:13

by Andres Salomon

[permalink] [raw]
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64

On Tue, 30 Nov 2010 10:22:57 -0800
Randy Dunlap <[email protected]> wrote:

> On Mon, 29 Nov 2010 20:44:10 -0800 Andres Salomon wrote:
>
> > On Mon, 29 Nov 2010 11:52:57 +1100
> > Stephen Rothwell <[email protected]> wrote:
> >
> > > Hi Samuel,
> > >
> > > After merging the mfd tree, today's linux-next build (x86_64
> > > allmodconfig) produced this warning:
> > >
> > > drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> > > drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> > > 'int', but argument 3 has type 'long unsigned int'
> > >
> >
> > Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64.
> > The patch below fixes this.
> >
>
> No, it's a sizeof(), so it should be printed with %zd.
> That works on x86_64 or i386.
>

Thanks Randy. I'll provide a new patch.

2010-11-30 21:54:43

by Andres Salomon

[permalink] [raw]
Subject: [PATCH] cs5535-mfd: fix warning on x86-64 (v2)


ARRAY_SIZE() returns size_t; use %zu instead of %d so that we don't
get warnings on x86-64.

Signed-off-by: Andres Salomon <[email protected]>
---
drivers/mfd/cs5535-mfd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
index b141ca7..59ca6f1 100644
--- a/drivers/mfd/cs5535-mfd.c
+++ b/drivers/mfd/cs5535-mfd.c
@@ -103,7 +103,7 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
goto err_disable;
}

- dev_info(&pdev->dev, "%d devices registered.\n",
+ dev_info(&pdev->dev, "%zu devices registered.\n",
ARRAY_SIZE(cs5535_mfd_cells));

return 0;
--
1.7.2.3

2010-11-30 22:37:29

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64 (v2)

On 11/30/10 13:54, Andres Salomon wrote:
>
> ARRAY_SIZE() returns size_t; use %zu instead of %d so that we don't
> get warnings on x86-64.
>
> Signed-off-by: Andres Salomon <[email protected]>

Acked-by: Randy Dunlap <[email protected]>

Glad you used %zu instead of %zd.

> ---
> drivers/mfd/cs5535-mfd.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
> index b141ca7..59ca6f1 100644
> --- a/drivers/mfd/cs5535-mfd.c
> +++ b/drivers/mfd/cs5535-mfd.c
> @@ -103,7 +103,7 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
> goto err_disable;
> }
>
> - dev_info(&pdev->dev, "%d devices registered.\n",
> + dev_info(&pdev->dev, "%zu devices registered.\n",
> ARRAY_SIZE(cs5535_mfd_cells));
>
> return 0;


--
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

2010-12-07 18:38:12

by Andres Salomon

[permalink] [raw]
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64

On Tue, 30 Nov 2010 11:01:38 +0100
Samuel Ortiz <[email protected]> wrote:

> Hi Andres,
>
> On Mon, Nov 29, 2010 at 08:44:10PM -0800, Andres Salomon wrote:
> > On Mon, 29 Nov 2010 11:52:57 +1100
> > Stephen Rothwell <[email protected]> wrote:
> >
> > > Hi Samuel,
> > >
> > > After merging the mfd tree, today's linux-next build (x86_64
> > > allmodconfig) produced this warning:
> > >
> > > drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> > > drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> > > 'int', but argument 3 has type 'long unsigned int'
> > >
> >
> > Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64.
> > The patch below fixes this.
> >
> >
> >
> >
> > From: Andres Salomon <[email protected]>
> >
> > ARRAY_SIZE() returns unsigned long on x86-64 (rather than unsigned
> > int); cast it to the desired type to shut gcc up.
> Patch applied, many thanks.
> I'll look at your subdevices patches by the end of this week.
>

Did you get the chance to look at them? Also, note that there's an
updated patch for the cs5535-mfd warnings (v2, acked by Randy).

2010-12-09 11:49:37

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64

Hi Andres,

On Tue, Dec 07, 2010 at 10:38:06AM -0800, Andres Salomon wrote:
> On Tue, 30 Nov 2010 11:01:38 +0100
> Samuel Ortiz <[email protected]> wrote:
>
> > Hi Andres,
> >
> > On Mon, Nov 29, 2010 at 08:44:10PM -0800, Andres Salomon wrote:
> > > On Mon, 29 Nov 2010 11:52:57 +1100
> > > Stephen Rothwell <[email protected]> wrote:
> > >
> > > > Hi Samuel,
> > > >
> > > > After merging the mfd tree, today's linux-next build (x86_64
> > > > allmodconfig) produced this warning:
> > > >
> > > > drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> > > > drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> > > > 'int', but argument 3 has type 'long unsigned int'
> > > >
> > >
> > > Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64.
> > > The patch below fixes this.
> > >
> > >
> > >
> > >
> > > From: Andres Salomon <[email protected]>
> > >
> > > ARRAY_SIZE() returns unsigned long on x86-64 (rather than unsigned
> > > int); cast it to the desired type to shut gcc up.
> > Patch applied, many thanks.
> > I'll look at your subdevices patches by the end of this week.
> >
>
> Did you get the chance to look at them? Also, note that there's an
> updated patch for the cs5535-mfd warnings (v2, acked by Randy).

Yes, I've taken this one, along with the gpio and misc subdevices drivers.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/