2009-12-10 17:25:36

by David Daney

[permalink] [raw]
Subject: [PATCH 0/5] More unreachable() conversions.

Back in commit 38938c879eb0c39edf85d5164aa0cffe2874304c the new macro
unreachable() was added. We can use it in BUG instead of a variety of
ad hoc endless loops.

This patch set consists of the patches from the original set that were
never Acked-by anyone. Although they are completely untested, they
seem plausible.

I don't plan on pushing these things out any more, so if you
like them please merge them via your architecture trees.

I will reply with the 5 patches.

David Daney (5):
mn10300: Convert BUG() to use unreachable()
parisc: Convert BUG() to use unreachable()
powerpc: Convert BUG() to use unreachable()
alpha: Convert BUG() to use unreachable()
blackfin: Convert BUG() to use unreachable()

arch/alpha/include/asm/bug.h | 3 ++-
arch/blackfin/include/asm/bug.h | 2 +-
arch/mn10300/include/asm/bug.h | 3 ++-
arch/parisc/include/asm/bug.h | 4 ++--
arch/powerpc/include/asm/bug.h | 2 +-
5 files changed, 8 insertions(+), 6 deletions(-)


2009-12-10 17:29:23

by David Daney

[permalink] [raw]
Subject: [PATCH 1/5] mn10300: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of while(1).

Signed-off-by: David Daney <[email protected]>
CC: David Howells <[email protected]>
CC: Koichi Yasutake <[email protected]>
CC: [email protected]
---
arch/mn10300/include/asm/bug.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/mn10300/include/asm/bug.h b/arch/mn10300/include/asm/bug.h
index aa6a388..447a7e6 100644
--- a/arch/mn10300/include/asm/bug.h
+++ b/arch/mn10300/include/asm/bug.h
@@ -27,7 +27,8 @@ do { \
: \
: "i"(__FILE__), "i"(__LINE__) \
); \
-} while (1)
+ unreachable(); \
+} while (0)

#define HAVE_ARCH_BUG
#endif /* CONFIG_BUG */
--
1.6.2.5

2009-12-10 17:29:38

by David Daney

[permalink] [raw]
Subject: [PATCH 2/5] parisc: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of for(;;);

Signed-off-by: David Daney <[email protected]>
CC: Kyle McMartin <[email protected]>
CC: Helge Deller <[email protected]>
CC: [email protected]
---
arch/parisc/include/asm/bug.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h
index 8cfc553..75e46c5 100644
--- a/arch/parisc/include/asm/bug.h
+++ b/arch/parisc/include/asm/bug.h
@@ -32,14 +32,14 @@
"\t.popsection" \
: : "i" (__FILE__), "i" (__LINE__), \
"i" (0), "i" (sizeof(struct bug_entry)) ); \
- for(;;) ; \
+ unreachable(); \
} while(0)

#else
#define BUG() \
do { \
asm volatile(PARISC_BUG_BREAK_ASM : : ); \
- for(;;) ; \
+ unreachable(); \
} while(0)
#endif

--
1.6.2.5

2009-12-10 17:29:53

by David Daney

[permalink] [raw]
Subject: [PATCH 3/5] powerpc: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of for(;;);

Signed-off-by: David Daney <[email protected]>
CC: Benjamin Herrenschmidt <[email protected]>
CC: Paul Mackerras <[email protected]>
CC: [email protected]
---
arch/powerpc/include/asm/bug.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
index 64e1fdc..2c15212 100644
--- a/arch/powerpc/include/asm/bug.h
+++ b/arch/powerpc/include/asm/bug.h
@@ -68,7 +68,7 @@
_EMIT_BUG_ENTRY \
: : "i" (__FILE__), "i" (__LINE__), \
"i" (0), "i" (sizeof(struct bug_entry))); \
- for(;;) ; \
+ unreachable(); \
} while (0)

#define BUG_ON(x) do { \
--
1.6.2.5

2009-12-10 17:30:10

by David Daney

[permalink] [raw]
Subject: [PATCH 4/5] alpha: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of for(;;);

Signed-off-by: David Daney <[email protected]>
CC: Richard Henderson <[email protected]>
CC: Ivan Kokshaysky <[email protected]>
CC: Matt Turner <[email protected]>
CC: [email protected]
---
arch/alpha/include/asm/bug.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/alpha/include/asm/bug.h b/arch/alpha/include/asm/bug.h
index 1720c8a..f091682 100644
--- a/arch/alpha/include/asm/bug.h
+++ b/arch/alpha/include/asm/bug.h
@@ -13,7 +13,8 @@
"call_pal %0 # bugchk\n\t" \
".long %1\n\t.8byte %2" \
: : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \
- for ( ; ; ); } while (0)
+ unreachable(); \
+ } while (0)

#define HAVE_ARCH_BUG
#endif
--
1.6.2.5

2009-12-10 17:29:27

by David Daney

[permalink] [raw]
Subject: [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of for(;;);

Signed-off-by: David Daney <[email protected]>
CC: Mike Frysinger <[email protected]>
CC: [email protected]
---
arch/blackfin/include/asm/bug.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/blackfin/include/asm/bug.h b/arch/blackfin/include/asm/bug.h
index 6f4548a..75f6dc3 100644
--- a/arch/blackfin/include/asm/bug.h
+++ b/arch/blackfin/include/asm/bug.h
@@ -47,7 +47,7 @@
#define BUG() \
do { \
_BUG_OR_WARN(0); \
- for (;;); \
+ unreachable(); \
} while (0)

#define WARN_ON(condition) \
--
1.6.2.5

2009-12-10 21:34:05

by Mike Frysinger

[permalink] [raw]
Subject: Re: [Uclinux-dist-devel] [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

On Thu, Dec 10, 2009 at 12:28, David Daney wrote:
> Use the new unreachable() macro instead of for(;;);

sorry, i guess i missed this back in Sept. change looks fine to me
(i'll test it later when finishing putting together other patches).
you want me to push though my queue ? doesnt matter to me.
-mike

2009-12-10 21:36:55

by David Daney

[permalink] [raw]
Subject: Re: [Uclinux-dist-devel] [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

Mike Frysinger wrote:
> On Thu, Dec 10, 2009 at 12:28, David Daney wrote:
>> Use the new unreachable() macro instead of for(;;);
>
> sorry, i guess i missed this back in Sept. change looks fine to me
> (i'll test it later when finishing putting together other patches).
> you want me to push though my queue ? doesnt matter to me.

Yes, if you test it and are happy with it. I have no queue and plan no
further action.

David Daney

2009-12-10 21:54:41

by Kyle McMartin

[permalink] [raw]
Subject: Re: [PATCH 2/5] parisc: Convert BUG() to use unreachable()

On Thu, Dec 10, 2009 at 09:28:18AM -0800, David Daney wrote:
> Use the new unreachable() macro instead of for(;;);
>
> Signed-off-by: David Daney <[email protected]>
> CC: Kyle McMartin <[email protected]>
> CC: Helge Deller <[email protected]>
> CC: [email protected]
> ---

Thanks David, I'll bash this into my tree now that the macro is
upstream.

regards, Kyle

2009-12-10 22:42:52

by Mike Frysinger

[permalink] [raw]
Subject: Re: [Uclinux-dist-devel] [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

On Thu, Dec 10, 2009 at 16:35, David Daney wrote:
> Mike Frysinger wrote:
>> On Thu, Dec 10, 2009 at 12:28, David Daney wrote:
>>> Use the new unreachable() macro instead of for(;;);
>>
>> sorry, i guess i missed this back in Sept.  change looks fine to me
>> (i'll test it later when finishing putting together other patches).
>> you want me to push though my queue ?  doesnt matter to me.
>
> Yes, if you test it and are happy with it.  I have no queue and plan no
> further action.

rgr
-mike

2009-12-11 00:42:58

by Matt Turner

[permalink] [raw]
Subject: Re: [PATCH 4/5] alpha: Convert BUG() to use unreachable()

On Thu, Dec 10, 2009 at 12:28 PM, David Daney <[email protected]> wrote:
> Use the new unreachable() macro instead of for(;;);
>
> Signed-off-by: David Daney <[email protected]>
> CC: Richard Henderson <[email protected]>
> CC: Ivan Kokshaysky <[email protected]>
> CC: Matt Turner <[email protected]>
> CC: [email protected]
> ---
> ?arch/alpha/include/asm/bug.h | ? ?3 ++-
> ?1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/alpha/include/asm/bug.h b/arch/alpha/include/asm/bug.h
> index 1720c8a..f091682 100644
> --- a/arch/alpha/include/asm/bug.h
> +++ b/arch/alpha/include/asm/bug.h
> @@ -13,7 +13,8 @@
> ? ? ? ? ? ? ? ?"call_pal %0 ?# bugchk\n\t" ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ? ? ? ? ?".long %1\n\t.8byte %2" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ? ? ? ? ?: : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); ? ? \
> - ? ? ? for ( ; ; ); } while (0)
> + ? ? ? unreachable(); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ?} while (0)
>
> ?#define HAVE_ARCH_BUG
> ?#endif
> --
> 1.6.2.5

Thanks David. I've pushed this into my tree.

Matt