Skip to contentSkip to conversation

kmx61: Small cleanups

PATCH In review Daniel Baluta 2 participants 6 messages Nov 17, 2014 – Nov 22, 2014 IIO

lore
Share & tools
lore
#0 lore raw

cover kmx61: Small cleanups

This is a small cleanup patchset, that:
* makes it clear that kmx61 uses only the micro part of scale
* use macro instead of hardcoded value for driver name

Jonathan, if you think it's worth it, these could be squased together with the initial patch submitted in testing:
61ef04a496 (iio: imu: Add support for Kionix KMX61 sensor)

Daniel Baluta (2):
kmx61: Use uscale instead of scale
kmx61: Use KMX61_DRV_NAME instead of hardcoded value

 drivers/iio/imu/kmx61.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 kmx61: Use uscale instead of scale

This makes it easier to notice that we only use
the micro part for scale.

---
 drivers/iio/imu/kmx61.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/imu/kmx61.c +4 -4
index 2bd77dd..e49b1cc 100644
@@ -90,7 +90,7 @@ enum kmx61_scan {
 };
 
 static const struct {
-	u16 scale;
+	u16 uscale;
 	u8 gsel0;
 	u8 gsel1;
 } kmx61_scale_table[] = {
@@ -337,13 +337,13 @@ static int kmx61_set_range(struct kmx61_data *data, int range)
 	return 0;
 }
 
-static int kmx61_set_scale(struct kmx61_data *data, int val)
+static int kmx61_set_scale(struct kmx61_data *data, int uscale)
 {
 	int ret, i;
 	u8  mode;
 
 	for (i = 0; i < ARRAY_SIZE(kmx61_scale_table); i++) {
-		if (kmx61_scale_table[i].scale == val) {
+		if (kmx61_scale_table[i].uscale == uscale) {
 			ret = kmx61_get_mode(data, &mode,
 					     KMX61_ACC | KMX61_MAG);
 			if (ret < 0)
@@ -441,7 +441,7 @@ static int kmx61_read_raw(struct iio_dev *indio_dev,
 		switch (chan->type) {
 		case IIO_ACCEL:
 			*val = 0;
-			*val2 = kmx61_scale_table[data->range].scale;
+			*val2 = kmx61_scale_table[data->range].uscale;
 			return IIO_VAL_INT_PLUS_MICRO;
 		case IIO_MAGN:
 			/* 14 bits res, 1465 microGauss per magn count */
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 kmx61: Use KMX61_DRV_NAME instead of hardcoded value

In reply to Daniel Baluta
---
 drivers/iio/imu/kmx61.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/kmx61.c +1 -1
index e49b1cc..8c4b365 100644
@@ -578,7 +578,7 @@ MODULE_DEVICE_TABLE(i2c, kmx61_id);
 
 static struct i2c_driver kmx61_driver = {
 	.driver = {
-		.name = "kmx61",
+		.name = KMX61_DRV_NAME,
 	},
 	.probe		= kmx61_probe,
 	.remove		= kmx61_remove,
Signature · 1 line
1.9.1
maintainer
#3 lore raw
In reply to Daniel Baluta
Quoted 9 lines · Daniel Baluta

This is a small cleanup patchset, that:
* makes it clear that kmx61 uses only the micro part of scale
* use macro instead of hardcoded value for driver name

Jonathan, if you think it's worth it, these could be squased together with
the initial patch submitted in testing:
61ef04a496 (iio: imu: Add support for Kionix KMX61 sensor)

Given the additional bits from Peter, I don't mind pulling the original and applying an updated patch.

Additional changes like this are fine as well if you prefer.

J

Quoted 6 lines

Daniel Baluta (2):
kmx61: Use uscale instead of scale
kmx61: Use KMX61_DRV_NAME instead of hardcoded value

drivers/iio/imu/kmx61.c | 10 +++++-----

1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
#4 lore raw
Quoted 7 lines · Jonathan Cameron
Quoted 4 lines · Daniel Baluta

This is a small cleanup patchset, that:
* makes it clear that kmx61 uses only the micro part of scale
* use macro instead of hardcoded value for driver name

Quoted 7 lines
Quoted 5 lines

Jonathan, if you think it's worth it, these could be squased together with
the initial patch submitted in testing:
61ef04a496 (iio: imu: Add support for Kionix KMX61 sensor)

Given the additional bits from Peter, I don't mind pulling the original and applying an updated patch.

I prefer this :). I will send an updated patch with fixes reported by Peter.

Quoted 2 lines

Additional changes like this are fine as well if you prefer.

I am almost done with adding support for runtime PM. Let me know if you want this as a separate patch or just one big updated patch.

Daniel.

maintainer
#5 lore raw
Quoted 16 lines · Daniel Baluta
Quoted 7 lines · Jonathan Cameron
Quoted 4 lines · Daniel Baluta

This is a small cleanup patchset, that:
* makes it clear that kmx61 uses only the micro part of scale
* use macro instead of hardcoded value for driver name

Quoted 7 lines
Quoted 5 lines

Jonathan, if you think it's worth it, these could be squased together with
the initial patch submitted in testing:
61ef04a496 (iio: imu: Add support for Kionix KMX61 sensor)

Given the additional bits from Peter, I don't mind pulling the original and applying an updated patch.

Quoted 7 lines

I prefer this :). I will send an updated patch with fixes reported by Peter.

Quoted 2 lines

Additional changes like this are fine as well if you prefer.

I am almost done with adding support for runtime PM. Let me know if you want this as a separate patch or just one big updated patch.

Oops. I moaned about the unified patch, but didn't actually get around to replying to you. Was fine either way really.

Note to anyone reading this patch series - the unified patch for adding the driver with all these changes in place has now been applied.

Jonathan

Quoted 3 lines

Daniel.