]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
iio: imu: lsm6dsx: Use i3cdev_to_dev to get device pointer
authorGuenter Roeck <linux@roeck-us.net>
Sat, 9 Nov 2024 14:54:30 +0000 (06:54 -0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Dec 2024 17:11:00 +0000 (17:11 +0000)
I3C client drivers should not include linux/i3c/master.h. Use
i3cdev_to_dev() to get the device pointer from struct i3c_device
to be able to avoid that include.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20241109145430.3702482-1-linux@roeck-us.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c

index 6952d901316fcef4231f88217b0b67b0fc9a4d5d..f968f32890d17447ae9579c433c4a3eb6a84740b 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/i3c/device.h>
-#include <linux/i3c/master.h>
 #include <linux/slab.h>
 #include <linux/regmap.h>
 
@@ -30,15 +29,16 @@ static int st_lsm6dsx_i3c_probe(struct i3c_device *i3cdev)
        };
        const struct i3c_device_id *id = i3c_device_match_id(i3cdev,
                                                            st_lsm6dsx_i3c_ids);
+       struct device *dev = i3cdev_to_dev(i3cdev);
        struct regmap *regmap;
 
        regmap = devm_regmap_init_i3c(i3cdev, &st_lsm6dsx_i3c_regmap_config);
        if (IS_ERR(regmap)) {
-               dev_err(&i3cdev->dev, "Failed to register i3c regmap %ld\n", PTR_ERR(regmap));
+               dev_err(dev, "Failed to register i3c regmap %ld\n", PTR_ERR(regmap));
                return PTR_ERR(regmap);
        }
 
-       return st_lsm6dsx_probe(&i3cdev->dev, 0, (uintptr_t)id->data, regmap);
+       return st_lsm6dsx_probe(dev, 0, (uintptr_t)id->data, regmap);
 }
 
 static struct i3c_driver st_lsm6dsx_driver = {