Re: [PATCH v2] i2c: move acpi code back into the core

From: Mika Westerberg
Date: Thu Sep 25 2014 - 05:03:10 EST


On Wed, Sep 24, 2014 at 11:36:31PM +0200, Wolfram Sang wrote:
> Commit 5d98e61d337c ("I2C/ACPI: Add i2c ACPI operation region support")
> renamed the i2c-core module. This may cause regressions for
> distributions, so put the ACPI code back into the core.
>
> Reported-by: Jean Delvare <jdelvare@xxxxxxx>
> Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

Tested-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

One comment though,

> Cc: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> Cc: Jean Delvare <jdelvare@xxxxxxx>
> ---
> +#if defined(CONFIG_ACPI)
> +struct acpi_i2c_handler_data {
> + struct acpi_connection_info info;
> + struct i2c_adapter *adapter;
> +};
> +
> +struct gsb_buffer {
> + u8 status;
> + u8 len;
> + union {
> + u16 wdata;
> + u8 bdata;
> + u8 data[0];
> + };
> +} __packed;

These two structures should be inside CONFIG_ACPI_I2C_OPREGION because
they are used in that code. However, this still works fine now as you
can't select CONFIG_ACPI_I2C_OPREGION without CONFIG_ACPI.

> +
> +static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data)
> +{
> + struct i2c_board_info *info = data;
> +
> + if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
> + struct acpi_resource_i2c_serialbus *sb;
> +
> + sb = &ares->data.i2c_serial_bus;
> + if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) {
> + info->addr = sb->slave_address;
> + if (sb->access_mode == ACPI_I2C_10BIT_MODE)
> + info->flags |= I2C_CLIENT_TEN;
> + }
> + } else if (info->irq < 0) {
> + struct resource r;
> +
> + if (acpi_dev_resource_interrupt(ares, 0, &r))
> + info->irq = r.start;
> + }
> +
> + /* Tell the ACPI core to skip this resource */
> + return 1;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/