Re: [PATCH v4 03/24] i2c: acpi: Modify i2c_acpi_get_irq() to use resource

Andy Shevchenko
2024-01-06T14:49:01Z

On Tue, Jan 02, 2024 at 02:07:27PM -0700, Mark Hasemeyer wrote:
> The i2c_acpi_irq_context structure provides redundant information that
> can be provided with struct resource.
>
> Refactor i2c_acpi_get_irq() to use struct resource instead of struct
> i2c_acpi_irq_context.

...

> ret = acpi_dev_get_resources(adev, &resource_list,
> - i2c_acpi_add_irq_resource, &irq_ctx);
> + i2c_acpi_add_irq_resource, r);

Up to you, but you can make it a single line.

ret = acpi_dev_get_resources(adev, &resource_list, i2c_acpi_add_irq_resource, r);

> if (ret < 0)
> return ret;

...

> +++ b/drivers/i2c/i2c-core-base.c

> + struct resource r = {};

Needs ioport.h.

...

> + irq = i2c_acpi_get_irq(client, &r);
> + if (r.flags & IORESOURCE_IRQ_WAKECAPABLE)

Ditto.

> client->flags |= I2C_CLIENT_WAKE;
> }

...

> +++ b/drivers/i2c/i2c-core.h

> +int i2c_acpi_get_irq(struct i2c_client *client, struct resource *r);

> +static inline int i2c_acpi_get_irq(struct i2c_client *client, struct resource *r)

Needs a forward declaration (besides the inclusion block is a total mess
in this file).

--
With Best Regards,
Andy Shevchenko