mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 05:02:31 +00:00
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>
This commit is contained in:
parent
17601ab9d7
commit
da83fd152e
@ -2127,25 +2127,15 @@ static const struct iio_info st_lsm6dsx_gyro_info = {
|
||||
.write_raw_get_fmt = st_lsm6dsx_write_raw_get_fmt,
|
||||
};
|
||||
|
||||
static int st_lsm6dsx_get_drdy_pin(struct st_lsm6dsx_hw *hw, int *drdy_pin)
|
||||
{
|
||||
struct device *dev = hw->dev;
|
||||
|
||||
if (!dev_fwnode(dev))
|
||||
return -EINVAL;
|
||||
|
||||
return device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin);
|
||||
}
|
||||
|
||||
static int
|
||||
st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
|
||||
const struct st_lsm6dsx_reg **drdy_reg)
|
||||
{
|
||||
struct device *dev = hw->dev;
|
||||
int err = 0, drdy_pin;
|
||||
|
||||
if (st_lsm6dsx_get_drdy_pin(hw, &drdy_pin) < 0) {
|
||||
if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
|
||||
struct st_sensors_platform_data *pdata;
|
||||
struct device *dev = hw->dev;
|
||||
|
||||
pdata = (struct st_sensors_platform_data *)dev->platform_data;
|
||||
drdy_pin = pdata ? pdata->drdy_int_pin : 1;
|
||||
@ -2180,7 +2170,7 @@ static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
|
||||
hub_settings = &hw->settings->shub_settings;
|
||||
|
||||
pdata = (struct st_sensors_platform_data *)dev->platform_data;
|
||||
if ((dev_fwnode(dev) && device_property_read_bool(dev, "st,pullups")) ||
|
||||
if (device_property_read_bool(dev, "st,pullups") ||
|
||||
(pdata && pdata->pullups)) {
|
||||
if (hub_settings->pullup_en.sec_page) {
|
||||
err = st_lsm6dsx_set_page(hw, true);
|
||||
@ -2565,7 +2555,7 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
|
||||
return err;
|
||||
|
||||
pdata = (struct st_sensors_platform_data *)dev->platform_data;
|
||||
if ((dev_fwnode(dev) && device_property_read_bool(dev, "drive-open-drain")) ||
|
||||
if (device_property_read_bool(dev, "drive-open-drain") ||
|
||||
(pdata && pdata->open_drain)) {
|
||||
reg = &hw->settings->irq_config.od;
|
||||
err = regmap_update_bits(hw->regmap, reg->addr, reg->mask,
|
||||
@ -2693,8 +2683,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
|
||||
|
||||
hub_settings = &hw->settings->shub_settings;
|
||||
if (hub_settings->master_en.addr &&
|
||||
(!dev_fwnode(dev) ||
|
||||
!device_property_read_bool(dev, "st,disable-sensor-hub"))) {
|
||||
!device_property_read_bool(dev, "st,disable-sensor-hub")) {
|
||||
err = st_lsm6dsx_shub_probe(hw, name);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -2735,7 +2724,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((dev_fwnode(dev) && device_property_read_bool(dev, "wakeup-source")) ||
|
||||
if (device_property_read_bool(dev, "wakeup-source") ||
|
||||
(pdata && pdata->wakeup_source))
|
||||
device_init_wakeup(dev, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user