[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150605173140.GG26708@dtor-ws>
Date: Fri, 5 Jun 2015 10:31:40 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: Irina Tirdea <irina.tirdea@...el.com>,
Bastien Nocera <hadess@...ess.net>,
linux-input@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/9] input: goodix: fix alignment issues
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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists