]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: imu: inv_mpu6050: Use upper_16_bits()/lower_16_bits() helpers
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Wed, 4 Sep 2024 18:45:43 +0000 (21:45 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 30 Sep 2024 08:21:02 +0000 (09:21 +0100)
Use upper_16_bits()/lower_16_bits() helpers instead of open-coding them.
This is easier to scan quickly compared to bitwise manipulation, and
it is pleasingly symmetric.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20240904184543.1219866-1-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c

index f7bce428d9eb45c2e68add02ee31697241dabfc5..b15d8c94cc11eaac9d744e658ab77c2bf3ffba91 100644 (file)
@@ -10,6 +10,8 @@
 #include <linux/i2c.h>
 #include <linux/dmi.h>
 #include <linux/acpi.h>
+#include <linux/wordpart.h>
+
 #include "inv_mpu_iio.h"
 
 enum inv_mpu_product_name {
@@ -118,8 +120,8 @@ static int inv_mpu_process_acpi_config(struct i2c_client *client,
                return ret;
 
        acpi_dev_free_resource_list(&resources);
-       *primary_addr = i2c_addr & 0x0000ffff;
-       *secondary_addr = (i2c_addr & 0xffff0000) >> 16;
+       *primary_addr = lower_16_bits(i2c_addr);
+       *secondary_addr = upper_16_bits(i2c_addr);
 
        return 0;
 }