Skip to contentSkip to conversation

Add/Remove spaces

PATCH New Arushi Singhal 1 participant 3 messages Apr 1, 2017

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

cover Add/Remove spaces

Add and remove spaces to follow kernel coding style.

Arushi Singhal (2):
iio: adc: replace comma with a semicolon
staging: iio: meter: Replace mlock with driver private buf_lock

 drivers/iio/adc/max11100.c          | 4 ++--
 drivers/staging/iio/meter/ade7759.c | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 iio: adc: replace comma with a semicolon

Replace a comma between expression statements by a semicolon. This changes the semantics of the code, but given the current indentation appears to be what is intended.
A simplified version of the Coccinelle semantic patch that performs this transformation is as follows:

// <smpl>
@r@
expression e1,e2;
@@

e1
-,
+;
e2;
// </smpl>

---
 drivers/iio/adc/max11100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/max11100.c +2 -2
index 23c060e1b663..1180bcc22ff1 100644
@@ -124,8 +124,8 @@ static int max11100_probe(struct spi_device *spi)
 	indio_dev->name = "max11100";
 	indio_dev->info = &max11100_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
-	indio_dev->channels = max11100_channels,
-	indio_dev->num_channels = ARRAY_SIZE(max11100_channels),
+	indio_dev->channels = max11100_channels;
+	indio_dev->num_channels = ARRAY_SIZE(max11100_channels);
 
 	state->vref_reg = devm_regulator_get(&spi->dev, "vref");
 	if (IS_ERR(state->vref_reg))
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/2 staging: iio: meter: Replace mlock with driver private buf_lock

In reply to Arushi Singhal

The driver needs to insure atomicity during frequency changes of bus and device. The iiodev->mlock as used was not doing that. Replace it with the drivers existing buffer lock and execute spi_write directly.

---
 drivers/staging/iio/meter/ade7759.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/iio/meter/ade7759.c +6 -3
index 0b65f1847510..a5ee4501d30a 100644
@@ -429,7 +429,7 @@ static ssize_t ade7759_write_frequency(struct device *dev,
 	if (!val)
 		return -EINVAL;
 
-	mutex_lock(&indio_dev->mlock);
+	mutex_lock(&st->buf_lock);
 
 	t = 27900 / val;
 	if (t > 0)
@@ -447,10 +447,13 @@ static ssize_t ade7759_write_frequency(struct device *dev,
 	reg &= ~(3 << 13);
 	reg |= t << 13;
 
-	ret = ade7759_spi_write_reg_16(dev, ADE7759_MODE, reg);
+	st->tx[0] = ADE7759_WRITE_REG(ADE7759_MODE);
+	st->tx[1] = reg;
+
+	ret = spi_write(st->us, st->tx, 2);
 
 out:
-	mutex_unlock(&indio_dev->mlock);
+	mutex_unlock(&st->buf_lock);
 
 	return ret ? ret : len;
 }
Signature · 1 line
2.11.0