aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/ad1816a/ad1816a.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/ad1816a/ad1816a.c')
-rw-r--r--sound/isa/ad1816a/ad1816a.c53
1 files changed, 5 insertions, 48 deletions
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index fc88a31da6f5..994bc85376c1 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -61,20 +61,6 @@ module_param_array(id, charp, NULL, 0444);
61MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard."); 61MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard.");
62module_param_array(enable, bool, NULL, 0444); 62module_param_array(enable, bool, NULL, 0444);
63MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard."); 63MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard.");
64module_param_array(port, long, NULL, 0444);
65MODULE_PARM_DESC(port, "Port # for ad1816a driver.");
66module_param_array(mpu_port, long, NULL, 0444);
67MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ad1816a driver.");
68module_param_array(fm_port, long, NULL, 0444);
69MODULE_PARM_DESC(fm_port, "FM port # for ad1816a driver.");
70module_param_array(irq, int, NULL, 0444);
71MODULE_PARM_DESC(irq, "IRQ # for ad1816a driver.");
72module_param_array(mpu_irq, int, NULL, 0444);
73MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ad1816a driver.");
74module_param_array(dma1, int, NULL, 0444);
75MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver.");
76module_param_array(dma2, int, NULL, 0444);
77MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver.");
78module_param_array(clockfreq, int, NULL, 0444); 64module_param_array(clockfreq, int, NULL, 0444);
79MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); 65MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0).");
80 66
@@ -117,16 +103,12 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
117 const struct pnp_card_device_id *id) 103 const struct pnp_card_device_id *id)
118{ 104{
119 struct pnp_dev *pdev; 105 struct pnp_dev *pdev;
120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
121 int err; 106 int err;
122 107
123 if (!cfg)
124 return -ENOMEM;
125 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 108 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
126 if (acard->dev == NULL) { 109 if (acard->dev == NULL)
127 kfree(cfg);
128 return -EBUSY; 110 return -EBUSY;
129 } 111
130 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); 112 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);
131 if (acard->devmpu == NULL) { 113 if (acard->devmpu == NULL) {
132 mpu_port[dev] = -1; 114 mpu_port[dev] = -1;
@@ -134,25 +116,10 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
134 } 116 }
135 117
136 pdev = acard->dev; 118 pdev = acard->dev;
137 pnp_init_resource_table(cfg); 119
138
139 if (port[dev] != SNDRV_AUTO_PORT)
140 pnp_resource_change(&cfg->port_resource[2], port[dev], 16);
141 if (fm_port[dev] != SNDRV_AUTO_PORT)
142 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
143 if (dma1[dev] != SNDRV_AUTO_DMA)
144 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
145 if (dma2[dev] != SNDRV_AUTO_DMA)
146 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
147 if (irq[dev] != SNDRV_AUTO_IRQ)
148 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
149
150 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
151 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
152 err = pnp_activate_dev(pdev); 120 err = pnp_activate_dev(pdev);
153 if (err < 0) { 121 if (err < 0) {
154 printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); 122 printk(KERN_ERR PFX "AUDIO PnP configure failure\n");
155 kfree(cfg);
156 return -EBUSY; 123 return -EBUSY;
157 } 124 }
158 125
@@ -162,20 +129,11 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
162 dma2[dev] = pnp_dma(pdev, 1); 129 dma2[dev] = pnp_dma(pdev, 1);
163 irq[dev] = pnp_irq(pdev, 0); 130 irq[dev] = pnp_irq(pdev, 0);
164 131
165 if (acard->devmpu == NULL) { 132 if (acard->devmpu == NULL)
166 kfree(cfg);
167 return 0; 133 return 0;
168 }
169 pdev = acard->devmpu;
170 pnp_init_resource_table(cfg);
171 134
172 if (mpu_port[dev] != SNDRV_AUTO_PORT) 135 pdev = acard->devmpu;
173 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
174 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
175 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
176 136
177 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
178 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
179 err = pnp_activate_dev(pdev); 137 err = pnp_activate_dev(pdev);
180 if (err < 0) { 138 if (err < 0) {
181 printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); 139 printk(KERN_ERR PFX "MPU401 PnP configure failure\n");
@@ -186,7 +144,6 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
186 mpu_irq[dev] = pnp_irq(pdev, 0); 144 mpu_irq[dev] = pnp_irq(pdev, 0);
187 } 145 }
188 146
189 kfree(cfg);
190 return 0; 147 return 0;
191} 148}
192 149