aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/gus/gusmax.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/gus/gusmax.c')
-rw-r--r--sound/isa/gus/gusmax.c71
1 files changed, 18 insertions, 53 deletions
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index d1ad90ca035d..708783d4351f 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -22,7 +22,7 @@
22#include <sound/driver.h> 22#include <sound/driver.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/platform_device.h> 25#include <linux/isa.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/time.h> 27#include <linux/time.h>
28#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
@@ -72,8 +72,6 @@ MODULE_PARM_DESC(channels, "Used GF1 channels for GUS MAX driver.");
72module_param_array(pcm_channels, int, NULL, 0444); 72module_param_array(pcm_channels, int, NULL, 0444);
73MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); 73MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver.");
74 74
75static struct platform_device *devices[SNDRV_CARDS];
76
77struct snd_gusmax { 75struct snd_gusmax {
78 int irq; 76 int irq;
79 struct snd_card *card; 77 struct snd_card *card;
@@ -205,9 +203,13 @@ static void snd_gusmax_free(struct snd_card *card)
205 free_irq(maxcard->irq, (void *)maxcard); 203 free_irq(maxcard->irq, (void *)maxcard);
206} 204}
207 205
208static int __devinit snd_gusmax_probe(struct platform_device *pdev) 206static int __devinit snd_gusmax_match(struct device *pdev, unsigned int dev)
207{
208 return enable[dev];
209}
210
211static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
209{ 212{
210 int dev = pdev->id;
211 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; 213 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
212 static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; 214 static int possible_dmas[] = {5, 6, 7, 1, 3, -1};
213 int xirq, xdma1, xdma2, err; 215 int xirq, xdma1, xdma2, err;
@@ -333,7 +335,7 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev)
333 if (xdma2 >= 0) 335 if (xdma2 >= 0)
334 sprintf(card->longname + strlen(card->longname), "&%i", xdma2); 336 sprintf(card->longname + strlen(card->longname), "&%i", xdma2);
335 337
336 snd_card_set_dev(card, &pdev->dev); 338 snd_card_set_dev(card, pdev);
337 339
338 if ((err = snd_card_register(card)) < 0) 340 if ((err = snd_card_register(card)) < 0)
339 goto _err; 341 goto _err;
@@ -341,7 +343,7 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev)
341 maxcard->gus = gus; 343 maxcard->gus = gus;
342 maxcard->cs4231 = cs4231; 344 maxcard->cs4231 = cs4231;
343 345
344 platform_set_drvdata(pdev, card); 346 dev_set_drvdata(pdev, card);
345 return 0; 347 return 0;
346 348
347 _err: 349 _err:
@@ -349,70 +351,33 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev)
349 return err; 351 return err;
350} 352}
351 353
352static int __devexit snd_gusmax_remove(struct platform_device *devptr) 354static int __devexit snd_gusmax_remove(struct device *devptr, unsigned int dev)
353{ 355{
354 snd_card_free(platform_get_drvdata(devptr)); 356 snd_card_free(dev_get_drvdata(devptr));
355 platform_set_drvdata(devptr, NULL); 357 dev_set_drvdata(devptr, NULL);
356 return 0; 358 return 0;
357} 359}
358 360
359#define GUSMAX_DRIVER "snd_gusmax" 361#define DEV_NAME "gusmax"
360 362
361static struct platform_driver snd_gusmax_driver = { 363static struct isa_driver snd_gusmax_driver = {
364 .match = snd_gusmax_match,
362 .probe = snd_gusmax_probe, 365 .probe = snd_gusmax_probe,
363 .remove = __devexit_p(snd_gusmax_remove), 366 .remove = __devexit_p(snd_gusmax_remove),
364 /* FIXME: suspend/resume */ 367 /* FIXME: suspend/resume */
365 .driver = { 368 .driver = {
366 .name = GUSMAX_DRIVER 369 .name = DEV_NAME
367 }, 370 },
368}; 371};
369 372
370static void __init_or_module snd_gusmax_unregister_all(void)
371{
372 int i;
373
374 for (i = 0; i < ARRAY_SIZE(devices); ++i)
375 platform_device_unregister(devices[i]);
376 platform_driver_unregister(&snd_gusmax_driver);
377}
378
379static int __init alsa_card_gusmax_init(void) 373static int __init alsa_card_gusmax_init(void)
380{ 374{
381 int i, cards, err; 375 return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS);
382
383 err = platform_driver_register(&snd_gusmax_driver);
384 if (err < 0)
385 return err;
386
387 cards = 0;
388 for (i = 0; i < SNDRV_CARDS; i++) {
389 struct platform_device *device;
390 if (! enable[i])
391 continue;
392 device = platform_device_register_simple(GUSMAX_DRIVER,
393 i, NULL, 0);
394 if (IS_ERR(device))
395 continue;
396 if (!platform_get_drvdata(device)) {
397 platform_device_unregister(device);
398 continue;
399 }
400 devices[i] = device;
401 cards++;
402 }
403 if (!cards) {
404#ifdef MODULE
405 printk(KERN_ERR "GUS MAX soundcard not found or device busy\n");
406#endif
407 snd_gusmax_unregister_all();
408 return -ENODEV;
409 }
410 return 0;
411} 376}
412 377
413static void __exit alsa_card_gusmax_exit(void) 378static void __exit alsa_card_gusmax_exit(void)
414{ 379{
415 snd_gusmax_unregister_all(); 380 isa_unregister_driver(&snd_gusmax_driver);
416} 381}
417 382
418module_init(alsa_card_gusmax_init) 383module_init(alsa_card_gusmax_init)