Re: [RFC 4/4] platform/x86: i2c-multi-instantiate: Add IRQ_RESOURCE_GPIO_OPTIONAL IRQ type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 5, 2020 at 10:00 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> Most I2C-drivers treat IRQs as optional and in some cases ACPI
> devices managed by i2c-multi-instantiate.c may have a GpioInt resource
> specified on some systems, while it is not there on others.

GpioInt()

> Add a new IRQ_RESOURCE_GPIO_OPTIONAL IRQ type, which still tries to get
> a GpioInt IRQ, but does not consider it a fatal error when this fails.

GpioInt()

...

> -#define IRQ_RESOURCE_TYPE      GENMASK(1, 0)
> -#define IRQ_RESOURCE_NONE      0
> -#define IRQ_RESOURCE_GPIO      1
> -#define IRQ_RESOURCE_APIC      2
> +#define IRQ_RESOURCE_TYPE              GENMASK(1, 0)
> +#define IRQ_RESOURCE_NONE              0
> +#define IRQ_RESOURCE_GPIO              1
> +#define IRQ_RESOURCE_GPIO_OPTIONAL     2
> +#define IRQ_RESOURCE_APIC              3

I think flag is cleaner:

#define IRQ_RESOURCE_OPTIONAL     BIT(2)

...

>                 case IRQ_RESOURCE_GPIO:
>                         ret = acpi_dev_gpio_irq_get(adev, inst_data[i].irq_idx);
> -                       if (ret < 0) {
> +                       if (ret < 0 && (!irq_optional || ret != -ENOENT)) {

ret < 0 && !((inst_data[i].flags & IRQ_RESOURCE_OPTIONAL) && ret == -ENOENT)

>                                 dev_err(dev, "Error requesting irq at index %d: %d\n",
>                                         inst_data[i].irq_idx, ret);
>                                 goto error;

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux