Re: [PATCH 1/9] input: goodix: fix alignment issues

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

 




On Fri, Jun 05, 2015 at 10:17:58AM -0700, Joe Perches wrote:
> On Fri, 2015-06-05 at 09:49 -0700, Dmitry Torokhov wrote:
> > Hi Irina,
> > 
> > On Thu, May 28, 2015 at 03:47:37PM +0300, Irina Tirdea wrote:
> > > Fix alignment to match open parenthesis detected by
> > > running checkpatch.pl --strict.
> > 
> > Mixed bag of changes here, but that's checkpatch for you.
> 
> Yup,
> 
> checkpatch output is definitely a mix of automated
> semi-competence and brain-deadness.
> 
> > > diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
> []
> > > @@ -112,7 +112,7 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
> > >  		data += 1 + GOODIX_CONTACT_SIZE;
> > >  		error = goodix_i2c_read(ts->client,
> > >  					GOODIX_READ_COOR_ADDR +
> > > -						1 + GOODIX_CONTACT_SIZE,
> > > +					1 + GOODIX_CONTACT_SIZE,
> > 
> > Bad - makes 1 + GOODIX_CONTACT_SIZE look like extra argument, not
> > continuation of expression.
> 
> <shrug>  There's no great way to do this.
> 
> Parentheses around the longer expression work.
> 
> 		error = goodix_i2c_read(ts->client,
> 					(GOODIX_READ_COOR_ADDR +
> 					 1 + GOODIX_CONTACT_SIZE),
> 
> Exceeding 80 columns may be better.
> Leaving it alone would be OK too.
> 
> Maybe starting with 1 to be more similar
> to the below would be better.
> 
> > > @@ -157,7 +157,8 @@ static void goodix_process_events(struct goodix_ts_data *ts)
> > >  
> > >  	for (i = 0; i < touch_num; i++)
> > >  		goodix_ts_report_touch(ts,
> > > -				&point_data[1 + GOODIX_CONTACT_SIZE * i]);
> > > +				       &point_data[1 +
> > > +				       GOODIX_CONTACT_SIZE * i]);
> > 
> > No, this is plain ugly.
> 
> Sometimes it's better to exceed 80 columns or
> maybe use temporaries.  Something like:

Or not aligning the arguments (when it makes sense).

Thankfully we are not using FORTRAN, COBOL or even Python here.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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