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: Remove useless dev_fwnode() calls

The device property APIs designed that way that they will return an error when
there is no valid fwnode provided. Moreover, the check for NULL of dev_fwnode()
is not fully correct as in some (currently rare) cases it may contain an error
pointer. This is not a problem anyway (see keyword 'valid' above) that's why
the code works properly even without this change.

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

authored by

Andy Shevchenko and committed by
Jonathan Cameron
da83fd15 17601ab9

+6 -17
+6 -17
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 2127 2127 .write_raw_get_fmt = st_lsm6dsx_write_raw_get_fmt, 2128 2128 }; 2129 2129 2130 - static int st_lsm6dsx_get_drdy_pin(struct st_lsm6dsx_hw *hw, int *drdy_pin) 2131 - { 2132 - struct device *dev = hw->dev; 2133 - 2134 - if (!dev_fwnode(dev)) 2135 - return -EINVAL; 2136 - 2137 - return device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin); 2138 - } 2139 - 2140 2130 static int 2141 2131 st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw, 2142 2132 const struct st_lsm6dsx_reg **drdy_reg) 2143 2133 { 2134 + struct device *dev = hw->dev; 2144 2135 int err = 0, drdy_pin; 2145 2136 2146 - if (st_lsm6dsx_get_drdy_pin(hw, &drdy_pin) < 0) { 2137 + if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) { 2147 2138 struct st_sensors_platform_data *pdata; 2148 - struct device *dev = hw->dev; 2149 2139 2150 2140 pdata = (struct st_sensors_platform_data *)dev->platform_data; 2151 2141 drdy_pin = pdata ? pdata->drdy_int_pin : 1; ··· 2170 2180 hub_settings = &hw->settings->shub_settings; 2171 2181 2172 2182 pdata = (struct st_sensors_platform_data *)dev->platform_data; 2173 - if ((dev_fwnode(dev) && device_property_read_bool(dev, "st,pullups")) || 2183 + if (device_property_read_bool(dev, "st,pullups") || 2174 2184 (pdata && pdata->pullups)) { 2175 2185 if (hub_settings->pullup_en.sec_page) { 2176 2186 err = st_lsm6dsx_set_page(hw, true); ··· 2555 2565 return err; 2556 2566 2557 2567 pdata = (struct st_sensors_platform_data *)dev->platform_data; 2558 - if ((dev_fwnode(dev) && device_property_read_bool(dev, "drive-open-drain")) || 2568 + if (device_property_read_bool(dev, "drive-open-drain") || 2559 2569 (pdata && pdata->open_drain)) { 2560 2570 reg = &hw->settings->irq_config.od; 2561 2571 err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, ··· 2683 2693 2684 2694 hub_settings = &hw->settings->shub_settings; 2685 2695 if (hub_settings->master_en.addr && 2686 - (!dev_fwnode(dev) || 2687 - !device_property_read_bool(dev, "st,disable-sensor-hub"))) { 2696 + !device_property_read_bool(dev, "st,disable-sensor-hub")) { 2688 2697 err = st_lsm6dsx_shub_probe(hw, name); 2689 2698 if (err < 0) 2690 2699 return err; ··· 2724 2735 return err; 2725 2736 } 2726 2737 2727 - if ((dev_fwnode(dev) && device_property_read_bool(dev, "wakeup-source")) || 2738 + if (device_property_read_bool(dev, "wakeup-source") || 2728 2739 (pdata && pdata->wakeup_source)) 2729 2740 device_init_wakeup(dev, true); 2730 2741