2006-09-28 13:07:41

by Martin Schwidefsky

[permalink] [raw]
Subject: [S390] hypfs sparse warnings.

From: Michael Holzheu <[email protected]>

[S390] hypfs sparse warnings.

sparse complains, if we use bitwise operations on enums. Cast enum to
long in order to fix that problem!

Signed-off-by: Michael Holzheu <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
---

arch/s390/hypfs/hypfs_diag.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)

diff -urpN linux-2.6/arch/s390/hypfs/hypfs_diag.c linux-2.6-patched/arch/s390/hypfs/hypfs_diag.c
--- linux-2.6/arch/s390/hypfs/hypfs_diag.c 2006-09-28 14:58:39.000000000 +0200
+++ linux-2.6-patched/arch/s390/hypfs/hypfs_diag.c 2006-09-28 14:58:52.000000000 +0200
@@ -403,7 +403,8 @@ static void *diag204_get_buffer(enum dia
*pages = 1;
return diag204_alloc_rbuf();
} else {/* INFO_EXT */
- *pages = diag204(SUBC_RSI | INFO_EXT, 0, NULL);
+ *pages = diag204((unsigned long)SUBC_RSI |
+ (unsigned long)INFO_EXT, 0, NULL);
if (*pages <= 0)
return ERR_PTR(-ENOSYS);
else


2006-09-28 13:25:42

by Jörn Engel

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

On Thu, 28 September 2006 15:07:37 +0200, Martin Schwidefsky wrote:
>
> sparse complains, if we use bitwise operations on enums. Cast enum to
> long in order to fix that problem!

At this point I start to wonder which part should be changed. Is it
better to
a) cast some more, as you started to do,
b) change enums to #defines or
c) change '|' to '+'?

At any rate, you have the same problem in 5 seperate places by my
count and only changed 1 of them. Nak - in case anyone cares.

J?rn

--
The competent programmer is fully aware of the strictly limited size of
his own skull; therefore he approaches the programming task in full
humility, and among other things he avoids clever tricks like the plague.
-- Edsger W. Dijkstra

2006-09-28 13:32:05

by Al Viro

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

On Thu, Sep 28, 2006 at 03:25:40PM +0200, J?rn Engel wrote:
> On Thu, 28 September 2006 15:07:37 +0200, Martin Schwidefsky wrote:
> >
> > sparse complains, if we use bitwise operations on enums. Cast enum to
> > long in order to fix that problem!
>
> At this point I start to wonder which part should be changed. Is it
> better to
> a) cast some more, as you started to do,
> b) change enums to #defines or
> c) change '|' to '+'?
>
> At any rate, you have the same problem in 5 seperate places by my
> count and only changed 1 of them. Nak - in case anyone cares.

Split enums sanely.

2006-09-28 13:43:56

by Heiko Carstens

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

On Thu, Sep 28, 2006 at 03:25:40PM +0200, J?rn Engel wrote:
> On Thu, 28 September 2006 15:07:37 +0200, Martin Schwidefsky wrote:
> >
> > sparse complains, if we use bitwise operations on enums. Cast enum to
> > long in order to fix that problem!
>
> At this point I start to wonder which part should be changed. Is it
> better to
> a) cast some more, as you started to do,
> b) change enums to #defines or
> c) change '|' to '+'?
>
> At any rate, you have the same problem in 5 seperate places by my
> count and only changed 1 of them. Nak - in case anyone cares.

That would be where? My sparse run didn't reveal anything else.

2006-09-28 13:54:10

by Jörn Engel

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

On Thu, 28 September 2006 15:42:47 +0200, Heiko Carstens wrote:
> On Thu, Sep 28, 2006 at 03:25:40PM +0200, J?rn Engel wrote:
> > On Thu, 28 September 2006 15:07:37 +0200, Martin Schwidefsky wrote:
> > >
> > > sparse complains, if we use bitwise operations on enums. Cast enum to
> > > long in order to fix that problem!
> >
> > At this point I start to wonder which part should be changed. Is it
> > better to
> > a) cast some more, as you started to do,
> > b) change enums to #defines or
> > c) change '|' to '+'?
> >
> > At any rate, you have the same problem in 5 seperate places by my
> > count and only changed 1 of them. Nak - in case anyone cares.
>
> That would be where? My sparse run didn't reveal anything else.

Search for diag204. All calls have the same format with bitwise or of
two enums, so they are all equally (in-)correct.

J?rn

--
Prosperity makes friends, adversity tries them.
-- Publilius Syrus

2006-09-28 13:54:38

by Michael Holzheu

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

Hi J?rn,

J?rn Engel <[email protected]> wrote on 09/28/2006 03:25:40 PM:

> On Thu, 28 September 2006 15:07:37 +0200, Martin Schwidefsky wrote:
> >
> > sparse complains, if we use bitwise operations on enums. Cast enum to
> > long in order to fix that problem!
>
> At this point I start to wonder which part should be changed. Is it
> better to
> a) cast some more, as you started to do,

I have done that! Martin already has submitted this patch.

Michael

2006-09-28 14:22:49

by Heiko Carstens

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

On Thu, Sep 28, 2006 at 03:54:06PM +0200, J?rn Engel wrote:
> On Thu, 28 September 2006 15:42:47 +0200, Heiko Carstens wrote:
> > On Thu, Sep 28, 2006 at 03:25:40PM +0200, J?rn Engel wrote:
> > > On Thu, 28 September 2006 15:07:37 +0200, Martin Schwidefsky wrote:
> > > >
> > > > sparse complains, if we use bitwise operations on enums. Cast enum to
> > > > long in order to fix that problem!
> > >
> > > At this point I start to wonder which part should be changed. Is it
> > > better to
> > > a) cast some more, as you started to do,
> > > b) change enums to #defines or
> > > c) change '|' to '+'?
> > >
> > > At any rate, you have the same problem in 5 seperate places by my
> > > count and only changed 1 of them. Nak - in case anyone cares.
> >
> > That would be where? My sparse run didn't reveal anything else.
>
> Search for diag204. All calls have the same format with bitwise or of
> two enums, so they are all equally (in-)correct.

You probably need to update your git tree. All of them have casts in the
meantime. Except for the one addressed with this patch.
See: 331c982d4a6b43cdc0d056956a1cae8a7d6237bf

2006-09-28 14:44:18

by Jörn Engel

[permalink] [raw]
Subject: Re: [S390] hypfs sparse warnings.

On Thu, 28 September 2006 16:21:39 +0200, Heiko Carstens wrote:
>
> You probably need to update your git tree. All of them have casts in the
> meantime. Except for the one addressed with this patch.
> See: 331c982d4a6b43cdc0d056956a1cae8a7d6237bf

Doh!

J?rn

--
He who knows that enough is enough will always have enough.
-- Lao Tsu