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

Takashi Iwai tiwai at suse.de
Fri Apr 25 08:41:26 CEST 2008


At Fri, 25 Apr 2008 08:29:08 +0200 (CEST),
Jaroslav Kysela wrote:
> 
> 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 <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>

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

> 
> diff -r 9c74d781f388 -r e2ff47e8771b include/ac97_codec.h
> --- a/include/ac97_codec.h	Fri Apr 25 08:15:12 2008 +0200
> +++ b/include/ac97_codec.h	Fri Apr 25 08:29:05 2008 +0200
> @@ -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
> --- a/kernel/drivers/input/touchscreen/ucb1400_ts.c	Fri Apr 25 08:15:12 2008 +0200
> +++ b/kernel/drivers/input/touchscreen/ucb1400_ts.c	Fri Apr 25 08:29:05 2008 +0200
> @@ -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
> Alsa-cvslog at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-cvslog
> 


More information about the Alsa-devel mailing list