Skip to contentSkip to conversation

input/mfd/ucb1400: move static function from header to its user

PATCH NAK Sebastian Andrzej Siewior 3 participants 5 messages Jan 8, 2009 – Jan 12, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input/mfd/ucb1400: move static function from header to its user

it's a little too large for static line and just static is somehow ....

---
The only user I've seen is ts driver.

 drivers/input/touchscreen/ucb1400_ts.c |   19 +++++++++++++++++++
 include/linux/ucb1400.h                |   19 -------------------
 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/input/touchscreen/ucb1400_ts.c +19 -0
index 1647bc4..f2377a2 100644
@@ -44,6 +44,25 @@ static inline void ucb1400_ts_mode_int(struct snd_ac97 *ac97)
 			UCB_TS_CR_MODE_INT);
 }
 
+static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
+		int adcsync)
+{
+	unsigned int val;
+
+	if (adcsync)
+		adc_channel |= UCB_ADC_SYNC_ENA;
+
+	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
+	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
+			UCB_ADC_START);
+
+	while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
+				& UCB_ADC_DAT_VALID))
+		schedule_timeout_uninterruptible(1);
+
+	return val & UCB_ADC_DAT_MASK;
+}
+
 /*
  * Switch to pressure mode, and read pressure.  We don't need to wait
  * here, since both plates are being driven.
include/linux/ucb1400.h +0 -19
index 970473b..bf4f547 100644
@@ -134,25 +134,6 @@ static inline void ucb1400_adc_enable(struct snd_ac97 *ac97)
 	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA);
 }
 
-static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
-					int adcsync)
-{
-	unsigned int val;
-
-	if (adcsync)
-		adc_channel |= UCB_ADC_SYNC_ENA;
-
-	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
-	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
-				UCB_ADC_START);
-
-	while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
-			& UCB_ADC_DAT_VALID))
-		schedule_timeout_uninterruptible(1);
-
-	return val & UCB_ADC_DAT_MASK;
-}
-
 static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
 {
 	ucb1400_reg_write(ac97, UCB_ADC_CR, 0);
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 5 lines · On Thursday 08 of January 2009 12:07:57 Sebastian Andrzej Siewior wrote:

it's a little too large for static line and just static is somehow ....

---
The only user I've seen is ts driver.

NAK, this is used by the battery as well (which is not merged yet, see ARM linux mailing list for it)

Quoted 65 lines
 drivers/input/touchscreen/ucb1400_ts.c |   19 +++++++++++++++++++
 include/linux/ucb1400.h                |   19 -------------------
 2 files changed, 19 insertions(+), 19 deletions(-)
(quoted diff) +0 -0

b/drivers/input/touchscreen/ucb1400_ts.c index 1647bc4..f2377a2 100644

drivers/input/touchscreen/ucb1400_ts.c +18 -0
@@ -44,6 +44,25 @@ static inline void ucb1400_ts_mode_int(struct snd_ac97
 *ac97) UCB_TS_CR_MODE_INT);
 }
 
+static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16
 adc_channel, +		int adcsync)
+{
+	unsigned int val;
+
+	if (adcsync)
+		adc_channel |= UCB_ADC_SYNC_ENA;
+
+	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
+	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
+			UCB_ADC_START);
+
+	while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
+				& UCB_ADC_DAT_VALID))
+		schedule_timeout_uninterruptible(1);
+
+	return val & UCB_ADC_DAT_MASK;
+}
+
 /*
  * Switch to pressure mode, and read pressure.  We don't need to wait
  * here, since both plates are being driven.
include/linux/ucb1400.h +0 -18
index 970473b..bf4f547 100644
@@ -134,25 +134,6 @@ static inline void ucb1400_adc_enable(struct snd_ac97
 *ac97) ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA);
 }
 
-static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16
 adc_channel, -					int adcsync)
-{
-	unsigned int val;
-
-	if (adcsync)
-		adc_channel |= UCB_ADC_SYNC_ENA;
-
-	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
-	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
-				UCB_ADC_START);
-
-	while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
-			& UCB_ADC_DAT_VALID))
-		schedule_timeout_uninterruptible(1);
-
-	return val & UCB_ADC_DAT_MASK;
-}
-
 static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
 {
 	ucb1400_reg_write(ac97, UCB_ADC_CR, 0);
#2 lore raw
Quoted 8 lines · Marek Vasut
Quoted 5 lines · On Thursday 08 of January 2009 12:07:57 Sebastian Andrzej Siewior wrote:

it's a little too large for static line and just static is somehow ....

---
The only user I've seen is ts driver.

NAK, this is used by the battery as well (which is not merged yet, see ARM linux mailing list for it)

It is not merged :) And this also in .v28.
Would you prefer me to move this function into the core instead ?

Sebastian

maintainer
#3 lore raw
Quoted 8 lines · Sebastian Andrzej Siewior
Quoted 7 lines · Marek Vasut
Quoted 5 lines · On Thursday 08 of January 2009 12:07:57 Sebastian Andrzej Siewior wrote:

it's a little too large for static line and just static is somehow ....

---
The only user I've seen is ts driver.

Quoted 6 lines
Quoted 2 lines

NAK, this is used by the battery as well (which is not merged yet, see ARM linux mailing list for it)

It is not merged :) And this also in .v28.
Would you prefer me to move this function into the core instead ?

Yes, core seems to be more appropriate.

Thanks.

Signature · 1 line
Dmitry
#4 lore raw

PATCH 1/1 input/mfd/ucb1400: move static function from header into core

it's a little too large for static line.
The ts is currently the only mainline user but Marek Vasut claims that there is a battery driver in an ARM tree which also needs this function.

---
 drivers/mfd/ucb1400_core.c |   20 ++++++++++++++++++++
 include/linux/ucb1400.h    |   20 ++------------------
 2 files changed, 22 insertions(+), 18 deletions(-)
drivers/mfd/ucb1400_core.c +20 -0
index 88f33c1..3a89e7f 100644
@@ -23,6 +23,26 @@
 #include <linux/module.h>
 #include <linux/ucb1400.h>
 
+unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
+		int adcsync)
+{
+	unsigned int val;
+
+	if (adcsync)
+		adc_channel |= UCB_ADC_SYNC_ENA;
+
+	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
+	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
+			UCB_ADC_START);
+
+	while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
+				& UCB_ADC_DAT_VALID))
+		schedule_timeout_uninterruptible(1);
+
+	return val & UCB_ADC_DAT_MASK;
+}
+EXPORT_SYMBOL_GPL(ucb1400_adc_read);
+
 static int ucb1400_core_probe(struct device *dev)
 {
 	int err;
include/linux/ucb1400.h +2 -18
index 970473b..1b0840d 100644
@@ -134,24 +134,8 @@ static inline void ucb1400_adc_enable(struct snd_ac97 *ac97)
 	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA);
 }
 
-static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
-					int adcsync)
-{
-	unsigned int val;
-
-	if (adcsync)
-		adc_channel |= UCB_ADC_SYNC_ENA;
-
-	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
-	ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
-				UCB_ADC_START);
-
-	while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
-			& UCB_ADC_DAT_VALID))
-		schedule_timeout_uninterruptible(1);
-
-	return val & UCB_ADC_DAT_MASK;
-}
+unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
+		int adcsync);
 
 static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
 {
Signature · 1 line
1.5.6.5