public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Kirti Wankhede <kwankhede@nvidia.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] driver core: class: add class_pseudo_register
Date: Wed, 4 Dec 2024 20:35:44 +0100	[thread overview]
Message-ID: <b36a81b3-c7fa-4fcd-9b97-b41c42daf06b@gmail.com> (raw)
In-Reply-To: <2024120407-partake-pounce-67be@gregkh>

On 04.12.2024 19:17, Greg Kroah-Hartman wrote:
> On Wed, Dec 04, 2024 at 06:04:32PM +0100, Heiner Kallweit wrote:
>> On 04.12.2024 10:33, Greg Kroah-Hartman wrote:
>>> On Tue, Dec 03, 2024 at 09:10:05PM +0100, Heiner Kallweit wrote:
>>>> In preparation of removing class_compat support, add a helper for
>>>> creating a pseudo class in sysfs. This way we can keep class_kset
>>>> private to driver core. This helper will be used by vfio/mdev,
>>>> replacing the call to class_compat_create().
>>>>
>>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>>> ---
>>>>  drivers/base/class.c         | 14 ++++++++++++++
>>>>  include/linux/device/class.h |  1 +
>>>>  2 files changed, 15 insertions(+)
>>>>
>>>> diff --git a/drivers/base/class.c b/drivers/base/class.c
>>>> index 582b5a02a..f812236e2 100644
>>>> --- a/drivers/base/class.c
>>>> +++ b/drivers/base/class.c
>>>> @@ -578,6 +578,20 @@ struct class_compat *class_compat_register(const char *name)
>>>>  }
>>>>  EXPORT_SYMBOL_GPL(class_compat_register);
>>>>  
>>>> +/**
>>>> + * class_pseudo_register - create a pseudo class entry in sysfs
>>>> + * @name: the name of the child
>>>> + *
>>>> + * Helper for creating a pseudo class in sysfs, keeps class_kset private
>>>> + *
>>>> + * Returns: the created kobject
>>>> + */
>>>> +struct kobject *class_pseudo_register(const char *name)
>>>> +{
>>>> +	return kobject_create_and_add(name, &class_kset->kobj);
>>>> +}
>>>> +EXPORT_SYMBOL_GPL(class_pseudo_register);
>>>
>>> I see the goal here, but let's not continue on and create fake kobjects
>>> in places where there should NOT be any kobjects.  Also, you might get
>>> in trouble when removing this kobject as it thinks it is a 'struct
>>> class' but yet it isn't, right?  Did you test that?
>>>
>>
>> It's removed using kobject_put(), same as what class_compat_unregister() does.
>> I only compile-tested the changes.
> 
> I would not be able to take these unless someone actually runs them as
> the kobject removal here might be getting confused a bit.
> 
Understood. Maybe Alex/Kirti can test.

> thanks,
> 
> greg k-h


  reply	other threads:[~2024-12-04 19:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 20:08 [PATCH 0/3] driver core: class: remove class_compat code Heiner Kallweit
2024-12-03 20:10 ` [PATCH 1/3] driver core: class: add class_pseudo_register Heiner Kallweit
2024-12-04  9:33   ` Greg Kroah-Hartman
2024-12-04 17:04     ` Heiner Kallweit
2024-12-04 18:17       ` Greg Kroah-Hartman
2024-12-04 19:35         ` Heiner Kallweit [this message]
2024-12-03 20:11 ` [PATCH 2/3] vfio/mdev: inline needed class_compat functionality Heiner Kallweit
2024-12-04  9:32   ` Greg Kroah-Hartman
2024-12-04 17:01     ` Heiner Kallweit
2024-12-04 18:16       ` Greg Kroah-Hartman
2024-12-04 19:30         ` Alex Williamson
2024-12-06  7:35           ` Heiner Kallweit
2024-12-06  7:42             ` Greg Kroah-Hartman
2024-12-06 16:37               ` Alex Williamson
2024-12-07  8:38                 ` Greg Kroah-Hartman
2024-12-07 10:06                   ` Heiner Kallweit
2024-12-07 10:23                     ` Greg Kroah-Hartman
2024-12-12  4:42                     ` Christoph Hellwig
2024-12-12 18:12                       ` Alex Williamson
2024-12-12 18:21                         ` Greg Kroah-Hartman
2024-12-12 18:39                           ` Alex Williamson
2024-12-13 14:53                         ` Christoph Hellwig
2024-12-06 17:05               ` Heiner Kallweit
2024-12-04 19:35         ` Heiner Kallweit
2025-01-10 14:35   ` Greg Kroah-Hartman
2025-01-13 22:09     ` Alex Williamson
2024-12-03 20:12 ` [PATCH 3/3] driver core: class: remove class_compat code Heiner Kallweit
2024-12-12  4:27 ` [PATCH 0/3] " Christoph Hellwig

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=b36a81b3-c7fa-4fcd-9b97-b41c42daf06b@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --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