Commit 503c10d8 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Jaroslav Kysela

ALSA: opl3sa2: drop snd_card pointer from the snd_opl3sa2 structure

Remove card pointer from the snd_opl3sa2
structure and break circular reference
snd_card->snd_opl3sa2->snd_card.
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Acked-by: default avatarRene Herman <rene.herman@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 862f76f8
...@@ -124,7 +124,6 @@ static int pnpc_registered; ...@@ -124,7 +124,6 @@ static int pnpc_registered;
#define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX) #define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX)
struct snd_opl3sa2 { struct snd_opl3sa2 {
struct snd_card *card;
int version; /* 2 or 3 */ int version; /* 2 or 3 */
unsigned long port; /* control port */ unsigned long port; /* control port */
struct resource *res_port; /* control port resource */ struct resource *res_port; /* control port resource */
...@@ -222,14 +221,13 @@ static void snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsig ...@@ -222,14 +221,13 @@ static void snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsig
spin_unlock_irqrestore(&chip->reg_lock, flags); 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;
unsigned long port; unsigned long port;
unsigned char tmp, tmp1; unsigned char tmp, tmp1;
char str[2]; char str[2];
card = chip->card;
port = chip->port; port = chip->port;
if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) {
snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port);
...@@ -298,12 +296,14 @@ static int __devinit snd_opl3sa2_detect(struct snd_opl3sa2 *chip) ...@@ -298,12 +296,14 @@ static int __devinit snd_opl3sa2_detect(struct snd_opl3sa2 *chip)
static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id)
{ {
unsigned short status; unsigned short status;
struct snd_opl3sa2 *chip = dev_id; struct snd_card *card = dev_id;
struct snd_opl3sa2 *chip;
int handled = 0; int handled = 0;
if (chip == NULL || chip->card == NULL) if (card == NULL || card->private_data == NULL)
return IRQ_NONE; return IRQ_NONE;
chip = card->private_data;
status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS); status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS);
if (status & 0x20) { if (status & 0x20) {
...@@ -327,8 +327,10 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) ...@@ -327,8 +327,10 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id)
snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT); snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT);
snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT); snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT);
if (chip->master_switch && chip->master_volume) { if (chip->master_switch && chip->master_volume) {
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); &chip->master_switch->id);
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
&chip->master_volume->id);
} }
} }
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
...@@ -512,9 +514,9 @@ static void snd_opl3sa2_master_free(struct snd_kcontrol *kcontrol) ...@@ -512,9 +514,9 @@ static void snd_opl3sa2_master_free(struct snd_kcontrol *kcontrol)
chip->master_volume = NULL; chip->master_volume = NULL;
} }
static int __devinit snd_opl3sa2_mixer(struct snd_opl3sa2 *chip) static int __devinit snd_opl3sa2_mixer(struct snd_card *card)
{ {
struct snd_card *card = chip->card; struct snd_opl3sa2 *chip = card->private_data;
struct snd_ctl_elem_id id1, id2; struct snd_ctl_elem_id id1, id2;
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
unsigned int idx; unsigned int idx;
...@@ -650,7 +652,6 @@ static struct snd_card *snd_opl3sa2_card_new(int dev) ...@@ -650,7 +652,6 @@ static struct snd_card *snd_opl3sa2_card_new(int dev)
chip = card->private_data; chip = card->private_data;
spin_lock_init(&chip->reg_lock); spin_lock_init(&chip->reg_lock);
chip->irq = -1; chip->irq = -1;
chip->card = card;
card->private_free = snd_opl3sa2_free; card->private_free = snd_opl3sa2_free;
return card; return card;
} }
...@@ -672,9 +673,12 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) ...@@ -672,9 +673,12 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
xdma2 = dma2[dev]; xdma2 = dma2[dev];
if (xdma2 < 0) if (xdma2 < 0)
chip->single_dma = 1; chip->single_dma = 1;
if ((err = snd_opl3sa2_detect(chip)) < 0) err = snd_opl3sa2_detect(card);
if (err < 0)
return err; return err;
if (request_irq(xirq, snd_opl3sa2_interrupt, IRQF_DISABLED, "OPL3-SA2", chip)) { err = request_irq(xirq, snd_opl3sa2_interrupt, IRQF_DISABLED,
"OPL3-SA2", card);
if (err) {
snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq); snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq);
return -ENODEV; return -ENODEV;
} }
...@@ -694,7 +698,8 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) ...@@ -694,7 +698,8 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
err = snd_wss_mixer(wss); err = snd_wss_mixer(wss);
if (err < 0) if (err < 0)
return err; return err;
if ((err = snd_opl3sa2_mixer(chip)) < 0) err = snd_opl3sa2_mixer(card);
if (err < 0)
return err; return err;
err = snd_wss_timer(wss, 0, NULL); err = snd_wss_timer(wss, 0, NULL);
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment