[alsa-devel] [RFC / PATCH] [SOUND] add a private field for ac97-device drivers and let ucb1400 be its first user

Sebastian Siewior al+sa at ml.breakpoint.cc
Thu Apr 24 17:37:53 CEST 2008


From: Sebastian Siewior <bigeasy at linutronix.de>

Currently the UCB1400 driver discovers the interrupt via probing. This works
probably only on x86. This patch adds a private field to the ac97 struct
where the ac97 driver can deposit informations for the device driver that
serves a device which is attached to the ac97 bus.
This patch also converts the UCB1400 driver to use this information if available.

Signed-off-by: Sebastian Siewior <bigeasy at linutronix.de>
---
 drivers/input/touchscreen/ucb1400_ts.c |   12 ++++++++----
 include/sound/ac97_codec.h             |    4 ++++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 5ee175e..531fb4b 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -494,10 +494,14 @@ static int ucb1400_ts_probe(struct device *dev)
 		goto err_free_devs;
 	}
 
-	error = ucb1400_detect_irq(ucb);
-	if (error) {
-		printk(KERN_ERR "UCB1400: IRQ probe failed\n");
-		goto err_free_devs;
+	if (!ucb->ac97->device_private_data) {
+		error = ucb1400_detect_irq(ucb);
+		if (error) {
+			printk(KERN_ERR "UCB1400: IRQ probe failed\n");
+			goto err_free_devs;
+		}
+	} else {
+		ucb->irq = (int) ucb->ac97->device_private_data;
 	}
 
 	error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING,
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 0148058..b1af896 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -474,6 +474,10 @@ struct snd_ac97 {
 	struct snd_ac97_build_ops * build_ops;
 	void *private_data;
 	void (*private_free) (struct snd_ac97 *ac97);
+	/* This field is used by device drivers which serve devices which are
+	 * attached to the AC97 bus.
+	 */
+	void *device_private_data;
 	/* --- */
 	struct snd_ac97_bus *bus;
 	struct pci_dev *pci;	/* assigned PCI device - used for quirks */
-- 
1.5.4.3



More information about the Alsa-devel mailing list