On Thu, 2019-02-21 at 16:25 +0100, Thierry Reding wrote: > From: Thierry Reding <treding@xxxxxxxxxx> > > Add implementations that apply acquire and release operations to all > reset controls part of a reset control array. > > Signed-off-by: Thierry Reding <treding@xxxxxxxxxx> Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> > --- > drivers/reset/core.c | 36 +++++++++++++++++++++++++++++++++++- > include/linux/reset.h | 6 ++++++ > 2 files changed, 41 insertions(+), 1 deletion(-) > > diff --git a/drivers/reset/core.c b/drivers/reset/core.c > index f94da91c22af..81ea77cba123 100644 > --- a/drivers/reset/core.c > +++ b/drivers/reset/core.c > @@ -245,6 +245,34 @@ static int reset_control_array_deassert(struct reset_control_array *resets) > return ret; > } > > +static int reset_control_array_acquire(struct reset_control_array *resets) > +{ > + unsigned int i; > + int err; > + > + for (i = 0; i < resets->num_rstcs; i++) { > + err = reset_control_acquire(resets->rstc[i]); > + if (err < 0) > + goto release; > + } This could be done under a single mutex lock by extracting a free version of of reset_control_acquire. Just an idea though, not sure if that would have any measurable benefit. regards Philipp