* [U-Boot] [PATCH] bug.h: introduce WARN_ONCE
@ 2018-05-28 9:44 Ramon Fried
2018-05-28 23:21 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Ramon Fried @ 2018-05-28 9:44 UTC (permalink / raw)
To: u-boot
Add WARN_ONCE definition to allow single time notification
of warnings to the user.
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
---
include/linux/bug.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/linux/bug.h b/include/linux/bug.h
index f07bb716fc0..67b6057a22a 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -20,6 +20,13 @@
unlikely(__ret_warn_on); \
})
+#define WARN(condition, format...) ({ \
+ int __ret_warn_on = !!(condition); \
+ if (unlikely(__ret_warn_on)) \
+ __WARN_printf(format); \
+ unlikely(__ret_warn_on); \
+})
+
#define WARN_ON_ONCE(condition) ({ \
static bool __warned; \
int __ret_warn_once = !!(condition); \
@@ -31,4 +38,15 @@
unlikely(__ret_warn_once); \
})
+#define WARN_ONCE(condition, format...) ({ \
+ static bool __warned; \
+ int __ret_warn_once = !!(condition); \
+ \
+ if (unlikely(__ret_warn_once && !__warned)) { \
+ __warned = true; \
+ WARN(1, format); \
+ } \
+ unlikely(__ret_warn_once); \
+})
+
#endif /* _LINUX_BUG_H */
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] bug.h: introduce WARN_ONCE
2018-05-28 9:44 [U-Boot] [PATCH] bug.h: introduce WARN_ONCE Ramon Fried
@ 2018-05-28 23:21 ` Masahiro Yamada
2018-05-29 10:34 ` Ramon Fried
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2018-05-28 23:21 UTC (permalink / raw)
To: u-boot
2018-05-28 18:44 GMT+09:00 Ramon Fried <ramon.fried@linaro.org>:
> Add WARN_ONCE definition to allow single time notification
> of warnings to the user.
>
> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> ---
> include/linux/bug.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/include/linux/bug.h b/include/linux/bug.h
> index f07bb716fc0..67b6057a22a 100644
> --- a/include/linux/bug.h
> +++ b/include/linux/bug.h
> @@ -20,6 +20,13 @@
> unlikely(__ret_warn_on); \
> })
>
> +#define WARN(condition, format...) ({ \
> + int __ret_warn_on = !!(condition); \
> + if (unlikely(__ret_warn_on)) \
> + __WARN_printf(format); \
Where is __WARN_printf() defined?
> + unlikely(__ret_warn_on); \
> +})
> +
> #define WARN_ON_ONCE(condition) ({ \
> static bool __warned; \
> int __ret_warn_once = !!(condition); \
> @@ -31,4 +38,15 @@
> unlikely(__ret_warn_once); \
> })
>
> +#define WARN_ONCE(condition, format...) ({ \
> + static bool __warned; \
> + int __ret_warn_once = !!(condition); \
> + \
> + if (unlikely(__ret_warn_once && !__warned)) { \
> + __warned = true; \
> + WARN(1, format); \
> + } \
> + unlikely(__ret_warn_once); \
> +})
> +
> #endif /* _LINUX_BUG_H */
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] bug.h: introduce WARN_ONCE
2018-05-28 23:21 ` Masahiro Yamada
@ 2018-05-29 10:34 ` Ramon Fried
0 siblings, 0 replies; 3+ messages in thread
From: Ramon Fried @ 2018-05-29 10:34 UTC (permalink / raw)
To: u-boot
On Tue, May 29, 2018 at 2:21 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2018-05-28 18:44 GMT+09:00 Ramon Fried <ramon.fried@linaro.org>:
>> Add WARN_ONCE definition to allow single time notification
>> of warnings to the user.
>>
>> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
>> ---
>> include/linux/bug.h | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/include/linux/bug.h b/include/linux/bug.h
>> index f07bb716fc0..67b6057a22a 100644
>> --- a/include/linux/bug.h
>> +++ b/include/linux/bug.h
>> @@ -20,6 +20,13 @@
>> unlikely(__ret_warn_on); \
>> })
>>
>> +#define WARN(condition, format...) ({ \
>> + int __ret_warn_on = !!(condition); \
>> + if (unlikely(__ret_warn_on)) \
>> + __WARN_printf(format); \
>
>
> Where is __WARN_printf() defined?
>
Ohhh. thanks for noticing. I pushed the wrong file.
I'm pushing a fix shortly.
>
>
>
>> + unlikely(__ret_warn_on); \
>> +})
>> +
>> #define WARN_ON_ONCE(condition) ({ \
>> static bool __warned; \
>> int __ret_warn_once = !!(condition); \
>> @@ -31,4 +38,15 @@
>> unlikely(__ret_warn_once); \
>> })
>>
>> +#define WARN_ONCE(condition, format...) ({ \
>> + static bool __warned; \
>> + int __ret_warn_once = !!(condition); \
>> + \
>> + if (unlikely(__ret_warn_once && !__warned)) { \
>> + __warned = true; \
>> + WARN(1, format); \
>> + } \
>> + unlikely(__ret_warn_once); \
>> +})
>> +
>> #endif /* _LINUX_BUG_H */
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
>
>
>
> --
> Best Regards
> Masahiro Yamada
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-29 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 9:44 [U-Boot] [PATCH] bug.h: introduce WARN_ONCE Ramon Fried
2018-05-28 23:21 ` Masahiro Yamada
2018-05-29 10:34 ` Ramon Fried
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox