iio: fix devm_iio_trigger_alloc with parent.cocci

Use cocci semantic patch:
@@
expression trigger, P;
@@
   trigger = devm_iio_trigger_alloc(P, ...);
   ...
-  trigger->dev.parent = P;

To remove trigger->dev.parent, since it is set by default.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-3-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Gwendal Grignou 2021-03-09 11:36:14 -08:00 committed by Jonathan Cameron
parent 995071d36b
commit 8a22522016
30 changed files with 0 additions and 33 deletions

View File

@ -1236,8 +1236,6 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
st->dready_trig->ops = &adxl372_trigger_ops; st->dready_trig->ops = &adxl372_trigger_ops;
st->peak_datardy_trig->ops = &adxl372_peak_data_trigger_ops; st->peak_datardy_trig->ops = &adxl372_peak_data_trigger_ops;
st->dready_trig->dev.parent = dev;
st->peak_datardy_trig->dev.parent = dev;
iio_trigger_set_drvdata(st->dready_trig, indio_dev); iio_trigger_set_drvdata(st->dready_trig, indio_dev);
iio_trigger_set_drvdata(st->peak_datardy_trig, indio_dev); iio_trigger_set_drvdata(st->peak_datardy_trig, indio_dev);
ret = devm_iio_trigger_register(dev, st->dready_trig); ret = devm_iio_trigger_register(dev, st->dready_trig);

View File

@ -1478,7 +1478,6 @@ static int bmc150_accel_triggers_setup(struct iio_dev *indio_dev,
break; break;
} }
t->indio_trig->dev.parent = dev;
t->indio_trig->ops = &bmc150_accel_trigger_ops; t->indio_trig->ops = &bmc150_accel_trigger_ops;
t->intr = bmc150_accel_triggers[i].intr; t->intr = bmc150_accel_triggers[i].intr;
t->data = data; t->data = data;

View File

@ -1419,7 +1419,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
goto err_poweroff; goto err_poweroff;
} }
data->dready_trig->dev.parent = &client->dev;
data->dready_trig->ops = &kxcjk1013_trigger_ops; data->dready_trig->ops = &kxcjk1013_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);
indio_dev->trig = data->dready_trig; indio_dev->trig = data->dready_trig;
@ -1428,7 +1427,6 @@ static int kxcjk1013_probe(struct i2c_client *client,
if (ret) if (ret)
goto err_poweroff; goto err_poweroff;
data->motion_trig->dev.parent = &client->dev;
data->motion_trig->ops = &kxcjk1013_trigger_ops; data->motion_trig->ops = &kxcjk1013_trigger_ops;
iio_trigger_set_drvdata(data->motion_trig, indio_dev); iio_trigger_set_drvdata(data->motion_trig, indio_dev);
ret = iio_trigger_register(data->motion_trig); ret = iio_trigger_register(data->motion_trig);

View File

@ -1465,7 +1465,6 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev)
if (!trig) if (!trig)
return -ENOMEM; return -ENOMEM;
trig->dev.parent = &data->client->dev;
trig->ops = &mma8452_trigger_ops; trig->ops = &mma8452_trigger_ops;
iio_trigger_set_drvdata(trig, indio_dev); iio_trigger_set_drvdata(trig, indio_dev);

View File

@ -450,7 +450,6 @@ static int mxc4005_probe(struct i2c_client *client,
return ret; return ret;
} }
data->dready_trig->dev.parent = &client->dev;
data->dready_trig->ops = &mxc4005_trigger_ops; data->dready_trig->ops = &mxc4005_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);
indio_dev->trig = data->dready_trig; indio_dev->trig = data->dready_trig;

View File

@ -558,7 +558,6 @@ static int stk8312_probe(struct i2c_client *client,
goto err_power_off; goto err_power_off;
} }
data->dready_trig->dev.parent = &client->dev;
data->dready_trig->ops = &stk8312_trigger_ops; data->dready_trig->ops = &stk8312_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);
ret = iio_trigger_register(data->dready_trig); ret = iio_trigger_register(data->dready_trig);

View File

@ -454,7 +454,6 @@ static int stk8ba50_probe(struct i2c_client *client,
goto err_power_off; goto err_power_off;
} }
data->dready_trig->dev.parent = &client->dev;
data->dready_trig->ops = &stk8ba50_trigger_ops; data->dready_trig->ops = &stk8ba50_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);
ret = iio_trigger_register(data->dready_trig); ret = iio_trigger_register(data->dready_trig);

View File

@ -668,7 +668,6 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
return -ENOMEM; return -ENOMEM;
st->trig->ops = &ad7606_trigger_ops; st->trig->ops = &ad7606_trigger_ops;
st->trig->dev.parent = dev;
iio_trigger_set_drvdata(st->trig, indio_dev); iio_trigger_set_drvdata(st->trig, indio_dev);
ret = devm_iio_trigger_register(dev, st->trig); ret = devm_iio_trigger_register(dev, st->trig);
if (ret) if (ret)

View File

@ -253,7 +253,6 @@ static int ad7766_probe(struct spi_device *spi)
return -ENOMEM; return -ENOMEM;
ad7766->trig->ops = &ad7766_trigger_ops; ad7766->trig->ops = &ad7766_trigger_ops;
ad7766->trig->dev.parent = &spi->dev;
iio_trigger_set_drvdata(ad7766->trig, ad7766); iio_trigger_set_drvdata(ad7766->trig, ad7766);
ret = devm_request_irq(&spi->dev, spi->irq, ad7766_irq, ret = devm_request_irq(&spi->dev, spi->irq, ad7766_irq,

View File

@ -631,7 +631,6 @@ static int ad7768_probe(struct spi_device *spi)
return -ENOMEM; return -ENOMEM;
st->trig->ops = &ad7768_trigger_ops; st->trig->ops = &ad7768_trigger_ops;
st->trig->dev.parent = &spi->dev;
iio_trigger_set_drvdata(st->trig, indio_dev); iio_trigger_set_drvdata(st->trig, indio_dev);
ret = devm_iio_trigger_register(&spi->dev, st->trig); ret = devm_iio_trigger_register(&spi->dev, st->trig);
if (ret) if (ret)

View File

@ -473,7 +473,6 @@ static int max1027_probe(struct spi_device *spi)
} }
st->trig->ops = &max1027_trigger_ops; st->trig->ops = &max1027_trigger_ops;
st->trig->dev.parent = &spi->dev;
iio_trigger_set_drvdata(st->trig, indio_dev); iio_trigger_set_drvdata(st->trig, indio_dev);
ret = devm_iio_trigger_register(&indio_dev->dev, ret = devm_iio_trigger_register(&indio_dev->dev,
st->trig); st->trig);

View File

@ -497,7 +497,6 @@ static int ccs811_probe(struct i2c_client *client,
goto err_poweroff; goto err_poweroff;
} }
data->drdy_trig->dev.parent = &client->dev;
data->drdy_trig->ops = &ccs811_trigger_ops; data->drdy_trig->ops = &ccs811_trigger_ops;
iio_trigger_set_drvdata(data->drdy_trig, indio_dev); iio_trigger_set_drvdata(data->drdy_trig, indio_dev);
indio_dev->trig = data->drdy_trig; indio_dev->trig = data->drdy_trig;

View File

@ -646,7 +646,6 @@ static int scd30_setup_trigger(struct iio_dev *indio_dev)
return -ENOMEM; return -ENOMEM;
} }
trig->dev.parent = dev;
trig->ops = &scd30_trigger_ops; trig->ops = &scd30_trigger_ops;
iio_trigger_set_drvdata(trig, indio_dev); iio_trigger_set_drvdata(trig, indio_dev);

View File

@ -593,7 +593,6 @@ static int adxrs290_probe_trigger(struct iio_dev *indio_dev)
if (!st->dready_trig) if (!st->dready_trig)
return -ENOMEM; return -ENOMEM;
st->dready_trig->dev.parent = &st->spi->dev;
st->dready_trig->ops = &adxrs290_trigger_ops; st->dready_trig->ops = &adxrs290_trigger_ops;
iio_trigger_set_drvdata(st->dready_trig, indio_dev); iio_trigger_set_drvdata(st->dready_trig, indio_dev);

View File

@ -1148,14 +1148,12 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
if (!data->motion_trig) if (!data->motion_trig)
return -ENOMEM; return -ENOMEM;
data->dready_trig->dev.parent = dev;
data->dready_trig->ops = &bmg160_trigger_ops; data->dready_trig->ops = &bmg160_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);
ret = iio_trigger_register(data->dready_trig); ret = iio_trigger_register(data->dready_trig);
if (ret) if (ret)
return ret; return ret;
data->motion_trig->dev.parent = dev;
data->motion_trig->ops = &bmg160_trigger_ops; data->motion_trig->ops = &bmg160_trigger_ops;
iio_trigger_set_drvdata(data->motion_trig, indio_dev); iio_trigger_set_drvdata(data->motion_trig, indio_dev);
ret = iio_trigger_register(data->motion_trig); ret = iio_trigger_register(data->motion_trig);

View File

@ -875,7 +875,6 @@ static int fxas21002c_trigger_probe(struct fxas21002c_data *data)
if (ret < 0) if (ret < 0)
return ret; return ret;
data->dready_trig->dev.parent = dev;
data->dready_trig->ops = &fxas21002c_trigger_ops; data->dready_trig->ops = &fxas21002c_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);

View File

@ -531,7 +531,6 @@ static int afe4403_probe(struct spi_device *spi)
iio_trigger_set_drvdata(afe->trig, indio_dev); iio_trigger_set_drvdata(afe->trig, indio_dev);
afe->trig->ops = &afe4403_trigger_ops; afe->trig->ops = &afe4403_trigger_ops;
afe->trig->dev.parent = afe->dev;
ret = iio_trigger_register(afe->trig); ret = iio_trigger_register(afe->trig);
if (ret) { if (ret) {

View File

@ -538,7 +538,6 @@ static int afe4404_probe(struct i2c_client *client,
iio_trigger_set_drvdata(afe->trig, indio_dev); iio_trigger_set_drvdata(afe->trig, indio_dev);
afe->trig->ops = &afe4404_trigger_ops; afe->trig->ops = &afe4404_trigger_ops;
afe->trig->dev.parent = afe->dev;
ret = iio_trigger_register(afe->trig); ret = iio_trigger_register(afe->trig);
if (ret) { if (ret) {

View File

@ -135,7 +135,6 @@ int hts221_allocate_trigger(struct iio_dev *iio_dev)
iio_trigger_set_drvdata(hw->trig, iio_dev); iio_trigger_set_drvdata(hw->trig, iio_dev);
hw->trig->ops = &hts221_trigger_ops; hw->trig->ops = &hts221_trigger_ops;
hw->trig->dev.parent = hw->dev;
iio_dev->trig = iio_trigger_get(hw->trig); iio_dev->trig = iio_trigger_get(hw->trig);
return devm_iio_trigger_register(hw->dev, hw->trig); return devm_iio_trigger_register(hw->dev, hw->trig);

View File

@ -1268,7 +1268,6 @@ static struct iio_trigger *kmx61_trigger_setup(struct kmx61_data *data,
if (!trig) if (!trig)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
trig->dev.parent = &data->client->dev;
trig->ops = &kmx61_trigger_ops; trig->ops = &kmx61_trigger_ops;
iio_trigger_set_drvdata(trig, indio_dev); iio_trigger_set_drvdata(trig, indio_dev);

View File

@ -990,7 +990,6 @@ static int rpr0521_probe(struct i2c_client *client,
ret = -ENOMEM; ret = -ENOMEM;
goto err_pm_disable; goto err_pm_disable;
} }
data->drdy_trigger0->dev.parent = indio_dev->dev.parent;
data->drdy_trigger0->ops = &rpr0521_trigger_ops; data->drdy_trigger0->ops = &rpr0521_trigger_ops;
indio_dev->available_scan_masks = rpr0521_available_scan_masks; indio_dev->available_scan_masks = rpr0521_available_scan_masks;
iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev); iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev);

View File

@ -1247,7 +1247,6 @@ static int si1145_probe_trigger(struct iio_dev *indio_dev)
if (!trig) if (!trig)
return -ENOMEM; return -ENOMEM;
trig->dev.parent = &client->dev;
trig->ops = &si1145_trigger_ops; trig->ops = &si1145_trigger_ops;
iio_trigger_set_drvdata(trig, indio_dev); iio_trigger_set_drvdata(trig, indio_dev);

View File

@ -210,7 +210,6 @@ static int st_uvis25_allocate_trigger(struct iio_dev *iio_dev)
return -ENOMEM; return -ENOMEM;
iio_trigger_set_drvdata(hw->trig, iio_dev); iio_trigger_set_drvdata(hw->trig, iio_dev);
hw->trig->dev.parent = dev;
return devm_iio_trigger_register(dev, hw->trig); return devm_iio_trigger_register(dev, hw->trig);
} }

View File

@ -1002,7 +1002,6 @@ static int vcnl4010_probe_trigger(struct iio_dev *indio_dev)
if (!trigger) if (!trigger)
return -ENOMEM; return -ENOMEM;
trigger->dev.parent = &client->dev;
trigger->ops = &vcnl4010_trigger_ops; trigger->ops = &vcnl4010_trigger_ops;
iio_trigger_set_drvdata(trigger, indio_dev); iio_trigger_set_drvdata(trigger, indio_dev);

View File

@ -511,7 +511,6 @@ static int vcnl4035_probe_trigger(struct iio_dev *indio_dev)
if (!data->drdy_trigger0) if (!data->drdy_trigger0)
return -ENOMEM; return -ENOMEM;
data->drdy_trigger0->dev.parent = indio_dev->dev.parent;
data->drdy_trigger0->ops = &vcnl4035_trigger_ops; data->drdy_trigger0->ops = &vcnl4035_trigger_ops;
iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev); iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev);
ret = devm_iio_trigger_register(indio_dev->dev.parent, ret = devm_iio_trigger_register(indio_dev->dev.parent,

View File

@ -922,7 +922,6 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
goto err_poweroff; goto err_poweroff;
} }
data->dready_trig->dev.parent = dev;
data->dready_trig->ops = &bmc150_magn_trigger_ops; data->dready_trig->ops = &bmc150_magn_trigger_ops;
iio_trigger_set_drvdata(data->dready_trig, indio_dev); iio_trigger_set_drvdata(data->dready_trig, indio_dev);
ret = iio_trigger_register(data->dready_trig); ret = iio_trigger_register(data->dready_trig);

View File

@ -579,7 +579,6 @@ int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
if (!data->drdy_trig) if (!data->drdy_trig)
return -ENOMEM; return -ENOMEM;
data->drdy_trig->dev.parent = dev;
ret = devm_iio_trigger_register(dev, data->drdy_trig); ret = devm_iio_trigger_register(dev, data->drdy_trig);
if (ret < 0) if (ret < 0)
return ret; return ret;

View File

@ -1413,7 +1413,6 @@ static int zpa2326_init_managed_trigger(struct device *parent,
return -ENOMEM; return -ENOMEM;
/* Basic setup. */ /* Basic setup. */
trigger->dev.parent = parent;
trigger->ops = &zpa2326_trigger_ops; trigger->ops = &zpa2326_trigger_ops;
private->trigger = trigger; private->trigger = trigger;

View File

@ -1453,7 +1453,6 @@ static int sx9310_probe(struct i2c_client *client)
if (!data->trig) if (!data->trig)
return -ENOMEM; return -ENOMEM;
data->trig->dev.parent = dev;
data->trig->ops = &sx9310_trigger_ops; data->trig->ops = &sx9310_trigger_ops;
iio_trigger_set_drvdata(data->trig, indio_dev); iio_trigger_set_drvdata(data->trig, indio_dev);

View File

@ -950,7 +950,6 @@ static int sx9500_probe(struct i2c_client *client,
if (!data->trig) if (!data->trig)
return -ENOMEM; return -ENOMEM;
data->trig->dev.parent = &client->dev;
data->trig->ops = &sx9500_trigger_ops; data->trig->ops = &sx9500_trigger_ops;
iio_trigger_set_drvdata(data->trig, indio_dev); iio_trigger_set_drvdata(data->trig, indio_dev);