From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH v1 1/1] software node: Simplify swnode_register() a bit
Date: Fri, 13 Sep 2024 14:05:23 +0300 [thread overview]
Message-ID: <20240913110523.3584749-1-andriy.shevchenko@linux.intel.com> (raw)
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;
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);
else
ret = kobject_init_and_add(&swnode->kobj, &software_node_type,
- parent ? &parent->kobj : NULL,
- "node%d", swnode->id);
+ kobj_parent, "node%d", swnode->id);
if (ret) {
kobject_put(&swnode->kobj);
return ERR_PTR(ret);
--
2.43.0.rc1.1336.g36b5255a03ac
next reply other threads:[~2024-09-13 11:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 11:05 Andy Shevchenko [this message]
2024-09-13 11:16 ` Sakari Ailus
2024-09-13 13:34 ` Greg Kroah-Hartman
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=20240913110523.3584749-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=djrscally@gmail.com \
--cc=gregkh@linuxfoundation.org \
--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®