linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] TI AM335x TSC/ADC cleanup
@ 2016-05-31 17:00 Andrew F. Davis
  2016-05-31 17:00 ` [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro Andrew F. Davis
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

Hello all,

This series is a group of non-functional changes I would
like to get in this cycle to prepare some regmap based
changes I would like to make next cycle. Hopefully the
churn can be seen as more useful in that case.

Thanks,
Andrew

Andrew F. Davis (8):
  mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro
  iio: adc: ti_am335x_adc: use SIMPLE_DEV_PM_OPS helper macro
  mfd: ti_am335x_tscadc: Remove use of single line functions
  mfd: ti_am335x_tscadc: Unify variable naming when refrencing
    ti_tscadc_dev
  mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap
  mfd: ti_am335x_tscadc: use variable name for sizeof() operator
  iio: adc: ti_am335x_adc: use variable names for sizeof() operator
  Input: ti_am335x_tsc - use variable name for sizeof() operator

 drivers/iio/adc/ti_am335x_adc.c           |  22 ++---
 drivers/input/touchscreen/ti_am335x_tsc.c |   2 +-
 drivers/mfd/ti_am335x_tscadc.c            | 135 +++++++++++++-----------------
 include/linux/mfd/ti_am335x_tscadc.h      |   2 +-
 4 files changed, 64 insertions(+), 97 deletions(-)

-- 
2.8.3

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

* [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-08 15:35   ` Lee Jones
  2016-05-31 17:00 ` [PATCH 2/8] iio: adc: ti_am335x_adc: use " Andrew F. Davis
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index e4e4b22..644128b 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -310,8 +310,7 @@ static int ti_tscadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int tscadc_suspend(struct device *dev)
+static int __maybe_unused tscadc_suspend(struct device *dev)
 {
 	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
 
@@ -321,7 +320,7 @@ static int tscadc_suspend(struct device *dev)
 	return 0;
 }
 
-static int tscadc_resume(struct device *dev)
+static int __maybe_unused tscadc_resume(struct device *dev)
 {
 	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
 	u32 ctrl;
@@ -347,14 +346,7 @@ static int tscadc_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops tscadc_pm_ops = {
-	.suspend = tscadc_suspend,
-	.resume = tscadc_resume,
-};
-#define TSCADC_PM_OPS (&tscadc_pm_ops)
-#else
-#define TSCADC_PM_OPS NULL
-#endif
+static SIMPLE_DEV_PM_OPS(tscadc_pm_ops, tscadc_suspend, tscadc_resume);
 
 static const struct of_device_id ti_tscadc_dt_ids[] = {
 	{ .compatible = "ti,am3359-tscadc", },
@@ -365,7 +357,7 @@ MODULE_DEVICE_TABLE(of, ti_tscadc_dt_ids);
 static struct platform_driver ti_tscadc_driver = {
 	.driver = {
 		.name   = "ti_am3359-tscadc",
-		.pm	= TSCADC_PM_OPS,
+		.pm	= &tscadc_pm_ops,
 		.of_match_table = ti_tscadc_dt_ids,
 	},
 	.probe	= ti_tscadc_probe,
-- 
2.8.3

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

* [PATCH 2/8] iio: adc: ti_am335x_adc: use SIMPLE_DEV_PM_OPS helper macro
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
  2016-05-31 17:00 ` [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-03 12:16   ` Jonathan Cameron
  2016-05-31 17:00 ` [PATCH 3/8] mfd: ti_am335x_tscadc: Remove use of single line functions Andrew F. Davis
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index c1e0553..18af71d 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -531,8 +531,7 @@ static int tiadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int tiadc_suspend(struct device *dev)
+static int __maybe_unused tiadc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
@@ -550,7 +549,7 @@ static int tiadc_suspend(struct device *dev)
 	return 0;
 }
 
-static int tiadc_resume(struct device *dev)
+static int __maybe_unused tiadc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
@@ -567,14 +566,7 @@ static int tiadc_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops tiadc_pm_ops = {
-	.suspend = tiadc_suspend,
-	.resume = tiadc_resume,
-};
-#define TIADC_PM_OPS (&tiadc_pm_ops)
-#else
-#define TIADC_PM_OPS NULL
-#endif
+static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
 
 static const struct of_device_id ti_adc_dt_ids[] = {
 	{ .compatible = "ti,am3359-adc", },
@@ -585,7 +577,7 @@ MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
 static struct platform_driver tiadc_driver = {
 	.driver = {
 		.name   = "TI-am335x-adc",
-		.pm	= TIADC_PM_OPS,
+		.pm	= &tiadc_pm_ops,
 		.of_match_table = ti_adc_dt_ids,
 	},
 	.probe	= tiadc_probe,
-- 
2.8.3

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

* [PATCH 3/8] mfd: ti_am335x_tscadc: Remove use of single line functions
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
  2016-05-31 17:00 ` [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro Andrew F. Davis
  2016-05-31 17:00 ` [PATCH 2/8] iio: adc: ti_am335x_adc: use " Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-08 15:35   ` Lee Jones
  2016-05-31 17:00 ` [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev Andrew F. Davis
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

tscadc_readl and tscadc_writel are single line functions and do not save
use anything, remove these.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 44 ++++++++++++++----------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 644128b..613f15d 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -27,20 +27,6 @@
 
 #include <linux/mfd/ti_am335x_tscadc.h>
 
-static unsigned int tscadc_readl(struct ti_tscadc_dev *tsadc, unsigned int reg)
-{
-	unsigned int val;
-
-	regmap_read(tsadc->regmap_tscadc, reg, &val);
-	return val;
-}
-
-static void tscadc_writel(struct ti_tscadc_dev *tsadc, unsigned int reg,
-					unsigned int val)
-{
-	regmap_write(tsadc->regmap_tscadc, reg, val);
-}
-
 static const struct regmap_config tscadc_regmap_config = {
 	.name = "ti_tscadc",
 	.reg_bits = 32,
@@ -57,7 +43,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
 	if (tsadc->adc_waiting)
 		wake_up(&tsadc->reg_se_wait);
 	else if (!tsadc->adc_in_use)
-		tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
+		regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
 
 	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
 }
@@ -68,7 +54,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
 	DEFINE_WAIT(wait);
 	u32 reg;
 
-	reg = tscadc_readl(tsadc, REG_ADCFSM);
+	regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
 	if (reg & SEQ_STATUS) {
 		tsadc->adc_waiting = true;
 		prepare_to_wait(&tsadc->reg_se_wait, &wait,
@@ -84,7 +70,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
 		 * Sequencer should either be idle or
 		 * busy applying the charge step.
 		 */
-		reg = tscadc_readl(tsadc, REG_ADCFSM);
+		regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
 		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
 		tsadc->adc_waiting = false;
 	}
@@ -96,7 +82,7 @@ void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
 	spin_lock_irq(&tsadc->reg_lock);
 	am335x_tscadc_need_adc(tsadc);
 
-	tscadc_writel(tsadc, REG_SE, val);
+	regmap_write(tsadc->regmap_tscadc, REG_SE, val);
 	spin_unlock_irq(&tsadc->reg_lock);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
@@ -107,7 +93,7 @@ void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tsadc)
 
 	spin_lock_irqsave(&tsadc->reg_lock, flags);
 	tsadc->adc_in_use = false;
-	tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
+	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
 	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
@@ -118,7 +104,7 @@ void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val)
 
 	spin_lock_irqsave(&tsadc->reg_lock, flags);
 	tsadc->reg_se_cache &= ~val;
-	tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
+	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
 	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
@@ -130,7 +116,7 @@ static void tscadc_idle_config(struct ti_tscadc_dev *config)
 	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
 			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
 
-	tscadc_writel(config, REG_IDLECONFIG, idleconfig);
+	regmap_write(config->regmap_tscadc, REG_IDLECONFIG, idleconfig);
 }
 
 static	int ti_tscadc_probe(struct platform_device *pdev)
@@ -236,11 +222,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 
 	/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
 	tscadc->clk_div--;
-	tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div);
+	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
 
 	/* Set the control register bits */
 	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
-	tscadc_writel(tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
 
 	/* Set register bits for Idle Config Mode */
 	if (tsc_wires > 0) {
@@ -254,7 +240,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 
 	/* Enable the TSC module enable bit */
 	ctrl |= CNTRLREG_TSCSSENB;
-	tscadc_writel(tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
 
 	tscadc->used_cells = 0;
 	tscadc->tsc_cell = -1;
@@ -300,7 +286,7 @@ static int ti_tscadc_remove(struct platform_device *pdev)
 {
 	struct ti_tscadc_dev	*tscadc = platform_get_drvdata(pdev);
 
-	tscadc_writel(tscadc, REG_SE, 0x00);
+	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
@@ -314,7 +300,7 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
 {
 	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
 
-	tscadc_writel(tscadc_dev, REG_SE, 0x00);
+	regmap_write(tscadc_dev->regmap_tscadc, REG_SE, 0x00);
 	pm_runtime_put_sync(dev);
 
 	return 0;
@@ -329,7 +315,7 @@ static int __maybe_unused tscadc_resume(struct device *dev)
 
 	/* context restore */
 	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
-	tscadc_writel(tscadc_dev, REG_CTRL, ctrl);
+	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
 
 	if (tscadc_dev->tsc_cell != -1) {
 		if (tscadc_dev->tsc_wires == 5)
@@ -339,9 +325,9 @@ static int __maybe_unused tscadc_resume(struct device *dev)
 		tscadc_idle_config(tscadc_dev);
 	}
 	ctrl |= CNTRLREG_TSCSSENB;
-	tscadc_writel(tscadc_dev, REG_CTRL, ctrl);
+	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
 
-	tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div);
+	regmap_write(tscadc_dev->regmap_tscadc, REG_CLKDIV, tscadc_dev->clk_div);
 
 	return 0;
 }
-- 
2.8.3

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

* [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
                   ` (2 preceding siblings ...)
  2016-05-31 17:00 ` [PATCH 3/8] mfd: ti_am335x_tscadc: Remove use of single line functions Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-05-31 17:53   ` Dave Gerlach
  2016-06-08 15:34   ` Lee Jones
  2016-05-31 17:00 ` [PATCH 5/8] mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap Andrew F. Davis
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

All functions in this driver reference the same ti_tscadc_dev per device
but use several different names for this structure pointer, this can
be confusing when following the code. Use the name 'tscadc' everywhere.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 88 +++++++++++++++++++++---------------------
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 613f15d..9b293b1 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -34,89 +34,89 @@ static const struct regmap_config tscadc_regmap_config = {
 	.val_bits = 32,
 };
 
-void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
+void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tscadc, u32 val)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&tsadc->reg_lock, flags);
-	tsadc->reg_se_cache |= val;
-	if (tsadc->adc_waiting)
-		wake_up(&tsadc->reg_se_wait);
-	else if (!tsadc->adc_in_use)
-		regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
+	spin_lock_irqsave(&tscadc->reg_lock, flags);
+	tscadc->reg_se_cache |= val;
+	if (tscadc->adc_waiting)
+		wake_up(&tscadc->reg_se_wait);
+	else if (!tscadc->adc_in_use)
+		regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
 
-	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
+	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_set_cache);
 
-static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
+static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
 {
 	DEFINE_WAIT(wait);
 	u32 reg;
 
-	regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
+	regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
 	if (reg & SEQ_STATUS) {
-		tsadc->adc_waiting = true;
-		prepare_to_wait(&tsadc->reg_se_wait, &wait,
+		tscadc->adc_waiting = true;
+		prepare_to_wait(&tscadc->reg_se_wait, &wait,
 				TASK_UNINTERRUPTIBLE);
-		spin_unlock_irq(&tsadc->reg_lock);
+		spin_unlock_irq(&tscadc->reg_lock);
 
 		schedule();
 
-		spin_lock_irq(&tsadc->reg_lock);
-		finish_wait(&tsadc->reg_se_wait, &wait);
+		spin_lock_irq(&tscadc->reg_lock);
+		finish_wait(&tscadc->reg_se_wait, &wait);
 
 		/*
 		 * Sequencer should either be idle or
 		 * busy applying the charge step.
 		 */
-		regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
+		regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
 		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
-		tsadc->adc_waiting = false;
+		tscadc->adc_waiting = false;
 	}
-	tsadc->adc_in_use = true;
+	tscadc->adc_in_use = true;
 }
 
-void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
+void am335x_tsc_se_set_once(struct ti_tscadc_dev *tscadc, u32 val)
 {
-	spin_lock_irq(&tsadc->reg_lock);
-	am335x_tscadc_need_adc(tsadc);
+	spin_lock_irq(&tscadc->reg_lock);
+	am335x_tscadc_need_adc(tscadc);
 
-	regmap_write(tsadc->regmap_tscadc, REG_SE, val);
-	spin_unlock_irq(&tsadc->reg_lock);
+	regmap_write(tscadc->regmap_tscadc, REG_SE, val);
+	spin_unlock_irq(&tscadc->reg_lock);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
 
-void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tsadc)
+void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tscadc)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&tsadc->reg_lock, flags);
-	tsadc->adc_in_use = false;
-	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
-	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
+	spin_lock_irqsave(&tscadc->reg_lock, flags);
+	tscadc->adc_in_use = false;
+	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
+	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
 
-void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val)
+void am335x_tsc_se_clr(struct ti_tscadc_dev *tscadc, u32 val)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&tsadc->reg_lock, flags);
-	tsadc->reg_se_cache &= ~val;
-	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
-	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
+	spin_lock_irqsave(&tscadc->reg_lock, flags);
+	tscadc->reg_se_cache &= ~val;
+	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
+	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
 
-static void tscadc_idle_config(struct ti_tscadc_dev *config)
+static void tscadc_idle_config(struct ti_tscadc_dev *tscadc)
 {
 	unsigned int idleconfig;
 
 	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
 			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
 
-	regmap_write(config->regmap_tscadc, REG_IDLECONFIG, idleconfig);
+	regmap_write(tscadc->regmap_tscadc, REG_IDLECONFIG, idleconfig);
 }
 
 static	int ti_tscadc_probe(struct platform_device *pdev)
@@ -298,9 +298,9 @@ static int ti_tscadc_remove(struct platform_device *pdev)
 
 static int __maybe_unused tscadc_suspend(struct device *dev)
 {
-	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
+	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
 
-	regmap_write(tscadc_dev->regmap_tscadc, REG_SE, 0x00);
+	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
 	pm_runtime_put_sync(dev);
 
 	return 0;
@@ -308,26 +308,26 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
 
 static int __maybe_unused tscadc_resume(struct device *dev)
 {
-	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
+	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
 	u32 ctrl;
 
 	pm_runtime_get_sync(dev);
 
 	/* context restore */
 	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
-	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
 
-	if (tscadc_dev->tsc_cell != -1) {
-		if (tscadc_dev->tsc_wires == 5)
+	if (tscadc->tsc_cell != -1) {
+		if (tscadc->tsc_wires == 5)
 			ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB;
 		else
 			ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB;
-		tscadc_idle_config(tscadc_dev);
+		tscadc_idle_config(tscadc);
 	}
 	ctrl |= CNTRLREG_TSCSSENB;
-	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
 
-	regmap_write(tscadc_dev->regmap_tscadc, REG_CLKDIV, tscadc_dev->clk_div);
+	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
 
 	return 0;
 }
-- 
2.8.3

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

* [PATCH 5/8] mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
                   ` (3 preceding siblings ...)
  2016-05-31 17:00 ` [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-08 15:33   ` Lee Jones
  2016-05-31 17:00 ` [PATCH 6/8] mfd: ti_am335x_tscadc: use variable name for sizeof() operator Andrew F. Davis
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

The regmap structuer pointer is named regmap_tscadc, this is not
consistent with other drivers and is redundant, it also contributes
to several checkpatch warnings involving long lines. Rename this.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/mfd/ti_am335x_tscadc.c       | 36 ++++++++++++++++++------------------
 include/linux/mfd/ti_am335x_tscadc.h |  2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 9b293b1..d30bea5 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -43,7 +43,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tscadc, u32 val)
 	if (tscadc->adc_waiting)
 		wake_up(&tscadc->reg_se_wait);
 	else if (!tscadc->adc_in_use)
-		regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
+		regmap_write(tscadc->regmap, REG_SE, tscadc->reg_se_cache);
 
 	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
 }
@@ -54,7 +54,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
 	DEFINE_WAIT(wait);
 	u32 reg;
 
-	regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
+	regmap_read(tscadc->regmap, REG_ADCFSM, &reg);
 	if (reg & SEQ_STATUS) {
 		tscadc->adc_waiting = true;
 		prepare_to_wait(&tscadc->reg_se_wait, &wait,
@@ -70,7 +70,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
 		 * Sequencer should either be idle or
 		 * busy applying the charge step.
 		 */
-		regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
+		regmap_read(tscadc->regmap, REG_ADCFSM, &reg);
 		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
 		tscadc->adc_waiting = false;
 	}
@@ -82,7 +82,7 @@ void am335x_tsc_se_set_once(struct ti_tscadc_dev *tscadc, u32 val)
 	spin_lock_irq(&tscadc->reg_lock);
 	am335x_tscadc_need_adc(tscadc);
 
-	regmap_write(tscadc->regmap_tscadc, REG_SE, val);
+	regmap_write(tscadc->regmap, REG_SE, val);
 	spin_unlock_irq(&tscadc->reg_lock);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
@@ -93,7 +93,7 @@ void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tscadc)
 
 	spin_lock_irqsave(&tscadc->reg_lock, flags);
 	tscadc->adc_in_use = false;
-	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
+	regmap_write(tscadc->regmap, REG_SE, tscadc->reg_se_cache);
 	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
@@ -104,7 +104,7 @@ void am335x_tsc_se_clr(struct ti_tscadc_dev *tscadc, u32 val)
 
 	spin_lock_irqsave(&tscadc->reg_lock, flags);
 	tscadc->reg_se_cache &= ~val;
-	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
+	regmap_write(tscadc->regmap, REG_SE, tscadc->reg_se_cache);
 	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
 }
 EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
@@ -116,7 +116,7 @@ static void tscadc_idle_config(struct ti_tscadc_dev *tscadc)
 	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
 			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
 
-	regmap_write(tscadc->regmap_tscadc, REG_IDLECONFIG, idleconfig);
+	regmap_write(tscadc->regmap, REG_IDLECONFIG, idleconfig);
 }
 
 static	int ti_tscadc_probe(struct platform_device *pdev)
@@ -188,11 +188,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	if (IS_ERR(tscadc->tscadc_base))
 		return PTR_ERR(tscadc->tscadc_base);
 
-	tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev,
+	tscadc->regmap = devm_regmap_init_mmio(&pdev->dev,
 			tscadc->tscadc_base, &tscadc_regmap_config);
-	if (IS_ERR(tscadc->regmap_tscadc)) {
+	if (IS_ERR(tscadc->regmap)) {
 		dev_err(&pdev->dev, "regmap init failed\n");
-		err = PTR_ERR(tscadc->regmap_tscadc);
+		err = PTR_ERR(tscadc->regmap);
 		goto ret;
 	}
 
@@ -222,11 +222,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 
 	/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
 	tscadc->clk_div--;
-	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
+	regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div);
 
 	/* Set the control register bits */
 	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
-	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
 
 	/* Set register bits for Idle Config Mode */
 	if (tsc_wires > 0) {
@@ -240,7 +240,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 
 	/* Enable the TSC module enable bit */
 	ctrl |= CNTRLREG_TSCSSENB;
-	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
 
 	tscadc->used_cells = 0;
 	tscadc->tsc_cell = -1;
@@ -286,7 +286,7 @@ static int ti_tscadc_remove(struct platform_device *pdev)
 {
 	struct ti_tscadc_dev	*tscadc = platform_get_drvdata(pdev);
 
-	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
+	regmap_write(tscadc->regmap, REG_SE, 0x00);
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
@@ -300,7 +300,7 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
 {
 	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
 
-	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
+	regmap_write(tscadc->regmap, REG_SE, 0x00);
 	pm_runtime_put_sync(dev);
 
 	return 0;
@@ -315,7 +315,7 @@ static int __maybe_unused tscadc_resume(struct device *dev)
 
 	/* context restore */
 	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
-	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
 
 	if (tscadc->tsc_cell != -1) {
 		if (tscadc->tsc_wires == 5)
@@ -325,9 +325,9 @@ static int __maybe_unused tscadc_resume(struct device *dev)
 		tscadc_idle_config(tscadc);
 	}
 	ctrl |= CNTRLREG_TSCSSENB;
-	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
+	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
 
-	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
+	regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div);
 
 	return 0;
 }
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 1fd50dc..2567a87 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -153,7 +153,7 @@
 
 struct ti_tscadc_dev {
 	struct device *dev;
-	struct regmap *regmap_tscadc;
+	struct regmap *regmap;
 	void __iomem *tscadc_base;
 	int irq;
 	int used_cells;	/* 1-2 */
-- 
2.8.3

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

* [PATCH 6/8] mfd: ti_am335x_tscadc: use variable name for sizeof() operator
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
                   ` (4 preceding siblings ...)
  2016-05-31 17:00 ` [PATCH 5/8] mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-08 15:35   ` Lee Jones
  2016-05-31 17:00 ` [PATCH 7/8] iio: adc: ti_am335x_adc: use variable names " Andrew F. Davis
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

Fix the code formatting to use the kernel preferred style
of using the actual variables to determize the size using
the sizeof() operator.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index d30bea5..c8f027b 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -168,8 +168,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	}
 
 	/* Allocate memory for device */
-	tscadc = devm_kzalloc(&pdev->dev,
-			sizeof(struct ti_tscadc_dev), GFP_KERNEL);
+	tscadc = devm_kzalloc(&pdev->dev, sizeof(*tscadc), GFP_KERNEL);
 	if (!tscadc) {
 		dev_err(&pdev->dev, "failed to allocate memory.\n");
 		return -ENOMEM;
-- 
2.8.3

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

* [PATCH 7/8] iio: adc: ti_am335x_adc: use variable names for sizeof() operator
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
                   ` (5 preceding siblings ...)
  2016-05-31 17:00 ` [PATCH 6/8] mfd: ti_am335x_tscadc: use variable name for sizeof() operator Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-03 12:15   ` Jonathan Cameron
  2016-05-31 17:00 ` [PATCH 8/8] Input: ti_am335x_tsc - use variable name " Andrew F. Davis
  2016-06-08 15:36 ` [PATCH 0/8] TI AM335x TSC/ADC cleanup Lee Jones
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

Fix the code formatting to use the kernel preferred style
of using the actual variables to determize the size using
the sizeof() operator.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 18af71d..8a36875 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -326,8 +326,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
 	int i;
 
 	indio_dev->num_channels = channels;
-	chan_array = kcalloc(channels,
-			sizeof(struct iio_chan_spec), GFP_KERNEL);
+	chan_array = kcalloc(channels, sizeof(*chan_array), GFP_KERNEL);
 	if (chan_array == NULL)
 		return -ENOMEM;
 
@@ -467,8 +466,7 @@ static int tiadc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	indio_dev = devm_iio_device_alloc(&pdev->dev,
-					  sizeof(struct tiadc_device));
+	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev));
 	if (indio_dev == NULL) {
 		dev_err(&pdev->dev, "failed to allocate iio device\n");
 		return -ENOMEM;
-- 
2.8.3

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

* [PATCH 8/8] Input: ti_am335x_tsc - use variable name for sizeof() operator
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
                   ` (6 preceding siblings ...)
  2016-05-31 17:00 ` [PATCH 7/8] iio: adc: ti_am335x_adc: use variable names " Andrew F. Davis
@ 2016-05-31 17:00 ` Andrew F. Davis
  2016-06-01 18:35   ` Dmitry Torokhov
  2016-06-08 15:36 ` [PATCH 0/8] TI AM335x TSC/ADC cleanup Lee Jones
  8 siblings, 1 reply; 19+ messages in thread
From: Andrew F. Davis @ 2016-05-31 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel, Andrew F . Davis

Fix the code formatting to use the kernel preferred style
of using the actual variables to determize the size using
the sizeof() operator.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 drivers/input/touchscreen/ti_am335x_tsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 8b3f15c..7953381 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -406,7 +406,7 @@ static int titsc_probe(struct platform_device *pdev)
 	int err;
 
 	/* Allocate memory for device */
-	ts_dev = kzalloc(sizeof(struct titsc), GFP_KERNEL);
+	ts_dev = kzalloc(sizeof(*ts_dev), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!ts_dev || !input_dev) {
 		dev_err(&pdev->dev, "failed to allocate memory.\n");
-- 
2.8.3

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

* Re: [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev
  2016-05-31 17:00 ` [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev Andrew F. Davis
@ 2016-05-31 17:53   ` Dave Gerlach
  2016-06-08 15:34   ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Dave Gerlach @ 2016-05-31 17:53 UTC (permalink / raw)
  To: Andrew F. Davis, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Dmitry Torokhov,
	Lee Jones
  Cc: linux-iio, linux-input, linux-kernel

Hi,
On 05/31/2016 12:00 PM, Andrew F. Davis wrote:
> All functions in this driver reference the same ti_tscadc_dev per device
> but use several different names for this structure pointer, this can
> be confusing when following the code. Use the name 'tscadc' everywhere.
>

$subject typo: "refrencing" should be "referencing"

Regards,
Dave

> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>   drivers/mfd/ti_am335x_tscadc.c | 88 +++++++++++++++++++++---------------------
>   1 file changed, 44 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index 613f15d..9b293b1 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -34,89 +34,89 @@ static const struct regmap_config tscadc_regmap_config = {
>   	.val_bits = 32,
>   };
>
> -void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
> +void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tscadc, u32 val)
>   {
>   	unsigned long flags;
>
> -	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->reg_se_cache |= val;
> -	if (tsadc->adc_waiting)
> -		wake_up(&tsadc->reg_se_wait);
> -	else if (!tsadc->adc_in_use)
> -		regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
> +	spin_lock_irqsave(&tscadc->reg_lock, flags);
> +	tscadc->reg_se_cache |= val;
> +	if (tscadc->adc_waiting)
> +		wake_up(&tscadc->reg_se_wait);
> +	else if (!tscadc->adc_in_use)
> +		regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
>
> -	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
> +	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>   }
>   EXPORT_SYMBOL_GPL(am335x_tsc_se_set_cache);
>
> -static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
> +static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
>   {
>   	DEFINE_WAIT(wait);
>   	u32 reg;
>
> -	regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
> +	regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
>   	if (reg & SEQ_STATUS) {
> -		tsadc->adc_waiting = true;
> -		prepare_to_wait(&tsadc->reg_se_wait, &wait,
> +		tscadc->adc_waiting = true;
> +		prepare_to_wait(&tscadc->reg_se_wait, &wait,
>   				TASK_UNINTERRUPTIBLE);
> -		spin_unlock_irq(&tsadc->reg_lock);
> +		spin_unlock_irq(&tscadc->reg_lock);
>
>   		schedule();
>
> -		spin_lock_irq(&tsadc->reg_lock);
> -		finish_wait(&tsadc->reg_se_wait, &wait);
> +		spin_lock_irq(&tscadc->reg_lock);
> +		finish_wait(&tscadc->reg_se_wait, &wait);
>
>   		/*
>   		 * Sequencer should either be idle or
>   		 * busy applying the charge step.
>   		 */
> -		regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
> +		regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
>   		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
> -		tsadc->adc_waiting = false;
> +		tscadc->adc_waiting = false;
>   	}
> -	tsadc->adc_in_use = true;
> +	tscadc->adc_in_use = true;
>   }
>
> -void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
> +void am335x_tsc_se_set_once(struct ti_tscadc_dev *tscadc, u32 val)
>   {
> -	spin_lock_irq(&tsadc->reg_lock);
> -	am335x_tscadc_need_adc(tsadc);
> +	spin_lock_irq(&tscadc->reg_lock);
> +	am335x_tscadc_need_adc(tscadc);
>
> -	regmap_write(tsadc->regmap_tscadc, REG_SE, val);
> -	spin_unlock_irq(&tsadc->reg_lock);
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, val);
> +	spin_unlock_irq(&tscadc->reg_lock);
>   }
>   EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
>
> -void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tsadc)
> +void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tscadc)
>   {
>   	unsigned long flags;
>
> -	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->adc_in_use = false;
> -	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
> -	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
> +	spin_lock_irqsave(&tscadc->reg_lock, flags);
> +	tscadc->adc_in_use = false;
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>   }
>   EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
>
> -void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val)
> +void am335x_tsc_se_clr(struct ti_tscadc_dev *tscadc, u32 val)
>   {
>   	unsigned long flags;
>
> -	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->reg_se_cache &= ~val;
> -	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
> -	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
> +	spin_lock_irqsave(&tscadc->reg_lock, flags);
> +	tscadc->reg_se_cache &= ~val;
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>   }
>   EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
>
> -static void tscadc_idle_config(struct ti_tscadc_dev *config)
> +static void tscadc_idle_config(struct ti_tscadc_dev *tscadc)
>   {
>   	unsigned int idleconfig;
>
>   	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
>   			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
>
> -	regmap_write(config->regmap_tscadc, REG_IDLECONFIG, idleconfig);
> +	regmap_write(tscadc->regmap_tscadc, REG_IDLECONFIG, idleconfig);
>   }
>
>   static	int ti_tscadc_probe(struct platform_device *pdev)
> @@ -298,9 +298,9 @@ static int ti_tscadc_remove(struct platform_device *pdev)
>
>   static int __maybe_unused tscadc_suspend(struct device *dev)
>   {
> -	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
> +	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
>
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_SE, 0x00);
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
>   	pm_runtime_put_sync(dev);
>
>   	return 0;
> @@ -308,26 +308,26 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
>
>   static int __maybe_unused tscadc_resume(struct device *dev)
>   {
> -	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
> +	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
>   	u32 ctrl;
>
>   	pm_runtime_get_sync(dev);
>
>   	/* context restore */
>   	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
>
> -	if (tscadc_dev->tsc_cell != -1) {
> -		if (tscadc_dev->tsc_wires == 5)
> +	if (tscadc->tsc_cell != -1) {
> +		if (tscadc->tsc_wires == 5)
>   			ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB;
>   		else
>   			ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB;
> -		tscadc_idle_config(tscadc_dev);
> +		tscadc_idle_config(tscadc);
>   	}
>   	ctrl |= CNTRLREG_TSCSSENB;
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
>
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_CLKDIV, tscadc_dev->clk_div);
> +	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
>
>   	return 0;
>   }
>

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

* Re: [PATCH 8/8] Input: ti_am335x_tsc - use variable name for sizeof() operator
  2016-05-31 17:00 ` [PATCH 8/8] Input: ti_am335x_tsc - use variable name " Andrew F. Davis
@ 2016-06-01 18:35   ` Dmitry Torokhov
  0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2016-06-01 18:35 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Lee Jones, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, May 31, 2016 at 12:00:13PM -0500, Andrew F. Davis wrote:
> Fix the code formatting to use the kernel preferred style
> of using the actual variables to determize the size using
> the sizeof() operator.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/ti_am335x_tsc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> index 8b3f15c..7953381 100644
> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> @@ -406,7 +406,7 @@ static int titsc_probe(struct platform_device *pdev)
>  	int err;
>  
>  	/* Allocate memory for device */
> -	ts_dev = kzalloc(sizeof(struct titsc), GFP_KERNEL);
> +	ts_dev = kzalloc(sizeof(*ts_dev), GFP_KERNEL);
>  	input_dev = input_allocate_device();
>  	if (!ts_dev || !input_dev) {
>  		dev_err(&pdev->dev, "failed to allocate memory.\n");
> -- 
> 2.8.3
> 

-- 
Dmitry

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

* Re: [PATCH 7/8] iio: adc: ti_am335x_adc: use variable names for sizeof() operator
  2016-05-31 17:00 ` [PATCH 7/8] iio: adc: ti_am335x_adc: use variable names " Andrew F. Davis
@ 2016-06-03 12:15   ` Jonathan Cameron
  0 siblings, 0 replies; 19+ messages in thread
From: Jonathan Cameron @ 2016-06-03 12:15 UTC (permalink / raw)
  To: Andrew F. Davis, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel

On 31/05/16 18:00, Andrew F. Davis wrote:
> Fix the code formatting to use the kernel preferred style
> of using the actual variables to determize the size using
> the sizeof() operator.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
Applied - thanks,

Jonathan
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index 18af71d..8a36875 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -326,8 +326,7 @@ static int tiadc_channel_init(struct iio_dev *indio_dev, int channels)
>  	int i;
>  
>  	indio_dev->num_channels = channels;
> -	chan_array = kcalloc(channels,
> -			sizeof(struct iio_chan_spec), GFP_KERNEL);
> +	chan_array = kcalloc(channels, sizeof(*chan_array), GFP_KERNEL);
>  	if (chan_array == NULL)
>  		return -ENOMEM;
>  
> @@ -467,8 +466,7 @@ static int tiadc_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	indio_dev = devm_iio_device_alloc(&pdev->dev,
> -					  sizeof(struct tiadc_device));
> +	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev));
>  	if (indio_dev == NULL) {
>  		dev_err(&pdev->dev, "failed to allocate iio device\n");
>  		return -ENOMEM;
> 

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

* Re: [PATCH 2/8] iio: adc: ti_am335x_adc: use SIMPLE_DEV_PM_OPS helper macro
  2016-05-31 17:00 ` [PATCH 2/8] iio: adc: ti_am335x_adc: use " Andrew F. Davis
@ 2016-06-03 12:16   ` Jonathan Cameron
  0 siblings, 0 replies; 19+ messages in thread
From: Jonathan Cameron @ 2016-06-03 12:16 UTC (permalink / raw)
  To: Andrew F. Davis, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Lee Jones, Dave Gerlach
  Cc: linux-iio, linux-input, linux-kernel

On 31/05/16 18:00, Andrew F. Davis wrote:
> Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
Applied to the togreg branch of iio.git - initially pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/ti_am335x_adc.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index c1e0553..18af71d 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -531,8 +531,7 @@ static int tiadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> -static int tiadc_suspend(struct device *dev)
> +static int __maybe_unused tiadc_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> @@ -550,7 +549,7 @@ static int tiadc_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int tiadc_resume(struct device *dev)
> +static int __maybe_unused tiadc_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct tiadc_device *adc_dev = iio_priv(indio_dev);
> @@ -567,14 +566,7 @@ static int tiadc_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static const struct dev_pm_ops tiadc_pm_ops = {
> -	.suspend = tiadc_suspend,
> -	.resume = tiadc_resume,
> -};
> -#define TIADC_PM_OPS (&tiadc_pm_ops)
> -#else
> -#define TIADC_PM_OPS NULL
> -#endif
> +static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
>  
>  static const struct of_device_id ti_adc_dt_ids[] = {
>  	{ .compatible = "ti,am3359-adc", },
> @@ -585,7 +577,7 @@ MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
>  static struct platform_driver tiadc_driver = {
>  	.driver = {
>  		.name   = "TI-am335x-adc",
> -		.pm	= TIADC_PM_OPS,
> +		.pm	= &tiadc_pm_ops,
>  		.of_match_table = ti_adc_dt_ids,
>  	},
>  	.probe	= tiadc_probe,
> 

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

* Re: [PATCH 5/8] mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap
  2016-05-31 17:00 ` [PATCH 5/8] mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap Andrew F. Davis
@ 2016-06-08 15:33   ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-06-08 15:33 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, 31 May 2016, Andrew F. Davis wrote:

> The regmap structuer pointer is named regmap_tscadc, this is not
> consistent with other drivers and is redundant, it also contributes
> to several checkpatch warnings involving long lines. Rename this.

Please spell check all of your subject lines and commit logs *before*
sending.

> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/mfd/ti_am335x_tscadc.c       | 36 ++++++++++++++++++------------------
>  include/linux/mfd/ti_am335x_tscadc.h |  2 +-
>  2 files changed, 19 insertions(+), 19 deletions(-)

For the patch:
  Acked-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index 9b293b1..d30bea5 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -43,7 +43,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tscadc, u32 val)
>  	if (tscadc->adc_waiting)
>  		wake_up(&tscadc->reg_se_wait);
>  	else if (!tscadc->adc_in_use)
> -		regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +		regmap_write(tscadc->regmap, REG_SE, tscadc->reg_se_cache);
>  
>  	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>  }
> @@ -54,7 +54,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
>  	DEFINE_WAIT(wait);
>  	u32 reg;
>  
> -	regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
> +	regmap_read(tscadc->regmap, REG_ADCFSM, &reg);
>  	if (reg & SEQ_STATUS) {
>  		tscadc->adc_waiting = true;
>  		prepare_to_wait(&tscadc->reg_se_wait, &wait,
> @@ -70,7 +70,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
>  		 * Sequencer should either be idle or
>  		 * busy applying the charge step.
>  		 */
> -		regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
> +		regmap_read(tscadc->regmap, REG_ADCFSM, &reg);
>  		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
>  		tscadc->adc_waiting = false;
>  	}
> @@ -82,7 +82,7 @@ void am335x_tsc_se_set_once(struct ti_tscadc_dev *tscadc, u32 val)
>  	spin_lock_irq(&tscadc->reg_lock);
>  	am335x_tscadc_need_adc(tscadc);
>  
> -	regmap_write(tscadc->regmap_tscadc, REG_SE, val);
> +	regmap_write(tscadc->regmap, REG_SE, val);
>  	spin_unlock_irq(&tscadc->reg_lock);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
> @@ -93,7 +93,7 @@ void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tscadc)
>  
>  	spin_lock_irqsave(&tscadc->reg_lock, flags);
>  	tscadc->adc_in_use = false;
> -	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +	regmap_write(tscadc->regmap, REG_SE, tscadc->reg_se_cache);
>  	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
> @@ -104,7 +104,7 @@ void am335x_tsc_se_clr(struct ti_tscadc_dev *tscadc, u32 val)
>  
>  	spin_lock_irqsave(&tscadc->reg_lock, flags);
>  	tscadc->reg_se_cache &= ~val;
> -	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +	regmap_write(tscadc->regmap, REG_SE, tscadc->reg_se_cache);
>  	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
> @@ -116,7 +116,7 @@ static void tscadc_idle_config(struct ti_tscadc_dev *tscadc)
>  	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
>  			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
>  
> -	regmap_write(tscadc->regmap_tscadc, REG_IDLECONFIG, idleconfig);
> +	regmap_write(tscadc->regmap, REG_IDLECONFIG, idleconfig);
>  }
>  
>  static	int ti_tscadc_probe(struct platform_device *pdev)
> @@ -188,11 +188,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  	if (IS_ERR(tscadc->tscadc_base))
>  		return PTR_ERR(tscadc->tscadc_base);
>  
> -	tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev,
> +	tscadc->regmap = devm_regmap_init_mmio(&pdev->dev,
>  			tscadc->tscadc_base, &tscadc_regmap_config);
> -	if (IS_ERR(tscadc->regmap_tscadc)) {
> +	if (IS_ERR(tscadc->regmap)) {
>  		dev_err(&pdev->dev, "regmap init failed\n");
> -		err = PTR_ERR(tscadc->regmap_tscadc);
> +		err = PTR_ERR(tscadc->regmap);
>  		goto ret;
>  	}
>  
> @@ -222,11 +222,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  
>  	/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
>  	tscadc->clk_div--;
> -	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
> +	regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div);
>  
>  	/* Set the control register bits */
>  	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
> -	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
>  
>  	/* Set register bits for Idle Config Mode */
>  	if (tsc_wires > 0) {
> @@ -240,7 +240,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  
>  	/* Enable the TSC module enable bit */
>  	ctrl |= CNTRLREG_TSCSSENB;
> -	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
>  
>  	tscadc->used_cells = 0;
>  	tscadc->tsc_cell = -1;
> @@ -286,7 +286,7 @@ static int ti_tscadc_remove(struct platform_device *pdev)
>  {
>  	struct ti_tscadc_dev	*tscadc = platform_get_drvdata(pdev);
>  
> -	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
> +	regmap_write(tscadc->regmap, REG_SE, 0x00);
>  
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> @@ -300,7 +300,7 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
>  {
>  	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
>  
> -	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
> +	regmap_write(tscadc->regmap, REG_SE, 0x00);
>  	pm_runtime_put_sync(dev);
>  
>  	return 0;
> @@ -315,7 +315,7 @@ static int __maybe_unused tscadc_resume(struct device *dev)
>  
>  	/* context restore */
>  	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
> -	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
>  
>  	if (tscadc->tsc_cell != -1) {
>  		if (tscadc->tsc_wires == 5)
> @@ -325,9 +325,9 @@ static int __maybe_unused tscadc_resume(struct device *dev)
>  		tscadc_idle_config(tscadc);
>  	}
>  	ctrl |= CNTRLREG_TSCSSENB;
> -	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap, REG_CTRL, ctrl);
>  
> -	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
> +	regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div);
>  
>  	return 0;
>  }
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index 1fd50dc..2567a87 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -153,7 +153,7 @@
>  
>  struct ti_tscadc_dev {
>  	struct device *dev;
> -	struct regmap *regmap_tscadc;
> +	struct regmap *regmap;
>  	void __iomem *tscadc_base;
>  	int irq;
>  	int used_cells;	/* 1-2 */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev
  2016-05-31 17:00 ` [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev Andrew F. Davis
  2016-05-31 17:53   ` Dave Gerlach
@ 2016-06-08 15:34   ` Lee Jones
  1 sibling, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-06-08 15:34 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, 31 May 2016, Andrew F. Davis wrote:

> All functions in this driver reference the same ti_tscadc_dev per device
> but use several different names for this structure pointer, this can
> be confusing when following the code. Use the name 'tscadc' everywhere.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/mfd/ti_am335x_tscadc.c | 88 +++++++++++++++++++++---------------------
>  1 file changed, 44 insertions(+), 44 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index 613f15d..9b293b1 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -34,89 +34,89 @@ static const struct regmap_config tscadc_regmap_config = {
>  	.val_bits = 32,
>  };
>  
> -void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
> +void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tscadc, u32 val)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->reg_se_cache |= val;
> -	if (tsadc->adc_waiting)
> -		wake_up(&tsadc->reg_se_wait);
> -	else if (!tsadc->adc_in_use)
> -		regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
> +	spin_lock_irqsave(&tscadc->reg_lock, flags);
> +	tscadc->reg_se_cache |= val;
> +	if (tscadc->adc_waiting)
> +		wake_up(&tscadc->reg_se_wait);
> +	else if (!tscadc->adc_in_use)
> +		regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
>  
> -	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
> +	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_set_cache);
>  
> -static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
> +static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tscadc)
>  {
>  	DEFINE_WAIT(wait);
>  	u32 reg;
>  
> -	regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
> +	regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
>  	if (reg & SEQ_STATUS) {
> -		tsadc->adc_waiting = true;
> -		prepare_to_wait(&tsadc->reg_se_wait, &wait,
> +		tscadc->adc_waiting = true;
> +		prepare_to_wait(&tscadc->reg_se_wait, &wait,
>  				TASK_UNINTERRUPTIBLE);
> -		spin_unlock_irq(&tsadc->reg_lock);
> +		spin_unlock_irq(&tscadc->reg_lock);
>  
>  		schedule();
>  
> -		spin_lock_irq(&tsadc->reg_lock);
> -		finish_wait(&tsadc->reg_se_wait, &wait);
> +		spin_lock_irq(&tscadc->reg_lock);
> +		finish_wait(&tscadc->reg_se_wait, &wait);
>  
>  		/*
>  		 * Sequencer should either be idle or
>  		 * busy applying the charge step.
>  		 */
> -		regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
> +		regmap_read(tscadc->regmap_tscadc, REG_ADCFSM, &reg);
>  		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
> -		tsadc->adc_waiting = false;
> +		tscadc->adc_waiting = false;
>  	}
> -	tsadc->adc_in_use = true;
> +	tscadc->adc_in_use = true;
>  }
>  
> -void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
> +void am335x_tsc_se_set_once(struct ti_tscadc_dev *tscadc, u32 val)
>  {
> -	spin_lock_irq(&tsadc->reg_lock);
> -	am335x_tscadc_need_adc(tsadc);
> +	spin_lock_irq(&tscadc->reg_lock);
> +	am335x_tscadc_need_adc(tscadc);
>  
> -	regmap_write(tsadc->regmap_tscadc, REG_SE, val);
> -	spin_unlock_irq(&tsadc->reg_lock);
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, val);
> +	spin_unlock_irq(&tscadc->reg_lock);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
>  
> -void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tsadc)
> +void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tscadc)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->adc_in_use = false;
> -	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
> -	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
> +	spin_lock_irqsave(&tscadc->reg_lock, flags);
> +	tscadc->adc_in_use = false;
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
>  
> -void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val)
> +void am335x_tsc_se_clr(struct ti_tscadc_dev *tscadc, u32 val)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&tsadc->reg_lock, flags);
> -	tsadc->reg_se_cache &= ~val;
> -	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
> -	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
> +	spin_lock_irqsave(&tscadc->reg_lock, flags);
> +	tscadc->reg_se_cache &= ~val;
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, tscadc->reg_se_cache);
> +	spin_unlock_irqrestore(&tscadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
>  
> -static void tscadc_idle_config(struct ti_tscadc_dev *config)
> +static void tscadc_idle_config(struct ti_tscadc_dev *tscadc)
>  {
>  	unsigned int idleconfig;
>  
>  	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
>  			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
>  
> -	regmap_write(config->regmap_tscadc, REG_IDLECONFIG, idleconfig);
> +	regmap_write(tscadc->regmap_tscadc, REG_IDLECONFIG, idleconfig);
>  }
>  
>  static	int ti_tscadc_probe(struct platform_device *pdev)
> @@ -298,9 +298,9 @@ static int ti_tscadc_remove(struct platform_device *pdev)
>  
>  static int __maybe_unused tscadc_suspend(struct device *dev)
>  {
> -	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
> +	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
>  
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_SE, 0x00);
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
>  	pm_runtime_put_sync(dev);
>  
>  	return 0;
> @@ -308,26 +308,26 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
>  
>  static int __maybe_unused tscadc_resume(struct device *dev)
>  {
> -	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
> +	struct ti_tscadc_dev	*tscadc = dev_get_drvdata(dev);
>  	u32 ctrl;
>  
>  	pm_runtime_get_sync(dev);
>  
>  	/* context restore */
>  	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
>  
> -	if (tscadc_dev->tsc_cell != -1) {
> -		if (tscadc_dev->tsc_wires == 5)
> +	if (tscadc->tsc_cell != -1) {
> +		if (tscadc->tsc_wires == 5)
>  			ctrl |= CNTRLREG_5WIRE | CNTRLREG_TSCENB;
>  		else
>  			ctrl |= CNTRLREG_4WIRE | CNTRLREG_TSCENB;
> -		tscadc_idle_config(tscadc_dev);
> +		tscadc_idle_config(tscadc);
>  	}
>  	ctrl |= CNTRLREG_TSCSSENB;
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
>  
> -	regmap_write(tscadc_dev->regmap_tscadc, REG_CLKDIV, tscadc_dev->clk_div);
> +	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
>  
>  	return 0;
>  }

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 3/8] mfd: ti_am335x_tscadc: Remove use of single line functions
  2016-05-31 17:00 ` [PATCH 3/8] mfd: ti_am335x_tscadc: Remove use of single line functions Andrew F. Davis
@ 2016-06-08 15:35   ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-06-08 15:35 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, 31 May 2016, Andrew F. Davis wrote:

> tscadc_readl and tscadc_writel are single line functions and do not save
> use anything, remove these.

Right.  I usually push back on these type of abstraction when they are
submitted.

Acked-by: Lee Jones <lee.jones@linaro.org>

> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/mfd/ti_am335x_tscadc.c | 44 ++++++++++++++----------------------------
>  1 file changed, 15 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index 644128b..613f15d 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -27,20 +27,6 @@
>  
>  #include <linux/mfd/ti_am335x_tscadc.h>
>  
> -static unsigned int tscadc_readl(struct ti_tscadc_dev *tsadc, unsigned int reg)
> -{
> -	unsigned int val;
> -
> -	regmap_read(tsadc->regmap_tscadc, reg, &val);
> -	return val;
> -}
> -
> -static void tscadc_writel(struct ti_tscadc_dev *tsadc, unsigned int reg,
> -					unsigned int val)
> -{
> -	regmap_write(tsadc->regmap_tscadc, reg, val);
> -}
> -
>  static const struct regmap_config tscadc_regmap_config = {
>  	.name = "ti_tscadc",
>  	.reg_bits = 32,
> @@ -57,7 +43,7 @@ void am335x_tsc_se_set_cache(struct ti_tscadc_dev *tsadc, u32 val)
>  	if (tsadc->adc_waiting)
>  		wake_up(&tsadc->reg_se_wait);
>  	else if (!tsadc->adc_in_use)
> -		tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
> +		regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
>  
>  	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
>  }
> @@ -68,7 +54,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
>  	DEFINE_WAIT(wait);
>  	u32 reg;
>  
> -	reg = tscadc_readl(tsadc, REG_ADCFSM);
> +	regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
>  	if (reg & SEQ_STATUS) {
>  		tsadc->adc_waiting = true;
>  		prepare_to_wait(&tsadc->reg_se_wait, &wait,
> @@ -84,7 +70,7 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc)
>  		 * Sequencer should either be idle or
>  		 * busy applying the charge step.
>  		 */
> -		reg = tscadc_readl(tsadc, REG_ADCFSM);
> +		regmap_read(tsadc->regmap_tscadc, REG_ADCFSM, &reg);
>  		WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP));
>  		tsadc->adc_waiting = false;
>  	}
> @@ -96,7 +82,7 @@ void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val)
>  	spin_lock_irq(&tsadc->reg_lock);
>  	am335x_tscadc_need_adc(tsadc);
>  
> -	tscadc_writel(tsadc, REG_SE, val);
> +	regmap_write(tsadc->regmap_tscadc, REG_SE, val);
>  	spin_unlock_irq(&tsadc->reg_lock);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_set_once);
> @@ -107,7 +93,7 @@ void am335x_tsc_se_adc_done(struct ti_tscadc_dev *tsadc)
>  
>  	spin_lock_irqsave(&tsadc->reg_lock, flags);
>  	tsadc->adc_in_use = false;
> -	tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
> +	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
>  	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_adc_done);
> @@ -118,7 +104,7 @@ void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val)
>  
>  	spin_lock_irqsave(&tsadc->reg_lock, flags);
>  	tsadc->reg_se_cache &= ~val;
> -	tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
> +	regmap_write(tsadc->regmap_tscadc, REG_SE, tsadc->reg_se_cache);
>  	spin_unlock_irqrestore(&tsadc->reg_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
> @@ -130,7 +116,7 @@ static void tscadc_idle_config(struct ti_tscadc_dev *config)
>  	idleconfig = STEPCONFIG_YNN | STEPCONFIG_INM_ADCREFM |
>  			STEPCONFIG_INP_ADCREFM | STEPCONFIG_YPN;
>  
> -	tscadc_writel(config, REG_IDLECONFIG, idleconfig);
> +	regmap_write(config->regmap_tscadc, REG_IDLECONFIG, idleconfig);
>  }
>  
>  static	int ti_tscadc_probe(struct platform_device *pdev)
> @@ -236,11 +222,11 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  
>  	/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
>  	tscadc->clk_div--;
> -	tscadc_writel(tscadc, REG_CLKDIV, tscadc->clk_div);
> +	regmap_write(tscadc->regmap_tscadc, REG_CLKDIV, tscadc->clk_div);
>  
>  	/* Set the control register bits */
>  	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
> -	tscadc_writel(tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
>  
>  	/* Set register bits for Idle Config Mode */
>  	if (tsc_wires > 0) {
> @@ -254,7 +240,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  
>  	/* Enable the TSC module enable bit */
>  	ctrl |= CNTRLREG_TSCSSENB;
> -	tscadc_writel(tscadc, REG_CTRL, ctrl);
> +	regmap_write(tscadc->regmap_tscadc, REG_CTRL, ctrl);
>  
>  	tscadc->used_cells = 0;
>  	tscadc->tsc_cell = -1;
> @@ -300,7 +286,7 @@ static int ti_tscadc_remove(struct platform_device *pdev)
>  {
>  	struct ti_tscadc_dev	*tscadc = platform_get_drvdata(pdev);
>  
> -	tscadc_writel(tscadc, REG_SE, 0x00);
> +	regmap_write(tscadc->regmap_tscadc, REG_SE, 0x00);
>  
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> @@ -314,7 +300,7 @@ static int __maybe_unused tscadc_suspend(struct device *dev)
>  {
>  	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
>  
> -	tscadc_writel(tscadc_dev, REG_SE, 0x00);
> +	regmap_write(tscadc_dev->regmap_tscadc, REG_SE, 0x00);
>  	pm_runtime_put_sync(dev);
>  
>  	return 0;
> @@ -329,7 +315,7 @@ static int __maybe_unused tscadc_resume(struct device *dev)
>  
>  	/* context restore */
>  	ctrl = CNTRLREG_STEPCONFIGWRT |	CNTRLREG_STEPID;
> -	tscadc_writel(tscadc_dev, REG_CTRL, ctrl);
> +	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
>  
>  	if (tscadc_dev->tsc_cell != -1) {
>  		if (tscadc_dev->tsc_wires == 5)
> @@ -339,9 +325,9 @@ static int __maybe_unused tscadc_resume(struct device *dev)
>  		tscadc_idle_config(tscadc_dev);
>  	}
>  	ctrl |= CNTRLREG_TSCSSENB;
> -	tscadc_writel(tscadc_dev, REG_CTRL, ctrl);
> +	regmap_write(tscadc_dev->regmap_tscadc, REG_CTRL, ctrl);
>  
> -	tscadc_writel(tscadc_dev, REG_CLKDIV, tscadc_dev->clk_div);
> +	regmap_write(tscadc_dev->regmap_tscadc, REG_CLKDIV, tscadc_dev->clk_div);
>  
>  	return 0;
>  }

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 6/8] mfd: ti_am335x_tscadc: use variable name for sizeof() operator
  2016-05-31 17:00 ` [PATCH 6/8] mfd: ti_am335x_tscadc: use variable name for sizeof() operator Andrew F. Davis
@ 2016-06-08 15:35   ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-06-08 15:35 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, 31 May 2016, Andrew F. Davis wrote:

> Fix the code formatting to use the kernel preferred style
> of using the actual variables to determize the size using
> the sizeof() operator.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/mfd/ti_am335x_tscadc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index d30bea5..c8f027b 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -168,8 +168,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Allocate memory for device */
> -	tscadc = devm_kzalloc(&pdev->dev,
> -			sizeof(struct ti_tscadc_dev), GFP_KERNEL);
> +	tscadc = devm_kzalloc(&pdev->dev, sizeof(*tscadc), GFP_KERNEL);
>  	if (!tscadc) {
>  		dev_err(&pdev->dev, "failed to allocate memory.\n");
>  		return -ENOMEM;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro
  2016-05-31 17:00 ` [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro Andrew F. Davis
@ 2016-06-08 15:35   ` Lee Jones
  0 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-06-08 15:35 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, 31 May 2016, Andrew F. Davis wrote:

> Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  drivers/mfd/ti_am335x_tscadc.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index e4e4b22..644128b 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -310,8 +310,7 @@ static int ti_tscadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM
> -static int tscadc_suspend(struct device *dev)
> +static int __maybe_unused tscadc_suspend(struct device *dev)
>  {
>  	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
>  
> @@ -321,7 +320,7 @@ static int tscadc_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int tscadc_resume(struct device *dev)
> +static int __maybe_unused tscadc_resume(struct device *dev)
>  {
>  	struct ti_tscadc_dev	*tscadc_dev = dev_get_drvdata(dev);
>  	u32 ctrl;
> @@ -347,14 +346,7 @@ static int tscadc_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static const struct dev_pm_ops tscadc_pm_ops = {
> -	.suspend = tscadc_suspend,
> -	.resume = tscadc_resume,
> -};
> -#define TSCADC_PM_OPS (&tscadc_pm_ops)
> -#else
> -#define TSCADC_PM_OPS NULL
> -#endif
> +static SIMPLE_DEV_PM_OPS(tscadc_pm_ops, tscadc_suspend, tscadc_resume);
>  
>  static const struct of_device_id ti_tscadc_dt_ids[] = {
>  	{ .compatible = "ti,am3359-tscadc", },
> @@ -365,7 +357,7 @@ MODULE_DEVICE_TABLE(of, ti_tscadc_dt_ids);
>  static struct platform_driver ti_tscadc_driver = {
>  	.driver = {
>  		.name   = "ti_am3359-tscadc",
> -		.pm	= TSCADC_PM_OPS,
> +		.pm	= &tscadc_pm_ops,
>  		.of_match_table = ti_tscadc_dt_ids,
>  	},
>  	.probe	= ti_tscadc_probe,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 0/8] TI AM335x TSC/ADC cleanup
  2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
                   ` (7 preceding siblings ...)
  2016-05-31 17:00 ` [PATCH 8/8] Input: ti_am335x_tsc - use variable name " Andrew F. Davis
@ 2016-06-08 15:36 ` Lee Jones
  8 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2016-06-08 15:36 UTC (permalink / raw)
  To: Andrew F. Davis
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Dmitry Torokhov, Dave Gerlach, linux-iio,
	linux-input, linux-kernel

On Tue, 31 May 2016, Andrew F. Davis wrote:

> Hello all,
> 
> This series is a group of non-functional changes I would
> like to get in this cycle to prepare some regmap based
> changes I would like to make next cycle. Hopefully the
> churn can be seen as more useful in that case.

Once you've finished spell checking all of your commits, please submit
with the Acks you have collected.

> Andrew F. Davis (8):
>   mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro
>   iio: adc: ti_am335x_adc: use SIMPLE_DEV_PM_OPS helper macro
>   mfd: ti_am335x_tscadc: Remove use of single line functions
>   mfd: ti_am335x_tscadc: Unify variable naming when refrencing
>     ti_tscadc_dev
>   mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap
>   mfd: ti_am335x_tscadc: use variable name for sizeof() operator
>   iio: adc: ti_am335x_adc: use variable names for sizeof() operator
>   Input: ti_am335x_tsc - use variable name for sizeof() operator
> 
>  drivers/iio/adc/ti_am335x_adc.c           |  22 ++---
>  drivers/input/touchscreen/ti_am335x_tsc.c |   2 +-
>  drivers/mfd/ti_am335x_tscadc.c            | 135 +++++++++++++-----------------
>  include/linux/mfd/ti_am335x_tscadc.h      |   2 +-
>  4 files changed, 64 insertions(+), 97 deletions(-)
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2016-06-08 15:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31 17:00 [PATCH 0/8] TI AM335x TSC/ADC cleanup Andrew F. Davis
2016-05-31 17:00 ` [PATCH 1/8] mfd: ti_am335x_tscadc: Use SIMPLE_DEV_PM_OPS helper macro Andrew F. Davis
2016-06-08 15:35   ` Lee Jones
2016-05-31 17:00 ` [PATCH 2/8] iio: adc: ti_am335x_adc: use " Andrew F. Davis
2016-06-03 12:16   ` Jonathan Cameron
2016-05-31 17:00 ` [PATCH 3/8] mfd: ti_am335x_tscadc: Remove use of single line functions Andrew F. Davis
2016-06-08 15:35   ` Lee Jones
2016-05-31 17:00 ` [PATCH 4/8] mfd: ti_am335x_tscadc: Unify variable naming when refrencing ti_tscadc_dev Andrew F. Davis
2016-05-31 17:53   ` Dave Gerlach
2016-06-08 15:34   ` Lee Jones
2016-05-31 17:00 ` [PATCH 5/8] mfd: ti_am335x_tscadc: Rename regmap_tscadc to regmap Andrew F. Davis
2016-06-08 15:33   ` Lee Jones
2016-05-31 17:00 ` [PATCH 6/8] mfd: ti_am335x_tscadc: use variable name for sizeof() operator Andrew F. Davis
2016-06-08 15:35   ` Lee Jones
2016-05-31 17:00 ` [PATCH 7/8] iio: adc: ti_am335x_adc: use variable names " Andrew F. Davis
2016-06-03 12:15   ` Jonathan Cameron
2016-05-31 17:00 ` [PATCH 8/8] Input: ti_am335x_tsc - use variable name " Andrew F. Davis
2016-06-01 18:35   ` Dmitry Torokhov
2016-06-08 15:36 ` [PATCH 0/8] TI AM335x TSC/ADC cleanup Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).