2012-06-09 08:14:08

by Ezequiel Garcia

[permalink] [raw]
Subject: [PATCH 1/6] sh: fix compiler warning by properly inlining flat_set_persistent()

This patch removes the following warning:
fs/binfmt_flat.c:752: warning: unused variable ‘persistent’
There is neither change in functionality, nor extra code generated.

Cc: Paul Mundt <[email protected]>
Cc: <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
---
arch/sh/include/asm/flat.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/sh/include/asm/flat.h b/arch/sh/include/asm/flat.h
index 5d84df5..51dd7af 100644
--- a/arch/sh/include/asm/flat.h
+++ b/arch/sh/include/asm/flat.h
@@ -18,7 +18,12 @@
#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
#define flat_get_relocate_addr(rel) (rel)
-#define flat_set_persistent(relval, p) ({ (void)p; 0; })
+
+static inline int flat_set_persistent(unsigned long relval,
+ unsigned long *persistent)
+{
+ return 0;
+}

#define FLAT_PLAT_INIT(_r) \
do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
--
1.7.3.4


2012-06-09 08:14:13

by Ezequiel Garcia

[permalink] [raw]
Subject: [PATCH 2/6] arm: fix compiler warning by properly inlining flat_set_persistent()

This patch removes the following warning:
fs/binfmt_flat.c:752: warning: unused variable ‘persistent’
There is neither change in functionality, nor extra code generated.

Cc: Russell King <[email protected]>
Cc: <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
---
arch/arm/include/asm/flat.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/flat.h b/arch/arm/include/asm/flat.h
index 59426a4..6ef6cc5 100644
--- a/arch/arm/include/asm/flat.h
+++ b/arch/arm/include/asm/flat.h
@@ -11,6 +11,11 @@
#define flat_get_addr_from_rp(rp, relval, flags, persistent) get_unaligned(rp)
#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
#define flat_get_relocate_addr(rel) (rel)
-#define flat_set_persistent(relval, p) 0
+
+static inline int flat_set_persistent(unsigned long relval,
+ unsigned long *persistent)
+{
+ return 0;
+}

#endif /* __ARM_FLAT_H__ */
--
1.7.3.4

2012-06-09 08:14:37

by Ezequiel Garcia

[permalink] [raw]
Subject: [PATCH 4/6] microblaze: fix compiler warning by properly inlining flat_set_persistent()

This patch removes the following warning:
fs/binfmt_flat.c:752: warning: unused variable ‘persistent’
There is neither change in functionality, nor extra code generated.

Cc: Michal Simek <[email protected]>
Cc: <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
---
arch/microblaze/include/asm/flat.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/microblaze/include/asm/flat.h b/arch/microblaze/include/asm/flat.h
index 6847c15..40602c8 100644
--- a/arch/microblaze/include/asm/flat.h
+++ b/arch/microblaze/include/asm/flat.h
@@ -16,7 +16,12 @@
#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
-#define flat_set_persistent(relval, p) 0
+
+static inline int flat_set_persistent(unsigned long relval,
+ unsigned long *persistent)
+{
+ return 0;
+}

/*
* Microblaze works a little differently from other arches, because
--
1.7.3.4

2012-06-09 08:14:32

by Ezequiel Garcia

[permalink] [raw]
Subject: [PATCH 3/6] xtensa: fix compiler warning by properly inlining flat_set_persistent()

This patch removes the following warning:
fs/binfmt_flat.c:752: warning: unused variable ‘persistent’
There is neither change in functionality, nor extra code generated.

Cc: Chris Zankel <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
---
arch/xtensa/include/asm/flat.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/xtensa/include/asm/flat.h b/arch/xtensa/include/asm/flat.h
index 94c44ab..2f5c384 100644
--- a/arch/xtensa/include/asm/flat.h
+++ b/arch/xtensa/include/asm/flat.h
@@ -7,6 +7,11 @@
#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
#define flat_put_addr_at_rp(rp, val, relval ) put_unaligned(val, rp)
#define flat_get_relocate_addr(rel) (rel)
-#define flat_set_persistent(relval, p) 0
+
+static inline int flat_set_persistent(unsigned long relval,
+ unsigned long *persistent)
+{
+ return 0;
+}

#endif /* __ASM_XTENSA_FLAT_H */
--
1.7.3.4

2012-06-09 08:14:58

by Ezequiel Garcia

[permalink] [raw]
Subject: [PATCH 6/6] h8300: fix compiler warning by properly inlining flat_set_persistent()

This patch removes the following warning:
fs/binfmt_flat.c:752: warning: unused variable ‘persistent’
There is neither change in functionality, nor extra code generated.

Cc: Yoshinori Sato <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
---
arch/h8300/include/asm/flat.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/h8300/include/asm/flat.h b/arch/h8300/include/asm/flat.h
index bd12b31..24e9c93 100644
--- a/arch/h8300/include/asm/flat.h
+++ b/arch/h8300/include/asm/flat.h
@@ -8,7 +8,12 @@
#define flat_argvp_envp_on_stack() 1
#define flat_old_ram_flag(flags) 1
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
-#define flat_set_persistent(relval, p) 0
+
+static inline int flat_set_persistent(unsigned long relval,
+ unsigned long *persistent)
+{
+ return 0;
+}

/*
* on the H8 a couple of the relocations have an instruction in the
--
1.7.3.4

2012-06-09 08:15:42

by Ezequiel Garcia

[permalink] [raw]
Subject: [PATCH 5/6] m32r: fix compiler warning by properly inlining flat_set_persistent()

This patch removes the following warning:
fs/binfmt_flat.c:752: warning: unused variable ‘persistent’
There is neither change in functionality, nor extra code generated.

Cc: Hirokazu Takata <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
---
arch/m32r/include/asm/flat.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/m32r/include/asm/flat.h b/arch/m32r/include/asm/flat.h
index 5d711c4..2caf5b8 100644
--- a/arch/m32r/include/asm/flat.h
+++ b/arch/m32r/include/asm/flat.h
@@ -14,7 +14,6 @@

#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
-#define flat_set_persistent(relval, p) 0
#define flat_reloc_valid(reloc, size) \
(((reloc) - textlen_for_m32r_lo16_data) <= (size))
#define flat_get_addr_from_rp(rp, relval, flags, persistent) \
@@ -23,6 +22,12 @@
#define flat_put_addr_at_rp(rp, addr, relval) \
m32r_flat_put_addr_at_rp(rp, addr, relval)

+static inline int flat_set_persistent(unsigned long relval,
+ unsigned long *persistent)
+{
+ return 0;
+}
+
/* Convert a relocation entry into an address. */
static inline unsigned long
flat_get_relocate_addr (unsigned long relval)
--
1.7.3.4

2012-06-09 09:14:32

by Paul Mundt

[permalink] [raw]
Subject: Re: [PATCH 1/6] sh: fix compiler warning by properly inlining flat_set_persistent()

On Sat, Jun 09, 2012 at 05:13:26AM -0300, Ezequiel Garcia wrote:
> This patch removes the following warning:
> fs/binfmt_flat.c:752: warning: unused variable ???persistent???
> There is neither change in functionality, nor extra code generated.
>
> Cc: Paul Mundt <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Ezequiel Garcia <[email protected]>

That's what the cast was for, with what gcc version did that stop
working?

2012-06-09 12:02:28

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [PATCH 1/6] sh: fix compiler warning by properly inlining flat_set_persistent()

On Sat, Jun 9, 2012 at 6:14 AM, Paul Mundt <[email protected]> wrote:
> On Sat, Jun 09, 2012 at 05:13:26AM -0300, Ezequiel Garcia wrote:
>> This patch removes the following warning:
>> fs/binfmt_flat.c:752: warning: unused variable ???persistent???
>> There is neither change in functionality, nor extra code generated.
>>
>> Cc: Paul Mundt <[email protected]>
>> Cc: <[email protected]>
>> Signed-off-by: Ezequiel Garcia <[email protected]>
>
> That's what the cast was for, with what gcc version did that stop
> working?

Mmm. You're right. I did this change first for m68k [1] and when that
went ok, I decided it
was best to propagate this fix to every other arch.

Originally, my first try was to propagate your cast:

#define flat_set_persistent(relval, p) ({ (void)p; 0; })

to the other arches, that just do:

#define flat_set_persistent(relval, p) 0

But, then someone pointed out that inlining would produce some (nil) code
and it seemed better.
To conclude: sh was the only one doing it right, and there is no good
reason to change
it, except to make code more homogeneous.

Hope it is clear now,
Ezequiel.

[1] https://lkml.org/lkml/2012/5/21/491

2012-06-10 21:33:14

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [PATCH 1/6] sh: fix compiler warning by properly inlining flat_set_persistent()

On Sat, Jun 9, 2012 at 6:14 AM, Paul Mundt <[email protected]> wrote:
> On Sat, Jun 09, 2012 at 05:13:26AM -0300, Ezequiel Garcia wrote:
>> This patch removes the following warning:
>> fs/binfmt_flat.c:752: warning: unused variable ???persistent???
>> There is neither change in functionality, nor extra code generated.
>>
>> Cc: Paul Mundt <[email protected]>
>> Cc: <[email protected]>
>> Signed-off-by: Ezequiel Garcia <[email protected]>
>
> That's what the cast was for, with what gcc version did that stop
> working?

I just realized that I should send a v2 (not the whole series just this one)
correcting the commit message, since there wasn't a warning to fix
in first place.

I'll do this soon.

Regards,
Ezequiel.

2012-06-11 03:50:11

by Paul Mundt

[permalink] [raw]
Subject: Re: [PATCH 1/6] sh: fix compiler warning by properly inlining flat_set_persistent()

On Sun, Jun 10, 2012 at 06:33:10PM -0300, Ezequiel Garcia wrote:
> On Sat, Jun 9, 2012 at 6:14 AM, Paul Mundt <[email protected]> wrote:
> > On Sat, Jun 09, 2012 at 05:13:26AM -0300, Ezequiel Garcia wrote:
> >> This patch removes the following warning:
> >> fs/binfmt_flat.c:752: warning: unused variable ???persistent???
> >> There is neither change in functionality, nor extra code generated.
> >>
> >> Cc: Paul Mundt <[email protected]>
> >> Cc: <[email protected]>
> >> Signed-off-by: Ezequiel Garcia <[email protected]>
> >
> > That's what the cast was for, with what gcc version did that stop
> > working?
>
> I just realized that I should send a v2 (not the whole series just this one)
> correcting the commit message, since there wasn't a warning to fix
> in first place.
>
> I'll do this soon.

If there's no warning then the point of the patch eludes me. There's
nothing wrong with consistency, but attempting to fix that which isn't
broken in the name of consistency borders a bit too closely on pointless
busy work for my liking.

2012-06-11 16:29:11

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [PATCH 1/6] sh: fix compiler warning by properly inlining flat_set_persistent()

On Mon, Jun 11, 2012 at 12:50 AM, Paul Mundt <[email protected]> wrote:
> On Sun, Jun 10, 2012 at 06:33:10PM -0300, Ezequiel Garcia wrote:
>> On Sat, Jun 9, 2012 at 6:14 AM, Paul Mundt <[email protected]> wrote:
>> > On Sat, Jun 09, 2012 at 05:13:26AM -0300, Ezequiel Garcia wrote:
>> >> This patch removes the following warning:
>> >> fs/binfmt_flat.c:752: warning: unused variable ???persistent???
>> >> There is neither change in functionality, nor extra code generated.
>> >>
>> >> Cc: Paul Mundt <[email protected]>
>> >> Cc: <[email protected]>
>> >> Signed-off-by: Ezequiel Garcia <[email protected]>
>> >
>> > That's what the cast was for, with what gcc version did that stop
>> > working?
>>
>> I just realized that I should send a v2 (not the whole series just this one)
>> correcting the commit message, since there wasn't a warning to fix
>> in first place.
>>
>> I'll do this soon.
>
> If there's no warning then the point of the patch eludes me. There's
> nothing wrong with consistency, but attempting to fix that which isn't
> broken in the name of consistency borders a bit too closely on pointless
> busy work for my liking.

If you feel like that, then it's perfectly fine with me.
As I already told you, I was going to propagate your magical define to
the rest of arches,
but the inline looked a bit more readable.

Sorry for the noise and thanks for your time.

Regards,
Ezequiel.