Re: [PATCH v2 2/4] input: touchscreen: add core support for Goodix Berlin Touchscreen IC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux