[PATCH 0/4] input adxl34x: give a little love to the driver

STALE5006d

7 messages, 3 authors, 2012-12-24 · open the first message on its own page

[PATCH 0/4] input adxl34x: give a little love to the driver

From: Wolfram Sang <hidden>
Date: 2012-12-20 13:51:29

Hi,

I needed this driver in a project and there were some minor hurdles in getting
it to run smoothly. These four patches are fixing them.

Kind regards,

   Wolfram


Wolfram Sang (4):
  input: adxl34x: consistently use read/write encapsulation
  input: adxl34x: don't set THRESH_TAP twice
  input: adxl34x: make platform_data include self contained
  input: adxl34x: default platform_data should not use defines from
    driver

 drivers/input/misc/adxl34x.c  |    7 +++----
 include/linux/input/adxl34x.h |    2 ++
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
1.7.10.4

[PATCH 1/4] input: adxl34x: consistently use read/write encapsulation

From: Wolfram Sang <hidden>
Date: 2012-12-20 13:51:29

Don't open code the AC_READ and AC_WRITE macros.

Signed-off-by: Wolfram Sang <redacted>
---
 drivers/input/misc/adxl34x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index 1cf72fe..b18d3e2 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -732,7 +732,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 	mutex_init(&ac->mutex);
 
 	input_dev->name = "ADXL34x accelerometer";
-	revid = ac->bops->read(dev, DEVID);
+	revid = AC_READ(ac, DEVID);
 
 	switch (revid) {
 	case ID_ADXL345:
@@ -809,7 +809,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 	if (FIFO_MODE(pdata->fifo_mode) == FIFO_BYPASS)
 		ac->fifo_delay = false;
 
-	ac->bops->write(dev, POWER_CTL, 0);
+	AC_WRITE(ac, POWER_CTL, 0);
 
 	err = request_threaded_irq(ac->irq, NULL, adxl34x_irq,
 				   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-- 
1.7.10.4

[PATCH 4/4] input: adxl34x: default platform_data should not use defines from driver

From: Wolfram Sang <hidden>
Date: 2012-12-20 13:51:29

Only use the defines which are defined in the platform_data include
file.

Signed-off-by: Wolfram Sang <redacted>
---
 drivers/input/misc/adxl34x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index 6be8687..0735de3 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -232,7 +232,7 @@ static const struct adxl34x_platform_data adxl34x_default_init = {
 
 	.ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY {x,y,z} */
 	.power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
-	.fifo_mode = FIFO_STREAM,
+	.fifo_mode = ADXL_FIFO_STREAM,
 	.watermark = 0,
 };
 
-- 
1.7.10.4

[PATCH 3/4] input: adxl34x: make platform_data include self contained

From: Wolfram Sang <hidden>
Date: 2012-12-20 13:51:29

Since it suggests to use defines from input.h (ABS_X, ...), also include
the file to make them available.

Signed-off-by: Wolfram Sang <redacted>
---
 include/linux/input/adxl34x.h |    2 ++
 1 file changed, 2 insertions(+)
diff --git a/include/linux/input/adxl34x.h b/include/linux/input/adxl34x.h
index 57e01a7..010d981 100644
--- a/include/linux/input/adxl34x.h
+++ b/include/linux/input/adxl34x.h
@@ -13,6 +13,8 @@
 #ifndef __LINUX_INPUT_ADXL34X_H__
 #define __LINUX_INPUT_ADXL34X_H__
 
+#include <linux/input.h>
+
 struct adxl34x_platform_data {
 
 	/*
-- 
1.7.10.4

[PATCH 2/4] input: adxl34x: don't set THRESH_TAP twice

From: Wolfram Sang <hidden>
Date: 2012-12-20 13:51:29

The datasheet doesn't say anything about writing twice, so this was
probably overlooked.

Signed-off-by: Wolfram Sang <redacted>
---
 drivers/input/misc/adxl34x.c |    1 -
 1 file changed, 1 deletion(-)
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index b18d3e2..6be8687 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -827,7 +827,6 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 	if (err)
 		goto err_remove_attr;
 
-	AC_WRITE(ac, THRESH_TAP, pdata->tap_threshold);
 	AC_WRITE(ac, OFSX, pdata->x_axis_offset);
 	ac->hwcal.x = pdata->x_axis_offset;
 	AC_WRITE(ac, OFSY, pdata->y_axis_offset);
-- 
1.7.10.4

Re: [PATCH 0/4] input adxl34x: give a little love to the driver

From: Michael Hennerich <michael.hennerich@analog.com>
Date: 2012-12-20 14:01:18

On 12/20/2012 02:51 PM, Wolfram Sang wrote:
Hi,

I needed this driver in a project and there were some minor hurdles in getting
it to run smoothly. These four patches are fixing them.

Kind regards,

    Wolfram


Wolfram Sang (4):
   input: adxl34x: consistently use read/write encapsulation
   input: adxl34x: don't set THRESH_TAP twice
   input: adxl34x: make platform_data include self contained
   input: adxl34x: default platform_data should not use defines from
     driver

  drivers/input/misc/adxl34x.c  |    7 +++----
  include/linux/input/adxl34x.h |    2 ++
  2 files changed, 5 insertions(+), 4 deletions(-)
looks good to me -

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif

Re: [PATCH 0/4] input adxl34x: give a little love to the driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-12-24 17:53:11

On Thu, Dec 20, 2012 at 03:00:21PM +0100, Michael Hennerich wrote:
On 12/20/2012 02:51 PM, Wolfram Sang wrote:
quoted
Hi,

I needed this driver in a project and there were some minor hurdles in getting
it to run smoothly. These four patches are fixing them.

Kind regards,

   Wolfram


Wolfram Sang (4):
  input: adxl34x: consistently use read/write encapsulation
  input: adxl34x: don't set THRESH_TAP twice
  input: adxl34x: make platform_data include self contained
  input: adxl34x: default platform_data should not use defines from
    driver

 drivers/input/misc/adxl34x.c  |    7 +++----
 include/linux/input/adxl34x.h |    2 ++
 2 files changed, 5 insertions(+), 4 deletions(-)
looks good to me -

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Applied all 4, thanks everyone.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help