From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH v1 1/1] software node: Simplify swnode_register() a bit
Date: Fri, 13 Sep 2024 15:34:58 +0200 [thread overview]
Message-ID: <2024091300-afford-tamper-1831@gregkh> (raw)
In-Reply-To: <20240913110523.3584749-1-andriy.shevchenko@linux.intel.com>
On Fri, Sep 13, 2024 at 02:05:23PM +0300, Andy Shevchenko wrote:
> By introducing two temporary variables simplify swnode_register() a bit.
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/base/swnode.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> index b0be765b12da..810c27a8c9c1 100644
> --- a/drivers/base/swnode.c
> +++ b/drivers/base/swnode.c
> @@ -908,6 +908,7 @@ static struct fwnode_handle *
> swnode_register(const struct software_node *node, struct swnode *parent,
> unsigned int allocated)
> {
> + struct kobject *kobj_parent = parent ? &parent->kobj : NULL;
I despise ?: use just so much, EXCEPT for when it's used in something
like this:
> struct swnode *swnode;
> int ret;
>
> @@ -934,12 +935,10 @@ swnode_register(const struct software_node *node, struct swnode *parent,
>
> if (node->name)
> ret = kobject_init_and_add(&swnode->kobj, &software_node_type,
> - parent ? &parent->kobj : NULL,
> - "%s", node->name);
> + kobj_parent, "%s", node->name);
Which really is the only valid way I'd put up with it :)
So can you rewrite the change above to be just:
struct kobject *kobj_parent = NULL;
...
if (parent)
kobj_parent = &parent->kobj;
Which is much simpler to read, right?
thanks,
greg k-h
next prev parent reply other threads:[~2024-09-13 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 11:05 Andy Shevchenko
2024-09-13 11:16 ` Sakari Ailus
2024-09-13 13:34 ` Greg Kroah-Hartman [this message]
2024-09-13 19:25 ` Andy Shevchenko
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=2024091300-afford-tamper-1831@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=djrscally@gmail.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.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
all inboxes | Powered by JetHome®