diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2008-08-17 14:01:14 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-25 03:57:03 -0400 |
commit | 503c10d8a7dd3aa627dc57990c95a8a4dd4fa4b5 (patch) | |
tree | 96b05f1eb297384d9eea534f0b5c4bdf792abf68 | |
parent | 862f76f86d64c2cf34a7ff5ddf0a175073b76534 (diff) |
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: Krzysztof Helt <krzysztof.h1@wp.pl>
Acked-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | sound/isa/opl3sa2.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 949fee5cd070..1ac29270a402 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -124,7 +124,6 @@ static int pnpc_registered; | |||
124 | #define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX) | 124 | #define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX) |
125 | 125 | ||
126 | struct snd_opl3sa2 { | 126 | struct snd_opl3sa2 { |
127 | struct snd_card *card; | ||
128 | int version; /* 2 or 3 */ | 127 | int version; /* 2 or 3 */ |
129 | unsigned long port; /* control port */ | 128 | unsigned long port; /* control port */ |
130 | struct resource *res_port; /* control port resource */ | 129 | 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 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 221 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
223 | } | 222 | } |
224 | 223 | ||
225 | static int __devinit snd_opl3sa2_detect(struct snd_opl3sa2 *chip) | 224 | static int __devinit snd_opl3sa2_detect(struct snd_card *card) |
226 | { | 225 | { |
227 | struct snd_card *card; | 226 | struct snd_opl3sa2 *chip = card->private_data; |
228 | unsigned long port; | 227 | unsigned long port; |
229 | unsigned char tmp, tmp1; | 228 | unsigned char tmp, tmp1; |
230 | char str[2]; | 229 | char str[2]; |
231 | 230 | ||
232 | card = chip->card; | ||
233 | port = chip->port; | 231 | port = chip->port; |
234 | if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { | 232 | if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { |
235 | snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); | 233 | 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 | static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) | 296 | static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) |
299 | { | 297 | { |
300 | unsigned short status; | 298 | unsigned short status; |
301 | struct snd_opl3sa2 *chip = dev_id; | 299 | struct snd_card *card = dev_id; |
300 | struct snd_opl3sa2 *chip; | ||
302 | int handled = 0; | 301 | int handled = 0; |
303 | 302 | ||
304 | if (chip == NULL || chip->card == NULL) | 303 | if (card == NULL || card->private_data == NULL) |
305 | return IRQ_NONE; | 304 | return IRQ_NONE; |
306 | 305 | ||
306 | chip = card->private_data; | ||
307 | status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS); | 307 | status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS); |
308 | 308 | ||
309 | if (status & 0x20) { | 309 | if (status & 0x20) { |
@@ -327,8 +327,10 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) | |||
327 | snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT); | 327 | snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT); |
328 | snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT); | 328 | snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT); |
329 | if (chip->master_switch && chip->master_volume) { | 329 | if (chip->master_switch && chip->master_volume) { |
330 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); | 330 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, |
331 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); | 331 | &chip->master_switch->id); |
332 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
333 | &chip->master_volume->id); | ||
332 | } | 334 | } |
333 | } | 335 | } |
334 | return IRQ_RETVAL(handled); | 336 | return IRQ_RETVAL(handled); |
@@ -512,9 +514,9 @@ static void snd_opl3sa2_master_free(struct snd_kcontrol *kcontrol) | |||
512 | chip->master_volume = NULL; | 514 | chip->master_volume = NULL; |
513 | } | 515 | } |
514 | 516 | ||
515 | static int __devinit snd_opl3sa2_mixer(struct snd_opl3sa2 *chip) | 517 | static int __devinit snd_opl3sa2_mixer(struct snd_card *card) |
516 | { | 518 | { |
517 | struct snd_card *card = chip->card; | 519 | struct snd_opl3sa2 *chip = card->private_data; |
518 | struct snd_ctl_elem_id id1, id2; | 520 | struct snd_ctl_elem_id id1, id2; |
519 | struct snd_kcontrol *kctl; | 521 | struct snd_kcontrol *kctl; |
520 | unsigned int idx; | 522 | unsigned int idx; |
@@ -650,7 +652,6 @@ static struct snd_card *snd_opl3sa2_card_new(int dev) | |||
650 | chip = card->private_data; | 652 | chip = card->private_data; |
651 | spin_lock_init(&chip->reg_lock); | 653 | spin_lock_init(&chip->reg_lock); |
652 | chip->irq = -1; | 654 | chip->irq = -1; |
653 | chip->card = card; | ||
654 | card->private_free = snd_opl3sa2_free; | 655 | card->private_free = snd_opl3sa2_free; |
655 | return card; | 656 | return card; |
656 | } | 657 | } |
@@ -672,9 +673,12 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) | |||
672 | xdma2 = dma2[dev]; | 673 | xdma2 = dma2[dev]; |
673 | if (xdma2 < 0) | 674 | if (xdma2 < 0) |
674 | chip->single_dma = 1; | 675 | chip->single_dma = 1; |
675 | if ((err = snd_opl3sa2_detect(chip)) < 0) | 676 | err = snd_opl3sa2_detect(card); |
677 | if (err < 0) | ||
676 | return err; | 678 | return err; |
677 | if (request_irq(xirq, snd_opl3sa2_interrupt, IRQF_DISABLED, "OPL3-SA2", chip)) { | 679 | err = request_irq(xirq, snd_opl3sa2_interrupt, IRQF_DISABLED, |
680 | "OPL3-SA2", card); | ||
681 | if (err) { | ||
678 | snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq); | 682 | snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq); |
679 | return -ENODEV; | 683 | return -ENODEV; |
680 | } | 684 | } |
@@ -694,7 +698,8 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) | |||
694 | err = snd_wss_mixer(wss); | 698 | err = snd_wss_mixer(wss); |
695 | if (err < 0) | 699 | if (err < 0) |
696 | return err; | 700 | return err; |
697 | if ((err = snd_opl3sa2_mixer(chip)) < 0) | 701 | err = snd_opl3sa2_mixer(card); |
702 | if (err < 0) | ||
698 | return err; | 703 | return err; |
699 | err = snd_wss_timer(wss, 0, NULL); | 704 | err = snd_wss_timer(wss, 0, NULL); |
700 | if (err < 0) | 705 | if (err < 0) |