Re: [PATCH] i2c: move of helpers into the core

From: Wolfram Sang
Date: Tue Aug 20 2013 - 10:30:55 EST


On Tue, Aug 20, 2013 at 12:28:13PM +0300, Mika Westerberg wrote:
> [Added Jerry as he found out a problem when acpi_i2c is being build as a
> module, this should solve it as well.]
>
> On Tue, Aug 20, 2013 at 01:25:27AM +0200, Rafael J. Wysocki wrote:
> > On Monday, August 19, 2013 04:56:19 PM Stephen Warren wrote:
> > > On 08/19/2013 05:04 PM, Rafael J. Wysocki wrote:
> > > > On Monday, August 19, 2013 03:19:18 PM Wolfram Sang wrote:
> > > >> I2C of helpers used to live in of_i2c.c but experience (from SPI) shows
> > > >> that it is much cleaner to have this in the core. This also removes a
> > > >> circular dependency between the helpers and the core, and so we can
> > > >> finally register child nodes in the core instead of doing this manually
> > > >> in each driver. So, fix the drivers and documentation, too.
> > > >
> > > > Perhaps we should do the analogous for ACPI then?
>
> Here is the ACPI version based on the current patch from Wolfram (there is
> a compile error because of missing dummy implementation of
> of_i2c_register_devices())
>
> From: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> Subject: [PATCH] i2c: move ACPI helpers into the core
>
> This follows what has already been done for the DeviceTree helpers. Move
> the ACPI helpers from drivers/acpi/acpi_i2c.c to the I2C core and update
> documentation accordingly.
>
> This also solves a problem reported by Jerry Snitselaar that we can't build
> the ACPI I2C helpers as a module.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

Nice, one thing, though:

> /* create pre-declared device nodes */
> of_i2c_register_devices(adap);
> + acpi_i2c_register_devices(adap);

I prefer the if (IS_ENABLED()) solution and will use this in my V2 as
well.

Attachment: signature.asc
Description: Digital signature