Re: [PATCH 4/4] ARM: davinci: make I2C support optional

Sekhar Nori
2016-02-05T13:21:06Z

On Tuesday 02 February 2016 02:05 AM, Arnd Bergmann wrote:
> The davinci platform has tried to get support for the EEPROM right,
> but failed to get a clean build so far. At the moment, we get
> a warning whenever CONFIG_SYSFS is disabled, as that is needed by
> EEPROM_AT24:
>
> warning: (MACH_DAVINCI_EVM && MACH_SFFSDR && MACH_DAVINCI_DM6467_EVM && MACH_DAVINCI_DM365_EVM && MACH_DAVINCI_DA830_EVM && MACH_MITYOMAPL138 && MACH_MINI2440) selects EEPROM_AT24 which has unmet direct dependencies (I2C && SYSFS)
>
> Kevin Hilman initially added the 'select' to ensure that EEPROM_AT24
> is always enabled in machines that really want it for normal operation
> (i.e. for reading the MAC address). This broke when I2C was disabled,
> and Russell King followed up with another patch to select that as
> well.
>
> I now see that the SYSFS dependency is still missing, which leaves
> us with three options:
>
> a) add 'select SYSFS' in addition to the others
> b) change AT24_EEPPROM to work without sysfs (should be possible)
> c) remove all those selects again and get the files to build when
> I2C is disabled.
>
> I would really hate to do a) because adding select statements that
> hardwire user-selectable symbols is generally a bad idea. I first
> tried b) but then ended up redoing the patch from scratch to approach
> c), so we can also remove the other selects.
>
> I checked that CONFIG_I2C is still enabled with davinci_all_defconfig,
> so that does not have to change.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 45b146d746ea ("ARM: Davinci: Fix I2C build errors")
> Fixes: 22ca466847ad ("davinci: kconfig: select at24 eeprom for selected boards")

This looks good to me. The #ifdefs in the middle of davinci_evm_init()
are an eyesore, but getting rid of the selects is a big plus.

Thanks,
Sekhar