From: Jonathan Cameron <jic23@kernel.org>
To: Joe Perches <joe@perches.com>
Cc: Joe Simmons-Talbott <joetalbott@gmail.com>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: Avoid multiple line dereference for mask
Date: Fri, 19 Aug 2022 18:16:00 +0100 [thread overview]
Message-ID: <20220819181600.638b82e9@jic23-huawei> (raw)
In-Reply-To: <72bbd0126162b7f78291d3431d2a8c6730cc4ce7.camel@perches.com>
On Thu, 18 Aug 2022 20:08:27 -0400
Joe Perches <joe@perches.com> wrote:
> On Thu, 2022-08-18 at 08:58 -0400, Joe Simmons-Talbott wrote:
> > Add a mask variable to hold dereferences that span multiple lines.
> > Found with checkpatch.pl.
> []
> > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> []
> > @@ -1301,10 +1302,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
> > return ret;
> > attrcount += ret;
> >
> > + mask = &chan->info_mask_separate_available;
> > ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
> > - IIO_SEPARATE,
> > - &chan->
> > - info_mask_separate_available);
> > + IIO_SEPARATE, mask);
>
> The issue is the conflict between using 30+ character identifiers and 80 column lines.
> Perhaps it's better just to use a longer line instead of a temporary.
>
> ret = iio_device_add_info_mask_type_avail(indio_dev, chan, IIO_SEPARATE,
> &chan->info_mask_separate_available);
Agreed. Looks nicer to me this way and still under the wider 100 char limit
which is appropriate when readability is improved.
Some unfortunately long identifiers, that I think got there via evolution.
We should consider shortening them that's a job for a separate patch.
> []
>
> > @@ -1316,10 +1316,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
> > return ret;
> > attrcount += ret;
> >
> > + mask = &chan->info_mask_shared_by_type_available;
> > ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
> > - IIO_SHARED_BY_TYPE,
> > - &chan->
> > - info_mask_shared_by_type_available);
> > + IIO_SHARED_BY_TYPE, mask);
>
> ret = iio_device_add_info_mask_type_avail(indio_dev, chan, IIO_SHARED_BY_TYPE,
> &chan->info_mask_shared_by_type_available);
>
> etc...
>
>
prev parent reply other threads:[~2022-08-19 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 12:58 [PATCH] iio: Avoid multiple line dereference for mask Joe Simmons-Talbott
2022-08-19 0:08 ` Joe Perches
2022-08-19 17:16 ` Jonathan Cameron [this message]
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=20220819181600.638b82e9@jic23-huawei \
--to=jic23@kernel.org \
--cc=joe@perches.com \
--cc=joetalbott@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox