Re: [RFC] sysfs kobject that doesn't trigger hotplug events

Dmitry Torokhov
2004-05-19T05:16:26Z

On Tuesday 18 May 2004 09:11 pm, John Zielinski wrote:
> I'm adding some data structures to a device and want them to appear
> under that device in sysfs in subdirectories. These data structures are
> linked together in a tree like layout so it would make sense to have
> them have a subdirectory tree representing them. These data structures
> have a kobject for reference counting and I can use kobject_add and
> kobject_del to add them to the sysfs tree.
>
> Looking through the kobject.c code I noticed that this would create a
> lot of hotplug events which would burn up a bit of processor time.
> These events are not necessary as these are not device kobjects. I've
> enclosed a patch to my solution for this. I'd like to know if there are
> any side effects with this method.
>

You are wasting 4 bytes for every kobject out there. Just implement your
private hotplug callback that would return something like -ENODEV so the
hotplug helper would not be called. If needed you can call kobject_hotplug
later, when you are ready.

--
Dmitry