* Re: [PATCH v5 15/15] iio: inv_mpu6050: Use i2c_acpi_get_i2c_resource() helper
[not found] ` <20181128114535.80223-16-andriy.shevchenko@linux.intel.com>
@ 2018-12-02 16:41 ` Jonathan Cameron
0 siblings, 0 replies; only message in thread
From: Jonathan Cameron @ 2018-12-02 16:41 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Darren Hart, platform-driver-x86, Rafael J. Wysocki, linux-acpi,
Wolfram Sang, Mika Westerberg, linux-i2c, Hans de Goede,
Heikki Krogerus, linux-kernel, linux-iio
+CC linux-iio mostly so I can track it and because others may care.
On Wed, 28 Nov 2018 13:45:35 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> ACPI provides a generic helper to get I2C Serial Bus resources.
> Use it instead of open coded variant.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Thanks,
Jonathan
> ---
> drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> index d78a10403bac..a961b5a06fe6 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> @@ -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)
> {
> + struct acpi_resource_i2c_serialbus *sb;
> u32 *addr = data;
>
> - if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
> - struct acpi_resource_i2c_serialbus *sb;
> -
> - sb = &ares->data.i2c_serial_bus;
> - if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) {
> - if (*addr)
> - *addr |= (sb->slave_address << 16);
> - else
> - *addr = sb->slave_address;
> - }
> + if (i2c_acpi_get_i2c_resource(ares, &sb)) {
> + if (*addr)
> + *addr |= (sb->slave_address << 16);
> + else
> + *addr = sb->slave_address;
> }
>
> /* Tell the ACPI core that we already copied this address */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-02 16:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20181128114535.80223-1-andriy.shevchenko@linux.intel.com>
[not found] ` <20181128114535.80223-16-andriy.shevchenko@linux.intel.com>
2018-12-02 16:41 ` [PATCH v5 15/15] iio: inv_mpu6050: Use i2c_acpi_get_i2c_resource() helper Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).