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

From: Dmitry Torokhov
Date: Wed May 19 2004 - 00:18:02 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/