Re: [PATCH 1/2] i2c-algo-bit: Refactor adapter registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 13 Dec 2010 23:47:23 +0000, Ben Dooks wrote:
> On Wed, Dec 08, 2010 at 02:32:36PM +0100, Jean Delvare wrote:
> > On Wed, 08 Dec 2010 10:59:18 +0100, Michael Lawnick wrote:
> > > Function pointers tend to hide information. Seeing the targeted function
> > > in source code makes it more clear, IMHO.
> > 
> > This doesn't sound like a valid argument when the provider of the
> > function pointer is only 20 lines away from the call site in the very
> > same file, sorry.
> > 
> > Adding a parameter to i2c_add_adapter would mean changing 105 calling
> > sites. You have to understand that we aren't going to do that without a
> > very good reason. Ben's proposal is equally invasive, as every current
> > call to i2c_add_adapter would have to set the id to -1 before. This
> > means changing 74 drivers for a marginal benefit.
> > 
> > If someday calls to i2c_add_numbered_adapter() outnumber calls to
> > i2c_add_adapter() by a factor 3, we can reconsider. But this isn't the
> > case today. I am not particularly happy with the current situation
> > myself, but it seemed like the best option when
> > i2c_add_numbered_adapter() was introduced, and I see no reason to
> > reconsider at this point in time.
> 
> How about adding an in-lined (in header) something this like:
> 
> static inline int i2c_add_adapter(struct i2c_adapter *adap)
> {
> 	return i2c_add_numbered_adapter(-1, adap);
> }
> 
> anyway, not desperately important (and code not tested either)

i2c_add_numbered_adapter doesn't take the bus number as a parameter, it
reads it from adap->nr. So the inline function would rather be:

static inline int i2c_add_adapter(struct i2c_adapter *adap)
{
	adap->nr = -1;
	return i2c_add_numbered_adapter(adap);
}

But then again, which problem are you trying to solve? What you propose
it different from what we have today, but I fail to see how it would be
_better_ than what we have today.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux