Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: imu: inv_mpu6050: Check ACPI companion directly

Instead of checking for ACPI handle followed by extracting a companion
device, do the latter first and use it for checks.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203155920.18586-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
1ef6ff6e c53c7740

+2 -3
+2 -3
drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
··· 127 127 int inv_mpu_acpi_create_mux_client(struct i2c_client *client) 128 128 { 129 129 struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(&client->dev)); 130 + struct acpi_device *adev = ACPI_COMPANION(&client->dev); 130 131 131 132 st->mux_client = NULL; 132 - if (ACPI_HANDLE(&client->dev)) { 133 + if (adev) { 133 134 struct i2c_board_info info; 134 135 struct i2c_client *mux_client; 135 - struct acpi_device *adev; 136 136 int ret = -1; 137 137 138 - adev = ACPI_COMPANION(&client->dev); 139 138 memset(&info, 0, sizeof(info)); 140 139 141 140 dmi_check_system(inv_mpu_dev_list);