All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Refactor event related code
@ 2017-11-05 18:00 Harinath Nampally
  2017-11-05 18:00 ` [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility Harinath Nampally
  2017-11-05 18:00 ` [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability Harinath Nampally
  0 siblings, 2 replies; 8+ messages in thread
From: Harinath Nampally @ 2017-11-05 18:00 UTC (permalink / raw)
  To: jic23
  Cc: knaack.h, lars, pmeerw, gregkh, linux-iio, linux-kernel,
	amsfield22, martink

Rename some struct names improve code readability.

Harinath Nampally (2):
  iio: accel: mma8452: Rename a struct for code readibility
  iio: accel: mma8452: Rename config structs for readability

 drivers/iio/accel/mma8452.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
 v4:
 - Dropped a patch from v3 which was already merged
 - Subject line and commit message have better descriptions
2.7.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility
  2017-11-05 18:00 [PATCH v4 0/2] Refactor event related code Harinath Nampally
@ 2017-11-05 18:00 ` Harinath Nampally
  2017-11-05 20:36   ` Martin Kepplinger
  2017-11-05 18:00 ` [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability Harinath Nampally
  1 sibling, 1 reply; 8+ messages in thread
From: Harinath Nampally @ 2017-11-05 18:00 UTC (permalink / raw)
  To: jic23
  Cc: knaack.h, lars, pmeerw, gregkh, linux-iio, linux-kernel,
	amsfield22, martink

Rename time step look up struct to generic name
as the values in the look table are same for all
the other events like pulse, transient etc.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
---
 v4:
 Shorter subject line and better description in commit message

 drivers/iio/accel/mma8452.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index bfd4bc8..16adf47 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -284,7 +284,7 @@ static const int mma8452_samp_freq[8][2] = {
 };
 
 /* Datasheet table: step time "Relationship with the ODR" (sample frequency) */
-static const unsigned int mma8452_transient_time_step_us[4][8] = {
+static const unsigned int mma8452_time_step_us[4][8] = {
 	{ 1250, 2500, 5000, 10000, 20000, 20000, 20000, 20000 },  /* normal */
 	{ 1250, 2500, 5000, 10000, 20000, 80000, 80000, 80000 },  /* l p l n */
 	{ 1250, 2500, 2500, 2500, 2500, 2500, 2500, 2500 },	  /* high res*/
@@ -826,7 +826,7 @@ static int mma8452_read_event_value(struct iio_dev *indio_dev,
 		if (power_mode < 0)
 			return power_mode;
 
-		us = ret * mma8452_transient_time_step_us[power_mode][
+		us = ret * mma8452_time_step_us[power_mode][
 				mma8452_get_odr_index(data)];
 		*val = us / USEC_PER_SEC;
 		*val2 = us % USEC_PER_SEC;
@@ -883,7 +883,7 @@ static int mma8452_write_event_value(struct iio_dev *indio_dev,
 			return ret;
 
 		steps = (val * USEC_PER_SEC + val2) /
-				mma8452_transient_time_step_us[ret][
+				mma8452_time_step_us[ret][
 					mma8452_get_odr_index(data)];
 
 		if (steps < 0 || steps > 0xff)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability
  2017-11-05 18:00 [PATCH v4 0/2] Refactor event related code Harinath Nampally
  2017-11-05 18:00 ` [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility Harinath Nampally
@ 2017-11-05 18:00 ` Harinath Nampally
  2017-11-05 20:36   ` Martin Kepplinger
  1 sibling, 1 reply; 8+ messages in thread
From: Harinath Nampally @ 2017-11-05 18:00 UTC (permalink / raw)
  To: jic23
  Cc: knaack.h, lars, pmeerw, gregkh, linux-iio, linux-kernel,
	amsfield22, martink

Rename structs holding event configuration registers
to more appropriate names. This naming is consistent
with the event config register names given in the
mma845x and fxls8471 datasheets.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
---
 v4:
 Shorter subject line and better description in commit message

 drivers/iio/accel/mma8452.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 16adf47..43c3a6b 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -135,7 +135,7 @@ struct mma8452_event_regs {
 		u8 ev_count;
 };
 
-static const struct mma8452_event_regs ev_regs_accel_falling = {
+static const struct mma8452_event_regs ff_mt_ev_regs = {
 		.ev_cfg = MMA8452_FF_MT_CFG,
 		.ev_cfg_ele = MMA8452_FF_MT_CFG_ELE,
 		.ev_cfg_chan_shift = MMA8452_FF_MT_CHAN_SHIFT,
@@ -145,7 +145,7 @@ static const struct mma8452_event_regs ev_regs_accel_falling = {
 		.ev_count = MMA8452_FF_MT_COUNT
 };
 
-static const struct mma8452_event_regs ev_regs_accel_rising = {
+static const struct mma8452_event_regs trans_ev_regs = {
 		.ev_cfg = MMA8452_TRANSIENT_CFG,
 		.ev_cfg_ele = MMA8452_TRANSIENT_CFG_ELE,
 		.ev_cfg_chan_shift = MMA8452_TRANSIENT_CHAN_SHIFT,
@@ -777,12 +777,12 @@ static int mma8452_get_event_regs(struct mma8452_data *data,
 					& MMA8452_INT_TRANS) &&
 				(data->chip_info->enabled_events
 					& MMA8452_INT_TRANS))
-				*ev_reg = &ev_regs_accel_rising;
+				*ev_reg = &trans_ev_regs;
 			else
-				*ev_reg = &ev_regs_accel_falling;
+				*ev_reg = &ff_mt_ev_regs;
 			return 0;
 		case IIO_EV_DIR_FALLING:
-			*ev_reg = &ev_regs_accel_falling;
+			*ev_reg = &ff_mt_ev_regs;
 			return 0;
 		default:
 			return -EINVAL;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability
  2017-11-05 18:00 ` [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability Harinath Nampally
@ 2017-11-05 20:36   ` Martin Kepplinger
  2017-11-06  1:04     ` harinath Nampally
  2017-11-19 14:59     ` Jonathan Cameron
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Kepplinger @ 2017-11-05 20:36 UTC (permalink / raw)
  To: Harinath Nampally, jic23
  Cc: knaack.h, lars, pmeerw, gregkh, linux-iio, linux-kernel, amsfield22

On 2017-11-05 19:00, Harinath Nampally wrote:
> Rename structs holding event configuration registers
> to more appropriate names. This naming is consistent
> with the event config register names given in the
> mma845x and fxls8471 datasheets.
> 
> Signed-off-by: Harinath Nampally <harinath922@gmail.com>

Makes sense to me.

Acked-by: Martin Kepplinger <martink@posteo.de>


Hey Harinath,

I think it'd be great to have the "power_mode" iio ABI interface
for mma8452 too, and I just found an old patch pf mine for this.

If you say you could test it and check for correct API usage and
ABI provisioning in sysfs, I'd be happy to publish it for you to
make any necessary corrections and submit it after testing.

Do we have a deal?

thanks

                             martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility
  2017-11-05 18:00 ` [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility Harinath Nampally
@ 2017-11-05 20:36   ` Martin Kepplinger
  2017-11-19 14:57     ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Kepplinger @ 2017-11-05 20:36 UTC (permalink / raw)
  To: Harinath Nampally, jic23
  Cc: knaack.h, lars, pmeerw, gregkh, linux-iio, linux-kernel, amsfield22

On 2017-11-05 19:00, Harinath Nampally wrote:
> Rename time step look up struct to generic name
> as the values in the look table are same for all
> the other events like pulse, transient etc.
> 
> Signed-off-by: Harinath Nampally <harinath922@gmail.com>

Acked-by: Martin Kepplinger <martink@posteo.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability
  2017-11-05 20:36   ` Martin Kepplinger
@ 2017-11-06  1:04     ` harinath Nampally
  2017-11-19 14:59     ` Jonathan Cameron
  1 sibling, 0 replies; 8+ messages in thread
From: harinath Nampally @ 2017-11-06  1:04 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: Jonathan Cameron, knaack.h, lars, Peter Meerwald-Stadler,
	Greg KH, linux-iio, linux-kernel, Alison Schofield

Hi Martin,

> I think it'd be great to have the "power_mode" iio ABI interface
> for mma8452 too, and I just found an old patch pf mine for this.
>
> If you say you could test it and check for correct API usage and
> ABI provisioning in sysfs, I'd be happy to publish it for you to
> make any necessary corrections and submit it after testing.
>
> Do we have a deal?
Sure, sounds great!

Thanks,
Harinath

On Sun, Nov 5, 2017 at 3:36 PM, Martin Kepplinger <martink@posteo.de> wrote:
> On 2017-11-05 19:00, Harinath Nampally wrote:
>> Rename structs holding event configuration registers
>> to more appropriate names. This naming is consistent
>> with the event config register names given in the
>> mma845x and fxls8471 datasheets.
>>
>> Signed-off-by: Harinath Nampally <harinath922@gmail.com>
>
> Makes sense to me.
>
> Acked-by: Martin Kepplinger <martink@posteo.de>
>
>
> Hey Harinath,
>
> I think it'd be great to have the "power_mode" iio ABI interface
> for mma8452 too, and I just found an old patch pf mine for this.
>
> If you say you could test it and check for correct API usage and
> ABI provisioning in sysfs, I'd be happy to publish it for you to
> make any necessary corrections and submit it after testing.
>
> Do we have a deal?
>
> thanks
>
>                              martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility
  2017-11-05 20:36   ` Martin Kepplinger
@ 2017-11-19 14:57     ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2017-11-19 14:57 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: Harinath Nampally, knaack.h, lars, pmeerw, gregkh, linux-iio,
	linux-kernel, amsfield22

On Sun, 5 Nov 2017 21:36:25 +0100
Martin Kepplinger <martink@posteo.de> wrote:

> On 2017-11-05 19:00, Harinath Nampally wrote:
> > Rename time step look up struct to generic name
> > as the values in the look table are same for all
> > the other events like pulse, transient etc.
> > 
> > Signed-off-by: Harinath Nampally <harinath922@gmail.com>  
> 
> Acked-by: Martin Kepplinger <martink@posteo.de>
> 

Applied.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability
  2017-11-05 20:36   ` Martin Kepplinger
  2017-11-06  1:04     ` harinath Nampally
@ 2017-11-19 14:59     ` Jonathan Cameron
  1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2017-11-19 14:59 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: Harinath Nampally, knaack.h, lars, pmeerw, gregkh, linux-iio,
	linux-kernel, amsfield22

On Sun, 5 Nov 2017 21:36:01 +0100
Martin Kepplinger <martink@posteo.de> wrote:

> On 2017-11-05 19:00, Harinath Nampally wrote:
> > Rename structs holding event configuration registers
> > to more appropriate names. This naming is consistent
> > with the event config register names given in the
> > mma845x and fxls8471 datasheets.
> > 
> > Signed-off-by: Harinath Nampally <harinath922@gmail.com>  
> 
> Makes sense to me.
> 
> Acked-by: Martin Kepplinger <martink@posteo.de>
> 

Applied.  Thanks,

Jonathan
> 
> Hey Harinath,
> 
> I think it'd be great to have the "power_mode" iio ABI interface
> for mma8452 too, and I just found an old patch pf mine for this.
> 
> If you say you could test it and check for correct API usage and
> ABI provisioning in sysfs, I'd be happy to publish it for you to
> make any necessary corrections and submit it after testing.
> 
> Do we have a deal?
> 
> thanks
> 
>                              martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-11-19 14:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-05 18:00 [PATCH v4 0/2] Refactor event related code Harinath Nampally
2017-11-05 18:00 ` [PATCH v4 1/2] iio: accel: mma8452: Rename a struct for code readibility Harinath Nampally
2017-11-05 20:36   ` Martin Kepplinger
2017-11-19 14:57     ` Jonathan Cameron
2017-11-05 18:00 ` [PATCH v4 2/2] iio: accel: mma8452: Rename config structs for readability Harinath Nampally
2017-11-05 20:36   ` Martin Kepplinger
2017-11-06  1:04     ` harinath Nampally
2017-11-19 14:59     ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.