[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1176778391.14322.273.camel@localhost.localdomain>
Date: Tue, 17 Apr 2007 12:53:10 +1000
From: Rusty Russell <rusty@...tcorp.com.au>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Greg KH <greg@...ah.com>, Cornelia Huck <cornelia.huck@...ibm.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Tejun Heo <htejun@...il.com>
Subject: Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.
On Mon, 2007-04-16 at 15:53 -0400, Alan Stern wrote:
> The fundamental rule is that whenever you hand out a pointer to a routine
> living in a module, the receiver has to increment the module's refcount.
> But the driver core violates this rule all over the place.
Hi Alan,
Your rule is overly simplistic, unfortunately. You have two choices:
take a reference count, *or* ensure that the reference will go away when
the module's cleanup routine is called. Network drivers are a classic
example of the latter.
Note that you cannot do both: if the cleanup routine calls something
which drops a reference count, it implies that the cleanup routine needs
to be called with non-zero reference count, and it won't be (ignoring
--force).
I hope that clarifies?
Rusty.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists