[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <97711a466efa4353bb924b30cc52d7fa@AcuMS.aculab.com>
Date: Sun, 19 Mar 2023 22:22:54 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Yangtao Li' <frank.li@...o.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] kobject: introduce kobject_del_and_put()
From: Yangtao Li <frank.li@...o.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)
Powered by blists - more mailing lists