Re: [patch] hdaps driver update.

Robert Love
2005-09-14T16:31:21Z

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?

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

I am not following, sadly.

> I also think you don't get the module reference counting for your
> driver's and devices sysfs files but haven't looked deep enough to see
> if this is true for your code or not. Should be easy for you to test,
> just open a sysfs file for your device and see if the module reference
> is incremented or not.

The module reference counting is fine.

The count is elevated while one of the sysfs files is open, decremented
when it closes.

Robert Love