From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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>,
Danilo Krummrich <dakr@kernel.org>,
linux-acpi@vger.kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org, brgl@kernel.org
Subject: Re: [PATCH] software node: provide wrappers around kobject_get/put()
Date: Fri, 24 Apr 2026 16:33:05 +0300 [thread overview]
Message-ID: <aetxEcjE8wD4-ZyV@ashevche-desk.local> (raw)
In-Reply-To: <20260424124250.92890-1-bartosz.golaszewski@oss.qualcomm.com>
On Fri, Apr 24, 2026 at 02:42:50PM +0200, Bartosz Golaszewski wrote:
> Make the code more readable by avoid constant dereferencing of the
> swnode's kobject when managing references. Provide wrappers that take
> struct swnode * as argument and make them hide that logic.
...
> +static void swnode_get(struct swnode *swnode)
> +{
> + kobject_get(&swnode->kobj);
> +}
Isn't a pattern to return the object itself so the code can bump the reference
in a single statement (if appropriate)?
...
> static struct fwnode_handle *software_node_get(struct fwnode_handle *fwnode)
> {
> struct swnode *swnode = to_swnode(fwnode);
>
> - kobject_get(&swnode->kobj);
> + swnode_get(swnode);
Like
struct swnode *swnode = swnode_get(to_swnode(fwnode));
> return &swnode->fwnode;
> }
...
> list_for_each_entry(child, &swnode->children, entry) {
> if (!strcmp(childname, kobject_name(&child->kobj))) {
> - kobject_get(&child->kobj);
> + swnode_get(child);
Becomes inconsistent with kobject_name()...
> return &child->fwnode;
> }
> }
...
> swnode = kobj_to_swnode(k);
> if (parent == swnode->node->parent && swnode->node->name &&
> !strcmp(name, swnode->node->name)) {
> - kobject_get(&swnode->kobj);
> + swnode_get(swnode);
Also not sure. Maybe use 'k'?
> break;
> }
...
Otherwise LGTM and makes sense.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-24 13:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 12:42 [PATCH] software node: provide wrappers around kobject_get/put() Bartosz Golaszewski
2026-04-24 13:33 ` Andy Shevchenko [this message]
2026-04-24 13:43 ` Bartosz Golaszewski
2026-04-24 15:32 ` Andy Shevchenko
2026-04-27 8:15 ` Bartosz Golaszewski
2026-04-27 8:34 ` 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=aetxEcjE8wD4-ZyV@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=djrscally@gmail.com \
--cc=driver-core@lists.linux.dev \
--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