linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marek.vasut@gmail.com (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/17] UCB1400: Pass ucb1400-gpio data through ac97 bus
Date: Wed,  3 Nov 2010 00:51:46 +0100	[thread overview]
Message-ID: <1288741914-21328-9-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1288741914-21328-1-git-send-email-marek.vasut@gmail.com>

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
 drivers/gpio/ucb1400_gpio.c |   19 ++++++-------------
 drivers/mfd/ucb1400_core.c  |    5 +++++
 include/linux/ucb1400.h     |   19 ++++++-------------
 3 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/drivers/gpio/ucb1400_gpio.c b/drivers/gpio/ucb1400_gpio.c
index 50e6bd1..fba45a5 100644
--- a/drivers/gpio/ucb1400_gpio.c
+++ b/drivers/gpio/ucb1400_gpio.c
@@ -12,8 +12,6 @@
 #include <linux/module.h>
 #include <linux/ucb1400.h>
 
-struct ucb1400_gpio_data *ucbdata;
-
 static int ucb1400_gpio_dir_in(struct gpio_chip *gc, unsigned off)
 {
 	struct ucb1400_gpio *gpio;
@@ -50,7 +48,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	struct ucb1400_gpio *ucb = dev->dev.platform_data;
 	int err = 0;
 
-	if (!(ucbdata && ucbdata->gpio_offset)) {
+	if (!(ucb && ucb->gpio_offset)) {
 		err = -EINVAL;
 		goto err;
 	}
@@ -58,7 +56,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	platform_set_drvdata(dev, ucb);
 
 	ucb->gc.label = "ucb1400_gpio";
-	ucb->gc.base = ucbdata->gpio_offset;
+	ucb->gc.base = ucb->gpio_offset;
 	ucb->gc.ngpio = 10;
 	ucb->gc.owner = THIS_MODULE;
 
@@ -72,8 +70,8 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	if (err)
 		goto err;
 
-	if (ucbdata && ucbdata->gpio_setup)
-		err = ucbdata->gpio_setup(&dev->dev, ucb->gc.ngpio);
+	if (ucb && ucb->gpio_setup)
+		err = ucb->gpio_setup(&dev->dev, ucb->gc.ngpio);
 
 err:
 	return err;
@@ -85,8 +83,8 @@ static int ucb1400_gpio_remove(struct platform_device *dev)
 	int err = 0;
 	struct ucb1400_gpio *ucb = platform_get_drvdata(dev);
 
-	if (ucbdata && ucbdata->gpio_teardown) {
-		err = ucbdata->gpio_teardown(&dev->dev, ucb->gc.ngpio);
+	if (ucb && ucb->gpio_teardown) {
+		err = ucb->gpio_teardown(&dev->dev, ucb->gc.ngpio);
 		if (err)
 			return err;
 	}
@@ -113,11 +111,6 @@ static void __exit ucb1400_gpio_exit(void)
 	platform_driver_unregister(&ucb1400_gpio_driver);
 }
 
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
-{
-	ucbdata = data;
-}
-
 module_init(ucb1400_gpio_init);
 module_exit(ucb1400_gpio_exit);
 
diff --git a/drivers/mfd/ucb1400_core.c b/drivers/mfd/ucb1400_core.c
index d73f84b..63f4969 100644
--- a/drivers/mfd/ucb1400_core.c
+++ b/drivers/mfd/ucb1400_core.c
@@ -75,6 +75,11 @@ static int ucb1400_core_probe(struct device *dev)
 
 	/* GPIO */
 	ucb_gpio.ac97 = ac97;
+	if (pdata) {
+		ucb_gpio.gpio_setup = pdata->gpio_setup;
+		ucb_gpio.gpio_teardown = pdata->gpio_teardown;
+		ucb_gpio.gpio_offset = pdata->gpio_offset;
+	}
 	ucb->ucb1400_gpio = platform_device_alloc("ucb1400_gpio", -1);
 	if (!ucb->ucb1400_gpio) {
 		err = -ENOMEM;
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 1b47909..1a6bfdd 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -83,15 +83,12 @@
 #define UCB_ID			0x7e
 #define UCB_ID_1400             0x4304
 
-struct ucb1400_gpio_data {
-	int gpio_offset;
-	int (*gpio_setup)(struct device *dev, int ngpio);
-	int (*gpio_teardown)(struct device *dev, int ngpio);
-};
-
 struct ucb1400_gpio {
 	struct gpio_chip	gc;
 	struct snd_ac97		*ac97;
+	int			gpio_offset;
+	int (*gpio_setup)(struct device *dev, int ngpio);
+	int (*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 struct ucb1400_ts {
@@ -112,6 +109,9 @@ struct ucb1400 {
 
 struct ucb1400_pdata {
 	int	irq;
+	int	gpio_offset;
+	int (*gpio_setup)(struct device *dev, int ngpio);
+	int (*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -163,11 +163,4 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
 
 unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
 			      int adcsync);
-
-#ifdef CONFIG_GPIO_UCB1400
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
-#else
-static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
-#endif
-
 #endif
-- 
1.7.2.3

  parent reply	other threads:[~2010-11-02 23:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 23:51 [PATCH 01/17] ARM: pxa: Fix missing includes Marek Vasut
2010-11-02 23:51 ` [PATCH 02/17] ARM: pxa: Access SMEMC via virtual addresses Marek Vasut
2010-11-03 14:37   ` Eric Miao
2010-11-03 15:30     ` Marek Vasut
2010-11-03 16:40       ` Russell King - ARM Linux
2010-11-03 16:48         ` Marek Vasut
2010-11-03 17:30       ` Eric Miao
2010-11-02 23:51 ` [PATCH 03/17] ARM: pxa: Toradex Colibri PXA270 CF support Marek Vasut
2010-11-03 14:44   ` Eric Miao
2010-11-02 23:51 ` [PATCH 04/17] ARM: pxa: Push Colibri evalboard MFP into module files Marek Vasut
2010-11-03 14:47   ` Eric Miao
2010-11-02 23:51 ` [PATCH 05/17] ARM: pxa: Add M41T00 RTC support into Colibri evalboard Marek Vasut
2010-11-02 23:51 ` [PATCH 06/17] ARM: pxa: Rename " Marek Vasut
2010-11-03 14:53   ` Eric Miao
2010-11-02 23:51 ` [PATCH 07/17] ARM: pxa: Colibri PXA320 PCMCIA driver Marek Vasut
2010-11-02 23:51 ` [PATCH 08/17] ARM: pxa: Modularize Palm Tungsten|C Marek Vasut
2010-11-02 23:51 ` Marek Vasut [this message]
2010-12-01  2:51   ` [PATCH 09/17] UCB1400: Pass ucb1400-gpio data through ac97 bus Eric Miao
2010-12-01  9:38     ` Samuel Ortiz
2010-11-02 23:51 ` [PATCH 10/17] ARM: pxa: Correct touch IRQ passing to UCB1400 on vpac270 Marek Vasut
2010-12-14 14:07   ` Eric Miao
2010-11-02 23:51 ` [PATCH 11/17] ARM: pxa: Pass GPIO offset to ucb1400-gpio on PalmTC Marek Vasut
2010-11-02 23:51 ` [PATCH 12/17] ARM: pxa: Add gpio-leds and vibrator support to PalmTC Marek Vasut
2010-11-02 23:51 ` [PATCH 13/17] ARM: pxa: Fix pxa2xx-flash section mismatch Marek Vasut
2010-11-02 23:51 ` [PATCH 14/17] ARM: pxa: Fix number of IRQs on Balloon3 Marek Vasut
2010-11-02 23:51 ` [PATCH 15/17] ARM: pxa: Update Balloon3 for new FPGA firmware Marek Vasut
2010-11-02 23:51 ` [PATCH 16/17] SND: Tosa: Fix pointer to codec location Marek Vasut
2010-11-02 23:51 ` [PATCH 17/17] ARM: pxa/colibri: setup pins for USB host port 3 Marek Vasut
2010-11-03 13:33 ` [PATCH 01/17] ARM: pxa: Fix missing includes Eric Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288741914-21328-9-git-send-email-marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).