Re: [PATCH] Try 2, Fix release function in IPMI device model

From: Dmitry Torokhov
Date: Wed Mar 22 2006 - 16:36:36 EST


On 3/22/06, Corey Minyard <minyard@xxxxxxx> wrote:
> Dmitry Torokhov wrote:
>
> >On 3/22/06, Greg KH <greg@xxxxxxxxx> wrote:
> >
> >
> >>On Wed, Mar 22, 2006 at 02:45:01PM -0600, Corey Minyard wrote:
> >>
> >>
> >>>Ok, one more try. Russell, I assume you mean to use
> >>>platform_device_alloc(), which seems to do what you suggested.
> >>>And I assume the driver_data is the way to store whatever you
> >>>need, instead of using the container_of() macro.
> >>>
> >>>Arjun, Russell, thanks for the info.
> >>>
> >>>Now the patch...
> >>>
> >>>Arjun van de Ven pointed out that the changeover to the driver model
> >>>in the IPMI driver had some bugs in it dealing with the release
> >>>function and cleanup. Then Russell King pointed out that you can't
> >>>put release functions in the same module as the unregistering code.
> >>>
> >>>
> >>Yes you can, you just have to properly set up the module attribute
> >>owners and it will work just fine.
> >>
> >>
> >>
> >
> >No, not really. You can only do that if _all_ sysfs attributes for the
> >object are handled in your driver which is rarely the case (dev,
> >/power/* attributes, etc).
> >
> >
> I don't see an owner field in the device structure. So you are
> saying that if the same module owns the device_driver structure,
> it is safe, but if not it is not safe.
>

Owner field is in attribute structure. So if all attributes are
implemented in your module then you are guaranteed that when you get
into module's cleanup routine there are no more references to these
attributes and therefore to your object.

--
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/