From: David Laight <David.Laight@ACULAB.COM>
To: 'Yangtao Li' <frank.li@vivo.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] kobject: introduce kobject_del_and_put()
Date: Sun, 19 Mar 2023 22:22:54 +0000 [thread overview]
Message-ID: <97711a466efa4353bb924b30cc52d7fa@AcuMS.aculab.com> (raw)
In-Reply-To: <20230318201640.63238-1-frank.li@vivo.com>
From: Yangtao Li <frank.li@vivo.com>
> Sent: 18 March 2023 20:17
>
> There are plenty of using kobject_del() and kobject_put() together
> in the kernel tree. This patch wraps these two calls in a single helper.
But why?
You are adding an extra function call for no benefit.
At best, perhaps, a static inline function.
David
...
> +void kobject_del_and_put(struct kobject *kobj)
> +{
> + kobject_del(kobj);
> + kobject_put(kobj);
> +}
> +EXPORT_SYMBOL_GPL(kobject_del_and_put);
> +
> static void dynamic_kobj_release(struct kobject *kobj)
> {
> pr_debug("kobject: (%p): %s\n", kobj, __func__);
> @@ -874,8 +888,7 @@ void kset_unregister(struct kset *k)
> {
> if (!k)
> return;
> - kobject_del(&k->kobj);
> - kobject_put(&k->kobj);
> + kobject_del_and_put(&k->kobj);
> }
> EXPORT_SYMBOL(kset_unregister);
>
> --
> 2.35.1
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2023-03-19 22:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-18 20:16 Yangtao Li
2023-03-19 7:58 ` Greg Kroah-Hartman
2023-03-19 22:22 ` David Laight [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=97711a466efa4353bb924b30cc52d7fa@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=frank.li@vivo.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.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
all inboxes | Powered by JetHome®