netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	davem@davemloft.net, Shannon Nelson <shannon.nelson@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com
Subject: [PATCH net-next] device: Add dev_<level>_once variants
Date: Sat, 15 Nov 2014 14:38:29 -0800	[thread overview]
Message-ID: <1416091109.5912.32.camel@perches.com> (raw)
In-Reply-To: <5467C3BA.6090003@gmail.com>

Add the equivalents to pr_<level>_once.

Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/device.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index ce1f2160..a1ee071 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1118,6 +1118,41 @@ do {						     \
 })
 #endif
 
+#ifdef CONFIG_PRINTK
+#define dev_level_once(dev_level, dev, fmt, ...)			\
+do {									\
+	static bool __print_once __read_mostly;				\
+									\
+	if (!__print_once) {						\
+		__print_once = true;					\
+		dev_level(dev, fmt, ##__VA_ARGS__);			\
+	}								\
+} while (0)
+#else
+#define dev_level_once(dev_level, dev, fmt, ...)			\
+do {									\
+	if (0)								\
+		dev_level(dev, fmt, ##__VA_ARGS__);			\
+} while (0)
+#endif
+
+#define dev_emerg_once(dev, fmt, ...)					\
+	dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__)
+#define dev_alert_once(dev, fmt, ...)					\
+	dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__)
+#define dev_crit_once(dev, fmt, ...)					\
+	dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__)
+#define dev_err_once(dev, fmt, ...)					\
+	dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__)
+#define dev_warn_once(dev, fmt, ...)					\
+	dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__)
+#define dev_notice_once(dev, fmt, ...)					\
+	dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__)
+#define dev_info_once(dev, fmt, ...)					\
+	dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
+#define dev_dbg_once(dev, fmt, ...)					\
+	dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
+
 #define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
 do {									\
 	static DEFINE_RATELIMIT_STATE(_rs,				\

  reply	other threads:[~2014-11-15 22:38 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15  6:08 [net-next 00/12][pull request] Intel Wired LAN Driver Updates 2014-11-14 Jeff Kirsher
2014-11-15  6:08 ` [net-next 01/12] i40e: only warn once of PTP nonsupport in 100Mbit speed Jeff Kirsher
2014-11-15 21:20   ` Florian Fainelli
2014-11-15 22:38     ` Joe Perches [this message]
2014-11-16 20:49       ` [PATCH net-next] device: Add dev_<level>_once variants David Miller
2014-11-16 22:21         ` [PATCH net-next] netdevice: Neaten includes and forward declarations Joe Perches
2014-11-18 20:48           ` David Miller
2014-11-18 21:09             ` Joe Perches
2014-11-18 21:21               ` David Miller
2014-11-16 22:12     ` [PATCH net-next] i40e: Reduce stack in i40e_dbg_dump_desc Joe Perches
2014-11-17 21:06       ` David Miller
2014-11-17 21:30         ` Jeff Kirsher
2014-11-18  2:18     ` [PATCH (sent originally to netdev)] device: Add dev_<level>_once variants Joe Perches
2014-11-18  2:23       ` Jeff Kirsher
2014-11-15  6:08 ` [net-next 02/12] i40e: re-enable VFLR interrupt sooner Jeff Kirsher
2014-11-15  6:08 ` [net-next 03/12] i40e: Handle a single mss packet with more than 8 frags Jeff Kirsher
2014-11-15 18:21   ` Eric Dumazet
2014-11-17 14:15     ` David Laight
2014-11-17 14:31       ` Eric Dumazet
2014-11-17 14:40         ` David Laight
2014-11-17 14:55           ` Eric Dumazet
2014-11-17 16:04     ` Nelson, Shannon
2014-11-17 16:16       ` David Laight
2014-11-17 16:52         ` Eric Dumazet
2014-11-17 16:58         ` Eric Dumazet
2014-11-17 17:09           ` Eric Dumazet
2014-11-18  9:46           ` David Laight
2014-11-18 14:33             ` Eric Dumazet
2014-11-17 16:45       ` Eric Dumazet
2014-11-15  6:08 ` [net-next 04/12] i40e: Bump version to 1.1.23 Jeff Kirsher
2014-11-15  6:08 ` [net-next 05/12] i40e: Resume Port Tx after DCB event Jeff Kirsher
2014-11-15  6:08 ` [net-next 06/12] i40e: Add support to firmware CEE DCBX mode Jeff Kirsher
2014-11-15  6:08 ` [net-next 07/12] i40e: Check for LLDP AdminStatus before querying DCBX Jeff Kirsher
2014-11-15  6:08 ` [net-next 08/12] i40e: Update VEB's enabled_tc after reconfiguration Jeff Kirsher
2014-11-15  6:08 ` [net-next 09/12] i40e: Modify Tx disable wait flow in case of DCB reconfiguration Jeff Kirsher
2014-11-15  6:08 ` [net-next 10/12] i40e: Do not disable/enable FCoE VSI with DCB reconfig Jeff Kirsher
2014-11-15  6:08 ` [net-next 11/12] i40e: Prevent link flow control settings when PFC is enabled Jeff Kirsher
2014-11-15  6:08 ` [net-next 12/12] i40e: Set XPS bit mask to zero in DCB mode Jeff Kirsher
2014-11-16 20:04 ` [net-next 00/12][pull request] Intel Wired LAN Driver Updates 2014-11-14 David Miller

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=1416091109.5912.32.camel@perches.com \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    --cc=shannon.nelson@intel.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;
as well as URLs for NNTP newsgroup(s).