Re: [PATCH 13/15] i2c: core: Allow drivers to specify index for irq to get from of / ACPI

Andy Shevchenko
2017-03-17T17:41:01Z

On Fri, 2017-03-17 at 10:55 +0100, Hans de Goede wrote:
> Some of or ACPI declared / enumerated devices may have multiple irq
> resources declared and the driver may want to use a different irq then
> the one with index 0.
>
> This commit adds a new irq_index field to struct i2c_driver and makes
> the i2c-core pass this to of_irq_get / acpi_dev_gpio_irq_get.
>
> This is esp. useful for ACPI declared devices where the irq with
> index 0 may be entirely useless and cause i2c_device_probe to fail
> with
> -EPROBE_DEFER.

> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -212,6 +212,9 @@ struct i2c_driver {
>   int (*detect)(struct i2c_client *, struct i2c_board_info *);
>   const unsigned short *address_list;
>   struct list_head clients;
> +
> + /* IRQ index for retreiving irq from ACPI resources */

We have kernel doc.

> + int irq_index;

Not sure about name (would like it to be shorter, but Friday evening
doesn't allow to be creative).

>  };
>  #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)

--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy