Re: [PATCH 1/2] mfd: madera: Allow more time for hardware reset

From: Charles Keepax
Date: Wed Jan 08 2020 - 03:46:45 EST


On Tue, Jan 07, 2020 at 02:27:42PM +0000, Lee Jones wrote:
> On Mon, 06 Jan 2020, Charles Keepax wrote:
>
> > Both manual and power on resets have a brief period where the chip will
> > not be accessible immediately afterwards. Extend the time allowed for
> > this from a minimum of 1mS to 2mS based on newer evaluation of the
> > hardware and ensure this reset happens in all reset conditions. Whilst
> > making the change also remove the redundant NULL checks in the reset
> > functions as the GPIO functions already check for this.
> >
> > Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
> > ---
> > drivers/mfd/madera-core.c | 18 ++++++++++--------
> > 1 file changed, 10 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
> > index a8cfadc1fc01e..f41ce408259fb 100644
> > --- a/drivers/mfd/madera-core.c
> > +++ b/drivers/mfd/madera-core.c
> > @@ -238,6 +238,11 @@ static int madera_wait_for_boot(struct madera *madera)
> > return ret;
> > }
> >
> > +static inline void madera_reset_delay(void)
> > +{
> > + usleep_range(2000, 3000);
> > +}
>
> Hmm ... We usually shy away from abstraction for the sake of
> abstraction. What's preventing you from using the preferred method of
> simply calling the abstracted function from each of the call-sites?
>
> I could understand (a little) if you needed to frequently change these
> values, since changing them in once place is obviously simpler than
> changing them in 3, but even then it's marginal.
>

I don't mind manually inline it, we don't plan on changing the
values very often certainly. It really was just to avoid future
bugs if someone adds a new place that needs the delay or does
indeed change the delay. Would you mind if I used a define for
the time instead, if I am manually inlining? That keeps the same
single place to update, but without the extra function.

Thanks,
Charles