Re: [PATCH] I2C patch 2 - break up the SMBus formatting

From: Corey Minyard
Date: Fri Feb 25 2005 - 17:48:46 EST


Greg KH wrote:

On Thu, Feb 24, 2005 at 05:27:25PM -0600, Corey Minyard wrote:


+
+ /* It's wierd, but we use a usecount to track if an q entry is
+ in use and when it should be reported back to the user. */
+ atomic_t usecount;



Please use a kref here instead of rolling your own.


There's a trick I'm playing to avoid having to use a lock on the normal entry_put() case. It let's the entry_get() routine detect that the object is about to be destroyed. You can't do it with the current kref, but you could easily extend kref to allow it. It's simple to implement, but the documentation on how to use it will be 10 times larger than the code :).

I'll work on a patch to kref to add that, if you don't mind.

Oh, and can you cc: your patches to the sensors mailing list so the
other i2c developers are aware of them and can comment? I'll stick with
just applying your first patch for now.


certainly.

thanks

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