From: Joe Simmons-Talbott <joetalbott@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Joe Simmons-Talbott <joetalbott@gmail.com>
Subject: [PATCH] iio: Avoid multiple line dereference for mask
Date: Thu, 18 Aug 2022 08:58:44 -0400 [thread overview]
Message-ID: <20220818125844.60762-1-joetalbott@gmail.com> (raw)
Add a mask variable to hold dereferences that span multiple lines.
Found with checkpatch.pl.
Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com>
---
drivers/iio/industrialio-core.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 67d3d01d2dac..549f2254c258 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1291,6 +1291,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
int ret, attrcount = 0;
const struct iio_chan_spec_ext_info *ext_info;
+ long *mask;
if (chan->channel < 0)
return 0;
@@ -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);
if (ret < 0)
return ret;
attrcount += ret;
@@ -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);
if (ret < 0)
return ret;
attrcount += ret;
@@ -1331,9 +1330,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
return ret;
attrcount += ret;
+ mask = &chan->info_mask_shared_by_dir_available;
ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
- IIO_SHARED_BY_DIR,
- &chan->info_mask_shared_by_dir_available);
+ IIO_SHARED_BY_DIR, mask);
if (ret < 0)
return ret;
attrcount += ret;
@@ -1345,9 +1344,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
return ret;
attrcount += ret;
+ mask = &chan->info_mask_shared_by_all_available;
ret = iio_device_add_info_mask_type_avail(indio_dev, chan,
- IIO_SHARED_BY_ALL,
- &chan->info_mask_shared_by_all_available);
+ IIO_SHARED_BY_ALL, mask);
if (ret < 0)
return ret;
attrcount += ret;
--
2.37.2
next reply other threads:[~2022-08-18 12:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 12:58 Joe Simmons-Talbott [this message]
2022-08-19 0:08 ` Joe Perches
2022-08-19 17:16 ` Jonathan Cameron
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=20220818125844.60762-1-joetalbott@gmail.com \
--to=joetalbott@gmail.com \
--cc=jic23@kernel.org \
--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
all inboxes | Powered by JetHome®