From: Joe Perches <joe@perches.com>
To: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
Tanya Brokhman <tlinder@codeaurora.org>,
linux-mtd@lists.infradead.org, linux-arm-msm@vger.kernel.org,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Richard Weinberger <richard@nod.at>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] mtd: ubi: Extend UBI layer debug/messaging capabilities
Date: Tue, 14 Oct 2014 12:13:40 -0700 [thread overview]
Message-ID: <1413314020.26864.7.camel@joe-AO725> (raw)
In-Reply-To: <20141014184702.GA12662@arch.hh.imgtec.org>
On Tue, 2014-10-14 at 15:47 -0300, Ezequiel Garcia wrote:
> On 14 Oct 06:09 PM, Artem Bityutskiy wrote:
> > On Tue, 2014-10-14 at 11:39 -0300, Ezequiel Garcia wrote:
> > > Please use some pr_fmt for this. Something like this before the headers
> > > should be enough:
> > >
> > > #define pr_fmt(fmt) "UBI: block:" fmt
> >
> > Sinc ubiblock is a device, there should be a 'struct device' somewhere,
> > so probably dev_printk() and other dev_*() printing functions would be a
> > better choice?
> >
>
> A quick code dig shows you should get the struct device associated
> to the struct gendisk, with the disk_to_dev() macro.
>
> In other words, something like this should work, provided 'dev' is defined
> in the scope as a struct ubiblock:
>
> #define ubiblock_err(x) dev_err(disk_to_dev(dev->gd), x)
>
> When the gendisk is not available, a simple pr_{} would work.
Or maybe combine these in the ubi_<level> calls passing
NULL when there is no struct ubi_device *
void ubi_err(const struct ubi_device *ubi, fmt. ...)
{
struct va_format vaf;
va_list args;
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
if (ubi && ubi->gd)
dev_err(disk_to_dev(dev->gd), "UBI-%d error: %pF %pV",
ubi->ubi_num, __builtin_return_address(0), &vaf);
else if (ubi)
printk(KERN_ERR "UBI-%d error: %pf: %pV",
ubi->ubi_num, __builtin_return_address(0), &vaf);
else
printk(KERN_ERR "UBI: error: %pf: %pV",
__builtin_return_address(0), &vaf);
va_end(args);
}
next prev parent reply other threads:[~2014-10-14 19:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 14:13 Tanya Brokhman
2014-10-14 14:16 ` Tanya Brokhman
2014-10-14 14:33 ` Joe Perches
2014-10-14 15:07 ` Artem Bityutskiy
2014-10-14 16:05 ` Joe Perches
2014-10-20 13:51 ` Artem Bityutskiy
2014-10-20 16:54 ` Tanya Brokhman
2014-10-20 17:29 ` Joe Perches
2014-10-14 14:39 ` Ezequiel Garcia
2014-10-14 15:09 ` Artem Bityutskiy
2014-10-14 18:47 ` Ezequiel Garcia
2014-10-14 19:13 ` Joe Perches [this message]
2014-10-14 19:18 ` Ezequiel Garcia
2014-10-14 19:31 ` Joe Perches
2014-10-20 13:53 ` Artem Bityutskiy
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=1413314020.26864.7.camel@joe-AO725 \
--to=joe@perches.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=ezequiel.garcia@free-electrons.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=tlinder@codeaurora.org \
/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®