From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: lijiazi <jqqlijiazi@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Jonathan Corbet <corbet@lwn.net>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
lijiazi <lijiazi@xiaomi.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
<devicetree@vger.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v2] lib/vsprintf: introduce OF_DEVICE_NODE_FLAG_MAX for %pOF
Date: Fri, 17 Jan 2020 15:30:26 +0200 [thread overview]
Message-ID: <20200117133026.GS32742@smile.fi.intel.com> (raw)
In-Reply-To: <1579259719-16904-1-git-send-email-lijiazi@xiaomi.com>
On Fri, Jan 17, 2020 at 07:15:19PM +0800, lijiazi wrote:
> Introduce OF_DEVICE_NODE_FLAG_MAX for device node printk, if add
> new device node flag, please add the corresponding flag abbreviation
> to tbuf in device_node_string.
Thank you for an update!
My comments below.
...
> + O - Overlay
> + F - Overlay free cset
Perhaps this would be a separate patch.
> +/* Add flag max for %pOF related printk, if add new flag, please
> + * increase following marco, and add abbreviations to tbuf in
> + * device_node_string function.
> + */
I'm not sure it's correct style for multi-line comments.
> +#define OF_DEVICE_NODE_FLAG_MAX 6 /* maximum available flags */
Altogether I think this would be done as a separate patch (with corresponding
Suggested-by tag).
> - char tbuf[sizeof("xxxx") + 1];
> + char tbuf[OF_DEVICE_NODE_FLAG_MAX + 1] = { "DdPBOF" };
This trick is interesting. Had you checked what code is being produced
out of it (additional memcpy()? or constants assignment on the stack?) ?
> - tbuf[0] = of_node_check_flag(dn, OF_DYNAMIC) ? 'D' : '-';
> - tbuf[1] = of_node_check_flag(dn, OF_DETACHED) ? 'd' : '-';
> - tbuf[2] = of_node_check_flag(dn, OF_POPULATED) ? 'P' : '-';
> - tbuf[3] = of_node_check_flag(dn, OF_POPULATED_BUS) ? 'B' : '-';
> - tbuf[4] = 0;
> + for (i = 0; i < OF_DEVICE_NODE_FLAG_MAX; i++) {
> + if (!of_node_check_flag(dn, OF_DYNAMIC + i))
> + tbuf[i] = '-';
> + }
For my personal opinion the former is clearer than the latter since we have no
exported iterator over the OF device node flags. What if we decide not to use
one in the middle?
> + tbuf[OF_DEVICE_NODE_FLAG_MAX] = 0;
This line completely depends on how we assign the initial array (see above).
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-01-17 13:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 11:15 [PATCH v2] lib/vsprintf: introduce OF_DEVICE_NODE_FLAG_MAX for %pOF lijiazi
2020-01-17 13:30 ` Andy Shevchenko [this message]
2020-01-17 13:32 ` Andy Shevchenko
2020-01-17 16:02 ` Randy Dunlap
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=20200117133026.GS32742@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=jqqlijiazi@gmail.com \
--cc=lijiazi@xiaomi.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=robh+dt@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.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).