2014-11-17 13:17:42

by Daniel Baluta

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
1.9.1


2014-11-17 13:17:15

by Daniel Baluta

[permalink] [raw]
Subject: [PATCH 2/2] kmx61: Use KMX61_DRV_NAME instead of hardcoded value

Signed-off-by: Daniel Baluta <[email protected]>
---
drivers/iio/imu/kmx61.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index e49b1cc..8c4b365 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -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,
--
1.9.1

2014-11-17 13:17:26

by Daniel Baluta

[permalink] [raw]
Subject: [PATCH 1/2] kmx61: Use uscale instead of scale

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

Signed-off-by: Daniel Baluta <[email protected]>
---
drivers/iio/imu/kmx61.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index 2bd77dd..e49b1cc 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -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 */
--
1.9.1

2014-11-17 14:59:25

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/2] kmx61: Small cleanups



On November 17, 2014 1:18:34 PM GMT+00:00, Daniel Baluta <[email protected]> wrote:
>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
>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(-)

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

2014-11-17 15:09:23

by Daniel Baluta

[permalink] [raw]
Subject: Re: [PATCH 0/2] kmx61: Small cleanups

On Mon, Nov 17, 2014 at 4:59 PM, Jonathan Cameron <[email protected]> wrote:
>
>
> On November 17, 2014 1:18:34 PM GMT+00:00, Daniel Baluta <[email protected]> wrote:
>>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.

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

>
> 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.

2014-11-22 11:49:33

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/2] kmx61: Small cleanups

On 17/11/14 15:09, Daniel Baluta wrote:
> On Mon, Nov 17, 2014 at 4:59 PM, Jonathan Cameron <[email protected]> wrote:
>>
>>
>> On November 17, 2014 1:18:34 PM GMT+00:00, Daniel Baluta <[email protected]> wrote:
>>> 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.
>
> I prefer this :). I will send an updated patch with fixes reported by Peter.
>
>>
>> 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
>
> Daniel.
>