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

Configure Feed

Select the types of activity you want to include in your feed.

iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-15-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
57063b1d 80253ed8

+5 -10
+5 -10
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 2132 2132 const struct st_lsm6dsx_reg **drdy_reg) 2133 2133 { 2134 2134 struct device *dev = hw->dev; 2135 + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev); 2135 2136 int err = 0, drdy_pin; 2136 2137 2137 - if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) { 2138 - struct st_sensors_platform_data *pdata; 2139 - 2140 - pdata = (struct st_sensors_platform_data *)dev->platform_data; 2138 + if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) 2141 2139 drdy_pin = pdata ? pdata->drdy_int_pin : 1; 2142 - } 2143 2140 2144 2141 switch (drdy_pin) { 2145 2142 case 1: ··· 2159 2162 static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw) 2160 2163 { 2161 2164 const struct st_lsm6dsx_shub_settings *hub_settings; 2162 - struct st_sensors_platform_data *pdata; 2163 2165 struct device *dev = hw->dev; 2166 + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev); 2164 2167 unsigned int data; 2165 2168 int err = 0; 2166 2169 2167 2170 hub_settings = &hw->settings->shub_settings; 2168 2171 2169 - pdata = (struct st_sensors_platform_data *)dev->platform_data; 2170 2172 if (device_property_read_bool(dev, "st,pullups") || 2171 2173 (pdata && pdata->pullups)) { 2172 2174 if (hub_settings->pullup_en.sec_page) { ··· 2520 2524 2521 2525 static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw) 2522 2526 { 2523 - struct st_sensors_platform_data *pdata; 2524 2527 const struct st_lsm6dsx_reg *reg; 2525 2528 struct device *dev = hw->dev; 2529 + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev); 2526 2530 unsigned long irq_type; 2527 2531 bool irq_active_low; 2528 2532 int err; ··· 2549 2553 if (err < 0) 2550 2554 return err; 2551 2555 2552 - pdata = (struct st_sensors_platform_data *)dev->platform_data; 2553 2556 if (device_property_read_bool(dev, "drive-open-drain") || 2554 2557 (pdata && pdata->open_drain)) { 2555 2558 reg = &hw->settings->irq_config.od; ··· 2633 2638 int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, 2634 2639 struct regmap *regmap) 2635 2640 { 2636 - struct st_sensors_platform_data *pdata = dev->platform_data; 2641 + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev); 2637 2642 const struct st_lsm6dsx_shub_settings *hub_settings; 2638 2643 struct st_lsm6dsx_hw *hw; 2639 2644 const char *name = NULL;