diff options
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/ad1816a/ad1816a.c | 38 | ||||
-rw-r--r-- | sound/isa/ad1816a/ad1816a_lib.c | 10 |
2 files changed, 13 insertions, 35 deletions
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 94b83b6e46a3..1a374e61ab2b 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c | |||
@@ -63,11 +63,6 @@ MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard."); | |||
63 | module_param_array(clockfreq, int, NULL, 0444); | 63 | module_param_array(clockfreq, int, NULL, 0444); |
64 | MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); | 64 | MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); |
65 | 65 | ||
66 | struct snd_card_ad1816a { | ||
67 | struct pnp_dev *dev; | ||
68 | struct pnp_dev *devmpu; | ||
69 | }; | ||
70 | |||
71 | static struct pnp_card_device_id snd_ad1816a_pnpids[] = { | 66 | static struct pnp_card_device_id snd_ad1816a_pnpids[] = { |
72 | /* Analog Devices AD1815 */ | 67 | /* Analog Devices AD1815 */ |
73 | { .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } }, | 68 | { .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } }, |
@@ -99,25 +94,16 @@ MODULE_DEVICE_TABLE(pnp_card, snd_ad1816a_pnpids); | |||
99 | #define DRIVER_NAME "snd-card-ad1816a" | 94 | #define DRIVER_NAME "snd-card-ad1816a" |
100 | 95 | ||
101 | 96 | ||
102 | static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acard, | 97 | static int __devinit snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card, |
103 | struct pnp_card_link *card, | ||
104 | const struct pnp_card_device_id *id) | 98 | const struct pnp_card_device_id *id) |
105 | { | 99 | { |
106 | struct pnp_dev *pdev; | 100 | struct pnp_dev *pdev; |
107 | int err; | 101 | int err; |
108 | 102 | ||
109 | acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); | 103 | pdev = pnp_request_card_device(card, id->devs[0].id, NULL); |
110 | if (acard->dev == NULL) | 104 | if (pdev == NULL) |
111 | return -EBUSY; | 105 | return -EBUSY; |
112 | 106 | ||
113 | acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); | ||
114 | if (acard->devmpu == NULL) { | ||
115 | mpu_port[dev] = -1; | ||
116 | snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); | ||
117 | } | ||
118 | |||
119 | pdev = acard->dev; | ||
120 | |||
121 | err = pnp_activate_dev(pdev); | 107 | err = pnp_activate_dev(pdev); |
122 | if (err < 0) { | 108 | if (err < 0) { |
123 | printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); | 109 | printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); |
@@ -130,16 +116,17 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar | |||
130 | dma2[dev] = pnp_dma(pdev, 1); | 116 | dma2[dev] = pnp_dma(pdev, 1); |
131 | irq[dev] = pnp_irq(pdev, 0); | 117 | irq[dev] = pnp_irq(pdev, 0); |
132 | 118 | ||
133 | if (acard->devmpu == NULL) | 119 | pdev = pnp_request_card_device(card, id->devs[1].id, NULL); |
120 | if (pdev == NULL) { | ||
121 | mpu_port[dev] = -1; | ||
122 | snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); | ||
134 | return 0; | 123 | return 0; |
135 | 124 | } | |
136 | pdev = acard->devmpu; | ||
137 | 125 | ||
138 | err = pnp_activate_dev(pdev); | 126 | err = pnp_activate_dev(pdev); |
139 | if (err < 0) { | 127 | if (err < 0) { |
140 | printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); | 128 | printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); |
141 | mpu_port[dev] = -1; | 129 | mpu_port[dev] = -1; |
142 | acard->devmpu = NULL; | ||
143 | } else { | 130 | } else { |
144 | mpu_port[dev] = pnp_port_start(pdev, 0); | 131 | mpu_port[dev] = pnp_port_start(pdev, 0); |
145 | mpu_irq[dev] = pnp_irq(pdev, 0); | 132 | mpu_irq[dev] = pnp_irq(pdev, 0); |
@@ -153,18 +140,17 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard | |||
153 | { | 140 | { |
154 | int error; | 141 | int error; |
155 | struct snd_card *card; | 142 | struct snd_card *card; |
156 | struct snd_card_ad1816a *acard; | ||
157 | struct snd_ad1816a *chip; | 143 | struct snd_ad1816a *chip; |
158 | struct snd_opl3 *opl3; | 144 | struct snd_opl3 *opl3; |
159 | struct snd_timer *timer; | 145 | struct snd_timer *timer; |
160 | 146 | ||
161 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, | 147 | error = snd_card_create(index[dev], id[dev], THIS_MODULE, |
162 | sizeof(struct snd_card_ad1816a), &card); | 148 | sizeof(struct snd_ad1816a), &card); |
163 | if (error < 0) | 149 | if (error < 0) |
164 | return error; | 150 | return error; |
165 | acard = card->private_data; | 151 | chip = card->private_data; |
166 | 152 | ||
167 | if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { | 153 | if ((error = snd_card_ad1816a_pnp(dev, pcard, pid))) { |
168 | snd_card_free(card); | 154 | snd_card_free(card); |
169 | return error; | 155 | return error; |
170 | } | 156 | } |
@@ -174,7 +160,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard | |||
174 | irq[dev], | 160 | irq[dev], |
175 | dma1[dev], | 161 | dma1[dev], |
176 | dma2[dev], | 162 | dma2[dev], |
177 | &chip)) < 0) { | 163 | chip)) < 0) { |
178 | snd_card_free(card); | 164 | snd_card_free(card); |
179 | return error; | 165 | return error; |
180 | } | 166 | } |
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 177eed3271bc..de5cc1c26279 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c | |||
@@ -548,7 +548,6 @@ static int snd_ad1816a_free(struct snd_ad1816a *chip) | |||
548 | snd_dma_disable(chip->dma2); | 548 | snd_dma_disable(chip->dma2); |
549 | free_dma(chip->dma2); | 549 | free_dma(chip->dma2); |
550 | } | 550 | } |
551 | kfree(chip); | ||
552 | return 0; | 551 | return 0; |
553 | } | 552 | } |
554 | 553 | ||
@@ -573,19 +572,13 @@ static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip) | |||
573 | 572 | ||
574 | int __devinit snd_ad1816a_create(struct snd_card *card, | 573 | int __devinit snd_ad1816a_create(struct snd_card *card, |
575 | unsigned long port, int irq, int dma1, int dma2, | 574 | unsigned long port, int irq, int dma1, int dma2, |
576 | struct snd_ad1816a **rchip) | 575 | struct snd_ad1816a *chip) |
577 | { | 576 | { |
578 | static struct snd_device_ops ops = { | 577 | static struct snd_device_ops ops = { |
579 | .dev_free = snd_ad1816a_dev_free, | 578 | .dev_free = snd_ad1816a_dev_free, |
580 | }; | 579 | }; |
581 | int error; | 580 | int error; |
582 | struct snd_ad1816a *chip; | ||
583 | 581 | ||
584 | *rchip = NULL; | ||
585 | |||
586 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
587 | if (chip == NULL) | ||
588 | return -ENOMEM; | ||
589 | chip->irq = -1; | 582 | chip->irq = -1; |
590 | chip->dma1 = -1; | 583 | chip->dma1 = -1; |
591 | chip->dma2 = -1; | 584 | chip->dma2 = -1; |
@@ -631,7 +624,6 @@ int __devinit snd_ad1816a_create(struct snd_card *card, | |||
631 | return error; | 624 | return error; |
632 | } | 625 | } |
633 | 626 | ||
634 | *rchip = chip; | ||
635 | return 0; | 627 | return 0; |
636 | } | 628 | } |
637 | 629 | ||