Commit e278558a authored by Andy Shevchenko's avatar Andy Shevchenko

iio: inv_mpu6050: Use i2c_acpi_get_i2c_resource() helper

ACPI provides a generic helper to get I2C Serial Bus resources.
Use it instead of open coded variant.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent a3dd034a
...@@ -91,18 +91,14 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev, ...@@ -91,18 +91,14 @@ static int asus_acpi_get_sensor_info(struct acpi_device *adev,
static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data) static int acpi_i2c_check_resource(struct acpi_resource *ares, void *data)
{ {
struct acpi_resource_i2c_serialbus *sb;
u32 *addr = data; u32 *addr = data;
if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { if (i2c_acpi_get_i2c_resource(ares, &sb)) {
struct acpi_resource_i2c_serialbus *sb; if (*addr)
*addr |= (sb->slave_address << 16);
sb = &ares->data.i2c_serial_bus; else
if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { *addr = sb->slave_address;
if (*addr)
*addr |= (sb->slave_address << 16);
else
*addr = sb->slave_address;
}
} }
/* Tell the ACPI core that we already copied this address */ /* Tell the ACPI core that we already copied this address */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment