Skip to contentSkip to conversation

alsa-kernel: add a private field for ac97-device drivers and let ucb1400 be its first user

alsa-cvslog Takashi Iwai 1 participant 1 message Apr 25, 2008 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

At Fri, 25 Apr 2008 08:29:08 +0200 (CEST),

Quoted 10 lines · Jaroslav Kysela
changeset:   6120:e2ff47e8771b
tag:         tip
user:        perex
date:        Fri Apr 25 08:29:05 2008 +0200
files:       include/ac97_codec.h kernel/drivers/input/touchscreen/ucb1400_ts.c

description:
add a private field for ac97-device drivers and let ucb1400 be its first user
From: Sebastian Siewior <[email protected]>

Quoted 8 lines

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.

Jaroslav, as I posted yesterday, I don't think it's good to use a void pointer blindly there. In this case, it's different from a normal private_data, which is asigned and used by the same driver. This is a data passed by ac97 controller driver to another device driver. Thus, it should be a strong type.

Also, a cast from a pointer to an int causes a compile warning.

So, could you revert it until all issues are solved?

thanks,

Takashi

Quoted 49 lines

diff -r 9c74d781f388 -r e2ff47e8771b include/ac97_codec.h

include/ac97_codec.h +4 -0
@@ -475,6 +475,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 */

diff -r 9c74d781f388 -r e2ff47e8771b kernel/drivers/input/touchscreen/ucb1400_ts.c

kernel/drivers/input/touchscreen/ucb1400_ts.c +8 -5
@@ -492,10 +492,14 @@ static int ucb1400_ts_probe(struct devic
 		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,
 
 
-------------------------------------------------------------------------

This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Alsa-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog