mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org,
	Christian Melki <christian.melki@t2data.com>
Subject: Re: [PATCH master v2 1/3] include: linux/printk: implement pr_*_once macros
Date: Fri, 3 Feb 2023 08:58:58 +0100	[thread overview]
Message-ID: <20230203075858.GP13319@pengutronix.de> (raw)
In-Reply-To: <20230202133415.319020-1-a.fatoum@pengutronix.de>

On Thu, Feb 02, 2023 at 02:34:13PM +0100, Ahmad Fatoum wrote:
> These are useful as a less verbose alternative to WARN_ONCE, which also
> prints a stack trace if possible.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> v1 -> v2:
>   unchanged
> ---
>  include/linux/printk.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 2fd6551e0ccb..a9d1b05f6f0f 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -94,6 +94,15 @@ static inline int dev_err_probe(struct device *dev, int err, const char *fmt,
>  		(level) <= LOGLEVEL ? pr_print((level), (format), ##args) : 0; \
>  	 })
>  
> +#define __pr_printk_once(level, format, args...) do {	\
> +	static bool __print_once;			\
> +							\
> +	if (!__print_once && (level) <= LOGLEVEL) {	\
> +		__print_once = true;			\
> +		pr_print((level), (format), ##args);	\
> +	}						\
> +} while (0)
> +
>  #ifndef pr_fmt
>  #define pr_fmt(fmt) fmt
>  #endif
> @@ -110,7 +119,18 @@ static inline int dev_err_probe(struct device *dev, int err, const char *fmt,
>  #define pr_vdebug(fmt, arg...)	__pr_printk(8, pr_fmt(fmt), ##arg)
>  #define pr_cont(fmt, arg...)	__pr_printk(-1, fmt, ##arg)
>  
> +#define pr_emerg_once(fmt, arg...)	__pr_printk_once(0, pr_fmt(fmt), ##arg)
> +#define pr_alert_once(fmt, arg...)	__pr_printk_once(1, pr_fmt(fmt), ##arg)
> +#define pr_crit_once(fmt, arg...)	__pr_printk_once(2, pr_fmt(fmt), ##arg)
> +#define pr_err_once(fmt, arg...)	__pr_printk_once(3, pr_fmt(fmt), ##arg)
> +#define pr_warning_once(fmt, arg...)	__pr_printk_once(4, pr_fmt(fmt), ##arg)
> +#define pr_notice_once(fmt, arg...)	__pr_printk_once(5, pr_fmt(fmt), ##arg)
> +#define pr_info_once(fmt, arg...)	__pr_printk_once(6, pr_fmt(fmt), ##arg)
> +#define pr_debug_once(fmt, arg...)	__pr_printk_once(7, pr_fmt(fmt), ##arg)
> +#define pr_vdebug_once(fmt, arg...)	__pr_printk_once(8, pr_fmt(fmt), ##arg)
> +
>  #define pr_warn			pr_warning
> +#define pr_warn_once		pr_warning_once
>  
>  int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size,
>  		   int swab);
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      parent reply	other threads:[~2023-02-03  8:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 13:34 Ahmad Fatoum
2023-02-02 13:34 ` [PATCH v2 2/3] fs: tftp: print message when stack can't keep us with TFTP windowsize Ahmad Fatoum
2023-02-02 13:34 ` [PATCH v2 3/3] include: printk: retire printk_once for pr_debug_once Ahmad Fatoum
2023-02-03  7:58 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230203075858.GP13319@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=christian.melki@t2data.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox