From: Joe Perches <joe@perches.com>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
akpm@linux-foundation.org
Subject: Re: [PATCH] RFC: Introduce FW_INFO* functions
Date: Fri, 27 Sep 2013 08:40:51 -0700 [thread overview]
Message-ID: <1380296451.17366.116.camel@joe-AO722> (raw)
In-Reply-To: <1380288157-25248-1-git-send-email-prarit@redhat.com>
On Fri, 2013-09-27 at 09:22 -0400, Prarit Bhargava wrote:
> I'm proposing with this patch to do something similar to the WARN()
> mechanism that is currently implemented in the kernel. This
> patchset introduces FW_INFO() and FW_INFO_DEV() which logs output
My first thought was "how ugly".
There must be a better way than scraping dmesg output.
> diff --git a/kernel/panic.c b/kernel/panic.c
[]
> @@ -445,6 +446,29 @@ void warn_slowpath_fmt_taint(const char *file, int line,
> }
> EXPORT_SYMBOL(warn_slowpath_fmt_taint);
>
> +void warn_slowpath_fmt_dev(const char *file, int line,
> + struct device *dev, const char *fmt, ...)
> +{
> + struct slowpath_args args;
> +
> + pr_info("[Firmware Info]: ");
> + if (dev)
> + pr_cont("%s %s: ",
> + dev_driver_string(dev), dev_name(dev));
> + pr_cont("at %s:%d ", file, line);
> +
> + args.fmt = fmt;
> + va_start(args.args, fmt);
> + vprintk(args.fmt, args.args);
> + va_end(args.args);
> + if (dump_hardware_arch_desc())
> + pr_info("[Firmware Info]: %s\n", dump_hardware_arch_desc());
> + else
> + pr_info("[Firmware Info]: Hardware Unidentified\n");
> +}
> +EXPORT_SYMBOL(warn_slowpath_fmt_dev);
This bit should just use %pV and a single printk to
avoid any possible message interleaving.
{
struct va_format vaf;
va_list args;
va_start(args, fmt)
vaf.fmt = fmt;
vaf.va = &args;
if (dev)
pr_info("[Firmware Info]: %s %s at %s:%d %pV",
dev_driver_string(dev), dev_name(dev),
file, line, &vaf);
else
pr_info("[Firmware Info]: at %s:%d %pV",
file, line, &vaf);
etc...
next prev parent reply other threads:[~2013-09-27 15:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 13:22 Prarit Bhargava
2013-09-27 15:40 ` Joe Perches [this message]
2013-09-28 18:00 ` Prarit Bhargava
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=1380296451.17366.116.camel@joe-AO722 \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prarit@redhat.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
all inboxes | Powered by JetHome®