Re: [PATCH v4 4/5] i2c: designware: Add slave mode as separated driver

From: Mark Rutland
Date: Wed Dec 07 2016 - 14:08:13 EST


On Wed, Dec 07, 2016 at 05:55:51PM +0000, Luis Oliveira wrote:
> +#ifndef CONFIG_ACPI
> + if (!device_property_match_string(&pdev->dev, "mode", "slave"))
> + i2c_dw_configure_slave(pdev);
> + else
> +#endif

This kind of ifdeffery doesn't make sense. A single kernel binary may
support both ACPI and DT (but only one is used at runtime). Note that
this is the case for arm64 (our Kconfig has select OF, and our defconfig
has CONFIG_ACPI=y), so this logic is broken for DT arm64 platforms.

If you're trying to ensure that this *only* works in the DT case,
explicitly check for an of_node, or use the of_* accessors.

That applies for all instances of this pattern in this driver.

Thanks,
Mark.