diff mbox series

[v2,02/13] iio: adc: pac1934: Replace strange way of checking type of enumeration

Message ID 20241024130424.3818291-3-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Headers show
Series iio: Clean up acpi_match_device() use cases | expand

Commit Message

Andy Shevchenko Oct. 24, 2024, 12:36 p.m. UTC
When device is enumerated via ACPI the respective device node is of
ACPI device type. Use that to check for ACPI enumeration, rather than
calling for full match which is O(n) vs. O(1) for the regular check.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/adc/pac1934.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

marius.cristea@microchip.com Oct. 24, 2024, 1:25 p.m. UTC | #1
Hi Andy,

  Thank you for the patch. It looks OK for me.

Reviewed-by: Marius Cristea <marius.cristea@microchip.com>

Regards,
Marius


On Thu, 2024-10-24 at 15:36 +0300, Andy Shevchenko wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> When device is enumerated via ACPI the respective device node is of
> ACPI device type. Use that to check for ACPI enumeration, rather than
> calling for full match which is O(n) vs. O(1) for the regular check.
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/adc/pac1934.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c
> index 7ef249d83286..20802b7f49ea 100644
> --- a/drivers/iio/adc/pac1934.c
> +++ b/drivers/iio/adc/pac1934.c
> @@ -1507,7 +1507,7 @@ static int pac1934_probe(struct i2c_client
> *client)
>                 indio_dev->name = pac1934_chip_config[ret].name;
>         }
> 
> -       if (acpi_match_device(dev->driver->acpi_match_table, dev))
> +       if (is_acpi_device_node(dev_fwnode(dev)))
>                 ret = pac1934_acpi_parse_channel_config(client,
> info);
>         else
>                 /*
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c
index 7ef249d83286..20802b7f49ea 100644
--- a/drivers/iio/adc/pac1934.c
+++ b/drivers/iio/adc/pac1934.c
@@ -1507,7 +1507,7 @@  static int pac1934_probe(struct i2c_client *client)
 		indio_dev->name = pac1934_chip_config[ret].name;
 	}
 
-	if (acpi_match_device(dev->driver->acpi_match_table, dev))
+	if (is_acpi_device_node(dev_fwnode(dev)))
 		ret = pac1934_acpi_parse_channel_config(client, info);
 	else
 		/*