From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Petr Mladek <pmladek@suse.com>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH v1 1/1] test_printf: Refactor fwnode_pointer() to make it more readable
Date: Thu, 29 Sep 2022 20:04:04 +0300 [thread overview]
Message-ID: <YzXQBA5b71OohRar@smile.fi.intel.com> (raw)
In-Reply-To: <20220929120632.2bc01e9f@gandalf.local.home>
On Thu, Sep 29, 2022 at 12:06:32PM -0400, Steven Rostedt wrote:
> On Wed, 24 Aug 2022 20:05:42 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
Thank you for review, my answers below.
...
> > + const struct software_node first = { .name = "first" };
> > + const struct software_node second = { .name = "second", .parent = &first };
> > + const struct software_node third = { .name = "third", .parent = &second };
>
> I personally do not find the above more readable, but honestly, I'm not
> attached to this code at all.
>
> > + const struct software_node *group[] = { &first, &second, &third, NULL };
>
> Could this just be:
>
> const struct software_node *group[] = {
> &softnodes[0], &softnodes[1], &softnodes[2], NULL };
It could, but the issue is that it will loose the self-explanatory naming
scheme. It's much easier to see what we test and what we expect in the below
calls...
> > const char * const full_name_second = "first/second";
> > + const char * const full_name_third = "first/second/third";
> > const char * const second_name = "second";
> > const char * const third_name = "third";
> > int rval;
> >
> > - rval = software_node_register_nodes(softnodes);
> > + rval = software_node_register_node_group(group);
> > if (rval) {
> > pr_warn("cannot register softnodes; rval %d\n", rval);
> > return;
> > }
> >
> > - test(full_name_second, "%pfw", software_node_fwnode(&softnodes[1]));
> > - test(full_name, "%pfw", software_node_fwnode(&softnodes[2]));
> > - test(full_name, "%pfwf", software_node_fwnode(&softnodes[2]));
> > - test(second_name, "%pfwP", software_node_fwnode(&softnodes[1]));
> > - test(third_name, "%pfwP", software_node_fwnode(&softnodes[2]));
> > + test(full_name_second, "%pfw", software_node_fwnode(&second));
> > + test(full_name_third, "%pfw", software_node_fwnode(&third));
> > + test(full_name_third, "%pfwf", software_node_fwnode(&third));
> > + test(second_name, "%pfwP", software_node_fwnode(&second));
> > + test(third_name, "%pfwP", software_node_fwnode(&third));
...here.
> Then the above doesn't need to change.
And that's why I want to change them.
> But again, I'm not maintaining this code, so I'm not attached. Just adding
> my $0.02 to this (as I'm triaging my inbox and found this email).
> > - software_node_unregister_nodes(softnodes);
> > + software_node_unregister_node_group(group);
> > }
> >
> > static void __init fourcc_pointer(void)
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2022-09-29 17:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 17:05 [PATCH v1 1/1] test_printf: Refactor fwnode_pointer() to make it more readable Andy Shevchenko
2022-08-31 14:16 ` Andy Shevchenko
2022-11-01 13:01 ` Petr Mladek
2022-11-01 14:40 ` Andy Shevchenko
2022-09-29 16:06 ` Steven Rostedt
2022-09-29 17:04 ` Andy Shevchenko [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=YzXQBA5b71OohRar@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.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