All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff LaBundy <jeff@labundy.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bastien Nocera <hadess@hadess.net>,
	Hans de Goede <hdegoede@redhat.com>,
	Henrik Rydberg <rydberg@bitmath.org>,
	linux-input@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] input: touchscreen: add core support for Goodix Berlin Touchscreen IC
Date: Tue, 20 Jun 2023 14:35:49 -0500	[thread overview]
Message-ID: <ZJH/lTA0TWmdEfJN@nixie71> (raw)
In-Reply-To: <a4f36bef-7c2c-08f4-bf93-fe1f0f1d315e@linaro.org>

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

  reply	other threads:[~2023-06-20 19:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 10:26 [PATCH v2 0/4] input: touchscreen: add initial support for Goodix Berlin touchscreen IC Neil Armstrong
2023-06-15 10:27 ` [PATCH v2 1/4] dt-bindings: input: document Goodix Berlin Touchscreen IC Neil Armstrong
2023-06-20 16:34   ` Rob Herring
2023-06-15 10:27 ` [PATCH v2 2/4] input: touchscreen: add core support for " Neil Armstrong
2023-06-16  3:14   ` Jeff LaBundy
2023-06-20 18:38     ` Neil Armstrong
2023-06-20 19:35       ` Jeff LaBundy [this message]
2023-06-15 10:27 ` [PATCH v2 3/4] input: touchscreen: add I2C " Neil Armstrong
2023-06-15 10:27 ` [PATCH v2 4/4] input: touchscreen: add SPI " Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZJH/lTA0TWmdEfJN@nixie71 \
    --to=jeff@labundy.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=rydberg@bitmath.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.