Re: [patch] hdaps driver update.
From: Dmitry Torokhov
Date: Wed Sep 14 2005 - 12:15:22 EST
On 9/14/05, Robert Love <rml@xxxxxxxxxx> wrote:
> On Wed, 2005-09-14 at 09:16 -0700, Greg KH wrote:
>
> > But you are reference counting a static object, right? Which
> > isn't the nicest thing to have done.
>
> I would not say it is not "the nicest thing", it is just not necessary
> to do the reference counting. But we want the ref counting for other
> reasons, so it seems sensible.
>
> > Why not just dynamically create it?
>
> Seems silly to dynamically create something that we know a priori we
> only have one of. E.g., why dynamically create something that is not
> dynamic.
>
> But it is not a big deal. If this is some rule of yours, I can
> kmalloc() the device_driver structure and kfree() it in my release()
> function. Is that what you want?
>
Just use platform_device_register_simple, it will allocate a platform
device for you and it has a release function.
> > No, if you have that .owner field in your driver, you get a symlink in
> > sysfs that points from your driver to the module that controls it. You
> > just removed that symlink, which is not what I think you wanted to have
> > happen :(
>
> But device release == module unload.
>
For now. But I could see one changing device structure to create some
attribute that could keep the object pinned in memory even after
module is unloaded. It seems that we have settled on the rule that
driver_unregister waits for the last refrence to drop off but devices
can live longer.
--
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/