Re: [PATCH v2 5/5] iio: sx9310: Enable vdd and svdd regulators at probe

From: Stephen Boyd
Date: Fri Jul 24 2020 - 20:38:41 EST


Quoting Doug Anderson (2020-07-24 15:02:23)
> On Fri, Jul 24, 2020 at 2:33 PM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
> > diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> > index 1e1f6bba50f6..ad6ed100c7a6 100644
> > --- a/drivers/iio/proximity/sx9310.c
> > +++ b/drivers/iio/proximity/sx9310.c
> > @@ -919,6 +929,23 @@ static int sx9310_probe(struct i2c_client *client,
> > if (IS_ERR(data->regmap))
> > return PTR_ERR(data->regmap);
> >
> > + ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(supplies), supplies);
> > + if (ret)
> > + return ret;
> > +
> > + ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies);
> > + if (ret)
> > + return ret;
> > + /* Must wait for Tpor time after initial power up */
> > + usleep_range(1000, 1100);
> > +
> > + /* Update sx9310_regulator_disable() size if this bug is hit */
> > + BUILD_BUG_ON(ARRAY_SIZE(supplies) != 2);
> > + ret = devm_add_action_or_reset(&client->dev, sx9310_regulator_disable,
> > + supplies);
>
> ...but, but... Aren't you storing a pointer to stack memory? How
> does that work? I think you either need to store the "struct
> regulator_bulk_data" in your private data or just make two normal
> regulator calls.
>

Doh, no coffee today.