[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZJH/lTA0TWmdEfJN@nixie71>
Date: Tue, 20 Jun 2023 14:35:49 -0500
From: Jeff LaBundy <jeff@...undy.com>
To: Neil Armstrong <neil.armstrong@...aro.org>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Bastien Nocera <hadess@...ess.net>,
Hans de Goede <hdegoede@...hat.com>,
Henrik Rydberg <rydberg@...math.org>,
linux-input@...r.kernel.org, linux-arm-msm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/4] input: touchscreen: add core support for Goodix
Berlin Touchscreen IC
Hi Neil,
On Tue, Jun 20, 2023 at 08:38:20PM +0200, Neil Armstrong wrote:
[...]
> > > +static int goodix_berlin_power_on(struct goodix_berlin_core *cd, bool on)
> > > +{
> > > + int error = 0;
> >
> > No need to initialize 'error' here.
>
> Th refactor I did needs it to be initialized at 0 because the if() always calls return,
> but yeah it's kind of ugly.
Ah, you're correct; I see now.
>
> >
> > > +
> > > + if (on) {
> > > + error = regulator_enable(cd->iovdd);
> > > + if (error < 0) {
> > > + dev_err(cd->dev, "Failed to enable iovdd: %d\n", error);
> > > + return error;
> > > + }
> > > +
> > > + /* Vendor waits 3ms for IOVDD to settle */
> > > + usleep_range(3000, 3100);
> > > +
> > > + error = regulator_enable(cd->avdd);
> > > + if (error < 0) {
> > > + dev_err(cd->dev, "Failed to enable avdd: %d\n", error);
> > > + goto power_off_iovdd;
> > > + }
> > > +
> > > + /* Vendor waits 15ms for IOVDD to settle */
> > > + usleep_range(15000, 15100);
> > > +
> > > + gpiod_set_value(cd->reset_gpio, 0);
> > > +
> > > + /* Vendor waits 4ms for Firmware to initialize */
> > > + usleep_range(4000, 4100);
> > > +
> > > + error = goodix_berlin_dev_confirm(cd);
> > > + if (error < 0)
> > > + goto power_off_gpio;
> >
> > All of this cleaned up nicely. The following comment is idiomatic, but I feel
> > the goto can be easily eliminated as follows:
> >
> > error = goodix_berlin_dev_confirm(cd);
> > if (error)
> > break;
>
> Break ? in an if ?
Ignore my comment; I lost my place and thought we were inside a loop :)
Kind regards,
Jeff LaBundy
Powered by blists - more mailing lists