Message ID | 20210309193620.2176163-6-gwendal@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | iio: Set default trigger device parent | expand |
On Tue, Mar 9, 2021 at 11:37 AM Gwendal Grignou <gwendal@chromium.org> wrote: > > iio_trigger_set_drvdata() sets the trigger device parent to first > argument of viio_trigger_alloc(), no need to do it again in the driver > code. > > Given data->dev is dev, and we call devm_iio_trigger_alloc with > dev instead of data->dev, we do not have to set data->trig->dev.parent to > dev anymore. > > Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> > --- > Changes in v4: > Improve commit message. > > No changes in v3. > > drivers/iio/potentiostat/lmp91000.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c > index f34ca769dc20d..8a9c576616ee5 100644 > --- a/drivers/iio/potentiostat/lmp91000.c > +++ b/drivers/iio/potentiostat/lmp91000.c > @@ -322,7 +322,7 @@ static int lmp91000_probe(struct i2c_client *client, > return PTR_ERR(data->regmap); > } > > - data->trig = devm_iio_trigger_alloc(data->dev, "%s-mux%d", > + data->trig = devm_iio_trigger_alloc(dev, "%s-mux%d", > indio_dev->name, indio_dev->id); > if (!data->trig) { > dev_err(dev, "cannot allocate iio trigger.\n"); > @@ -330,7 +330,6 @@ static int lmp91000_probe(struct i2c_client *client, > } > > data->trig->ops = &lmp91000_trigger_ops; > - data->trig->dev.parent = dev; > init_completion(&data->completion); > > ret = lmp91000_read_config(data); > -- > 2.30.1.766.gb4fecdf3b7-goog >
diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c index f34ca769dc20d..8a9c576616ee5 100644 --- a/drivers/iio/potentiostat/lmp91000.c +++ b/drivers/iio/potentiostat/lmp91000.c @@ -322,7 +322,7 @@ static int lmp91000_probe(struct i2c_client *client, return PTR_ERR(data->regmap); } - data->trig = devm_iio_trigger_alloc(data->dev, "%s-mux%d", + data->trig = devm_iio_trigger_alloc(dev, "%s-mux%d", indio_dev->name, indio_dev->id); if (!data->trig) { dev_err(dev, "cannot allocate iio trigger.\n"); @@ -330,7 +330,6 @@ static int lmp91000_probe(struct i2c_client *client, } data->trig->ops = &lmp91000_trigger_ops; - data->trig->dev.parent = dev; init_completion(&data->completion); ret = lmp91000_read_config(data);
iio_trigger_set_drvdata() sets the trigger device parent to first argument of viio_trigger_alloc(), no need to do it again in the driver code. Given data->dev is dev, and we call devm_iio_trigger_alloc with dev instead of data->dev, we do not have to set data->trig->dev.parent to dev anymore. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> --- Changes in v4: Improve commit message. No changes in v3. drivers/iio/potentiostat/lmp91000.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)