diff mbox series

[v3,03/24] iio: imu: inv_mpu6050: Replace strange way of checking type of enumeration

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

Commit Message

Andy Shevchenko Oct. 24, 2024, 7:04 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.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jonathan Cameron Oct. 26, 2024, 11:04 a.m. UTC | #1
On Thu, 24 Oct 2024 22:04:52 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> 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.
> 
> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.
diff mbox series

Patch

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
index b15d8c94cc11..373e59f6d91a 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
@@ -104,14 +104,11 @@  static int inv_mpu_process_acpi_config(struct i2c_client *client,
 				       unsigned short *secondary_addr)
 {
 	struct acpi_device *adev = ACPI_COMPANION(&client->dev);
-	const struct acpi_device_id *id;
 	u32 i2c_addr = 0;
 	LIST_HEAD(resources);
 	int ret;
 
-	id = acpi_match_device(client->dev.driver->acpi_match_table,
-			       &client->dev);
-	if (!id)
+	if (!is_acpi_device_node(dev_fwnode(&client->dev)))
 		return -ENODEV;
 
 	ret = acpi_dev_get_resources(adev, &resources,