Re: [PATCH] i2c: avoid ifdeffery in I2C drivers with optional slave support

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

 



Hi Wolfram, Sascha,

On Thu, 9 Apr 2020 15:40:27 +0200, Wolfram Sang wrote:
> On Wed, Dec 04, 2019 at 10:53:48AM +0100, Sascha Hauer wrote:
> > Always add the (un)reg_slave hooks to struct i2c_algorithm, even when
> > I2C slave support is disabled. With the cost of some binary space I2C
> > drivers with optional I2C slave support no longer have to #ifdef
> > the hooks. For the same reason add a stub for i2c_slave_event and make
> > enum i2c_slave_event present without I2C slave support.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>  
> 
> This kind of reverts d5fd120e7860 ("i2c: Only include slave support if
> selected"), so adding Jean here for more discussion.

That commit made sense then as there was only exactly 1 kernel driver
needing this. This might be revisited when more drivers need it.

That being said, as far as I can see only 8 drivers need it today, which
isn't that many, and more importantly, several architectures will
typically not include support for any of them (i386, x86_64 and s390x
for example).

> I don't mind the additional bytes used in i2c_algorithm, so I am in
> favor of this approach.

I find it questionable to increase the memory footprint on all x86_64
systems out there for a feature they do not need. Sure it's only 16
bytes in one structure, but if every subsystem does the same on a
regular basis, it adds up.

More importantly I can't see how the ifdef'd members of struct
i2c_algorithm are the cause of the problem mentioned by Sascha. He
seems to be concerned by drivers with *optional* I2C slave support
having ifdefs. Why can't this be solved in these drivers directly? What
prevents these drivers from unconditionally selecting I2C_SLAVE if that
makes their code more simple? This moves the overhead decision to the
device driver instead of forcing it to the whole subsystem across all
architectures.

-- 
Jean Delvare
SUSE L3 Support



[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