linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Daniel Scally <djrscally@gmail.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-acpi@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Yong Zhi <yong.zhi@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: [PATCH v1 6/8] software node: Simplify swnode_register() a bit
Date: Sun, 28 Mar 2021 00:20:10 +0200	[thread overview]
Message-ID: <20210327222012.54103-6-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com>

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 | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index ae53c48f84b1..1e81aaf5f6a1 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -894,6 +894,8 @@ static struct fwnode_handle *
 swnode_register(const struct software_node *node, struct swnode *parent,
 		unsigned int allocated)
 {
+	struct ida *ids = parent ? &parent->child_ids : &swnode_root_ids;
+	struct kobject *kobj_parent = parent ? &parent->kobj : NULL;
 	struct swnode *swnode;
 	int ret;
 
@@ -901,8 +903,7 @@ swnode_register(const struct software_node *node, struct swnode *parent,
 	if (!swnode)
 		return ERR_PTR(-ENOMEM);
 
-	ret = ida_simple_get(parent ? &parent->child_ids : &swnode_root_ids,
-			     0, 0, GFP_KERNEL);
+	ret = ida_simple_get(ids, 0, 0, GFP_KERNEL);
 	if (ret < 0) {
 		kfree(swnode);
 		return ERR_PTR(ret);
@@ -920,12 +921,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.30.2


  parent reply	other threads:[~2021-03-27 22:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 22:20 [PATCH v1 1/8] software node: Free resources explicitly when swnode_register() fails Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 2/8] software node: Introduce software_node_alloc()/software_node_free() Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 3/8] software node: Show properties and their values in sysfs Andy Shevchenko
2021-03-28  1:14   ` kernel test robot
2021-03-28  6:45   ` Greg Kroah-Hartman
2021-03-28 12:56     ` Andy Shevchenko
2021-03-28 13:02       ` Greg Kroah-Hartman
2021-03-29 13:01         ` Andy Shevchenko
2021-03-29 13:46           ` Greg Kroah-Hartman
2021-03-29 14:51             ` Andy Shevchenko
2021-03-29 18:26               ` Greg Kroah-Hartman
2021-03-27 22:20 ` [PATCH v1 4/8] software node: Deduplicate code in fwnode_create_software_node() Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 5/8] software node: Imply kobj_to_swnode() to be no-op Andy Shevchenko
2021-03-28  8:43   ` Greg Kroah-Hartman
2021-03-28 12:50     ` Andy Shevchenko
2021-03-27 22:20 ` Andy Shevchenko [this message]
2021-03-28  8:44   ` [PATCH v1 6/8] software node: Simplify swnode_register() a bit Greg Kroah-Hartman
2021-03-28 12:50     ` Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 7/8] software node: Introduce SOFTWARE_NODE_REFERENCE() helper macro Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 8/8] media: ipu3-cio2: Switch to use SOFTWARE_NODE_REFERENCE() 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=20210327222012.54103-6-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bingbu.cao@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=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=yong.zhi@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;
as well as URLs for NNTP newsgroup(s).