Skip to contentSkip to conversation

Fix style problems in ad7150 driver

PATCH Applied Slawomir Stepien 2 participants 5 messages Oct 5, 2018 – Oct 8, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix style problems in ad7150 driver

This series will fix simple style problems inside the ad7150 driver.

---
Changes since v1:
- Use channel value copy rather than pointer - for better readability
- Change "problem" -> "problems" in cover letter description
---
Slawomir Stepien (2):
staging: iio: cdc: ad7150: use value copy to shorten the line length
staging: iio: cdc: ad7150: fix misaligned lines

 drivers/staging/iio/cdc/ad7150.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.19.0
#1 lore raw

PATCH v2 1/2 staging: iio: cdc: ad7150: use value copy to shorten the line length

By using the copy of channel attribute, we can now make the lines short enough to eliminate the checkpatch.pl problem:

CHECK: Alignment should match open parenthesis

---
 drivers/staging/iio/cdc/ad7150.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/iio/cdc/ad7150.c +3 -2
index d16084d7068c..e2c70063fa0f 100644
@@ -102,18 +102,19 @@ static int ad7150_read_raw(struct iio_dev *indio_dev,
 {
 	int ret;
 	struct ad7150_chip_info *chip = iio_priv(indio_dev);
+	int channel = chan->channel;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
 		ret = i2c_smbus_read_word_data(chip->client,
-					ad7150_addresses[chan->channel][0]);
+					       ad7150_addresses[channel][0]);
 		if (ret < 0)
 			return ret;
 		*val = swab16(ret);
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_AVERAGE_RAW:
 		ret = i2c_smbus_read_word_data(chip->client,
-					ad7150_addresses[chan->channel][1]);
+					       ad7150_addresses[channel][1]);
 		if (ret < 0)
 			return ret;
 		*val = swab16(ret);
Signature · 1 line
2.19.0
maintainer
#2 lore raw

Re: [PATCH v2 1/2] staging: iio: cdc: ad7150: use value copy to shorten the line length

Quoted 6 lines · On Fri, 5 Oct 2018 10:04:44 +0200 Slawomir Stepien <[email protected]> wrote:

By using the copy of channel attribute, we can now make the lines short enough to eliminate the checkpatch.pl problem:

CHECK: Alignment should match open parenthesis

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 30 lines
---
 drivers/staging/iio/cdc/ad7150.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/iio/cdc/ad7150.c +3 -2
index d16084d7068c..e2c70063fa0f 100644
@@ -102,18 +102,19 @@ static int ad7150_read_raw(struct iio_dev *indio_dev,
 {
 	int ret;
 	struct ad7150_chip_info *chip = iio_priv(indio_dev);
+	int channel = chan->channel;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
 		ret = i2c_smbus_read_word_data(chip->client,
-					ad7150_addresses[chan->channel][0]);
+					       ad7150_addresses[channel][0]);
 		if (ret < 0)
 			return ret;
 		*val = swab16(ret);
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_AVERAGE_RAW:
 		ret = i2c_smbus_read_word_data(chip->client,
-					ad7150_addresses[chan->channel][1]);
+					       ad7150_addresses[channel][1]);
 		if (ret < 0)
 			return ret;
 		*val = swab16(ret);
#3 lore raw

PATCH v2 2/2 staging: iio: cdc: ad7150: fix misaligned lines

In reply to Slawomir Stepien

These lines were misaligned, but the checkpatch.pl didn't indicate them as such.

---
 drivers/staging/iio/cdc/ad7150.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/cdc/ad7150.c +2 -2
index e2c70063fa0f..24f74ce60f80 100644
@@ -183,8 +183,8 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
 	case IIO_EV_TYPE_THRESH:
 		value = chip->threshold[rising][chan];
 		return i2c_smbus_write_word_data(chip->client,
-						ad7150_addresses[chan][3],
-						swab16(value));
+						 ad7150_addresses[chan][3],
+						 swab16(value));
 	case IIO_EV_TYPE_MAG_ADAPTIVE:
 		sens = chip->mag_sensitivity[rising][chan];
 		timeout = chip->mag_timeout[rising][chan];
Signature · 1 line
2.19.0
maintainer Applied
#4 lore raw

Re: [PATCH v2 2/2] staging: iio: cdc: ad7150: fix misaligned lines

Quoted 4 lines · On Fri, 5 Oct 2018 10:05:15 +0200 Slawomir Stepien <[email protected]> wrote:

These lines were misaligned, but the checkpatch.pl didn't indicate them as such.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 19 lines
---
 drivers/staging/iio/cdc/ad7150.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/cdc/ad7150.c +2 -2
index e2c70063fa0f..24f74ce60f80 100644
@@ -183,8 +183,8 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
 	case IIO_EV_TYPE_THRESH:
 		value = chip->threshold[rising][chan];
 		return i2c_smbus_write_word_data(chip->client,
-						ad7150_addresses[chan][3],
-						swab16(value));
+						 ad7150_addresses[chan][3],
+						 swab16(value));
 	case IIO_EV_TYPE_MAG_ADAPTIVE:
 		sens = chip->mag_sensitivity[rising][chan];
 		timeout = chip->mag_timeout[rising][chan];