Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1738915 > unrolled thread
| Started by | Harinath Nampally <harinath922@gmail.com> |
|---|---|
| First post | 2017-09-25 12:50 +0200 |
| Last post | 2017-09-25 12:50 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v3 0/3] Refactor event related code Harinath Nampally <harinath922@gmail.com> - 2017-09-25 12:50 +0200
[PATCH v3 2/3] iio: accel: mma8452: Rename time step look up struct to generic name as the values are same for all the events. Harinath Nampally <harinath922@gmail.com> - 2017-09-25 12:50 +0200
[PATCH v3 1/3] iio: accel: mma8452: Rename structs holding event configuration registers to more appropriate names. Harinath Nampally <harinath922@gmail.com> - 2017-09-25 12:50 +0200
| From | Harinath Nampally <harinath922@gmail.com> |
|---|---|
| Date | 2017-09-25 12:50 +0200 |
| Subject | [PATCH v3 0/3] Refactor event related code |
| Message-ID | <utz7z-5aK-3@gated-at.bofh.it> |
Rename some struct names and function names to
improve code readability.
Harinath Nampally (3):
iio: accel: mma8452: Rename structs holding event configuration
registers to more appropriate names.
iio: accel: mma8452: Rename time step look up struct to generic
name as the values are same for all the events.
iio: accel: mma8452: Rename read/write event value callbacks to
generic function name.
drivers/iio/accel/mma8452.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
--
changes v2->v3
-Remove one unrelated patch in the patchset
-Add version v3 in the subject
changes v1->v2
Add one more related patch in the patchset
2.7.4
[toc] | [next] | [standalone]
| From | Harinath Nampally <harinath922@gmail.com> |
|---|---|
| Date | 2017-09-25 12:50 +0200 |
| Subject | [PATCH v3 2/3] iio: accel: mma8452: Rename time step look up struct to generic name as the values are same for all the events. |
| Message-ID | <utz7A-5aK-15@gated-at.bofh.it> |
| In reply to | #1738915 |
Improves code readability, no impact on functionality.
Signed-off-by: Harinath Nampally <harinath922@gmail.com>
---
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 3472e7e..74b6221 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_thresh(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_thresh(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
[toc] | [prev] | [next] | [standalone]
| From | Harinath Nampally <harinath922@gmail.com> |
|---|---|
| Date | 2017-09-25 12:50 +0200 |
| Subject | [PATCH v3 1/3] iio: accel: mma8452: Rename structs holding event configuration registers to more appropriate names. |
| Message-ID | <utz7B-5aK-27@gated-at.bofh.it> |
| In reply to | #1738915 |
Improves code readability, no impact on functionality.
Signed-off-by: Harinath Nampally <harinath922@gmail.com>
---
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 6194169..3472e7e 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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web