Krzysztof Helt | 17 Aug 19:59
Favicon

[PATCH] opl3sa2: drop snd_card pointer from the snd_opl3sa2 structure

From: Krzysztof Helt <krzysztof.h1 <at> wp.pl>

Remove card pointer from the snd_opl3sa2
structure and break circular reference
snd_card->snd_opl3sa2->snd_card.

Signed-off-by: Krzysztof Helt <krzysztof.h1 <at> wp.pl>
---
A very small opl3sa2 clean up.

diff -urp linux-ref/sound/isa/opl3sa2.c linux-2.6/sound/isa/opl3sa2.c
--- linux-ref/sound/isa/opl3sa2.c	2008-08-14 00:05:30.000000000 +0200
+++ linux-2.6/sound/isa/opl3sa2.c	2008-08-15 12:30:58.000000000 +0200
@@ -124,7 +124,6 @@ static int pnpc_registered;
 #define OPL3SA2_PM_D3	(OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX)

 struct snd_opl3sa2 {
-	struct snd_card *card;
 	int version;		/* 2 or 3 */
 	unsigned long port;	/* control port */
 	struct resource *res_port; /* control port resource */
@@ -222,14 +221,13 @@ static void snd_opl3sa2_write(struct snd
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 }

-static int __devinit snd_opl3sa2_detect(struct snd_opl3sa2 *chip)
+static int __devinit snd_opl3sa2_detect(struct snd_card *card)
 {
-	struct snd_card *card;
+	struct snd_opl3sa2 *chip = card->private_data;
(Continue reading)

Rene Herman | 17 Aug 20:26

Re: [PATCH] opl3sa2: drop snd_card pointer from the snd_opl3sa2 structure

On 17-08-08 20:01, Krzysztof Helt wrote:

> From: Krzysztof Helt <krzysztof.h1 <at> wp.pl>
> 
> Remove card pointer from the snd_opl3sa2
> structure and break circular reference
> snd_card->snd_opl3sa2->snd_card.
> 
> Signed-off-by: Krzysztof Helt <krzysztof.h1 <at> wp.pl>

Acked-by: Rene Herman <rene.herman <at> gmail.com>

Note, you had me worried for a bit as you reminded me I still have a 
patch pending to pass the card->dev to snd_pcm_preallocate_pages() in 
order to stop using the magic "NULL dev means ISA" behaviour in the DMA 
layer (meaning we need a chip->card) but this "chip" isn't in fact "a 
chip" so fine here.

> @@ -298,12 +296,14 @@ static int __devinit snd_opl3sa2_detect(
>  static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id)
>  {
>  	unsigned short status;
> -	struct snd_opl3sa2 *chip = dev_id;
> +	struct snd_card *card = dev_id;
> +	struct snd_opl3sa2 *chip;
>  	int handled = 0;
>  
> -	if (chip == NULL || chip->card == NULL)
> +	if (card == NULL || card->private_data == NULL)

(Continue reading)

Krzysztof Helt | 17 Aug 22:39
Favicon

Re: [PATCH] opl3sa2: drop snd_card pointer from the snd_opl3sa2 structure

On Sun, 17 Aug 2008 20:26:10 +0200
Rene Herman <rene.herman <at> keyaccess.nl> wrote:

> > @@ -298,12 +296,14 @@ static int __devinit snd_opl3sa2_detect(
> >  static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id)
> >  {
> >  	unsigned short status;
> > -	struct snd_opl3sa2 *chip = dev_id;
> > +	struct snd_card *card = dev_id;
> > +	struct snd_opl3sa2 *chip;
> >  	int handled = 0;
> >  
> > -	if (chip == NULL || chip->card == NULL)
> > +	if (card == NULL || card->private_data == NULL)
> 
> micro-comment: card->private_data can't actually be NULL on initialized 
> card (it's card + n) but yes, I guess we're pretending we don't know that...
> 

Right. The next opl3sa2 patch will fix this.

Regards,
Krzysztof

----------------------------------------------------------------------
Farmerzy tez maja Olimpiade!
Sprawdz >> http://link.interia.pl/f1edd

Gmane