Index: local/sound/isa/adlib.c =================================================================== --- local.orig/sound/isa/adlib.c 2006-04-06 23:10:52.000000000 +0200 +++ local/sound/isa/adlib.c 2006-04-07 01:42:11.000000000 +0200 @@ -43,25 +43,19 @@ static int __devinit snd_adlib_probe(str struct snd_card *card; struct snd_opl3 *opl3; - int error; - int i = device->id; - - if (port[i] == SNDRV_AUTO_PORT) { - snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); - error = -EINVAL; - goto out0; - } + int error, i = device->id; + char *bus_id = device->dev.bus_id; card = snd_card_new(index[i], id[i], THIS_MODULE, 0); if (!card) { - snd_printk(KERN_ERR DRV_NAME ": could not create card\n"); + snd_printk(KERN_ERR "%s: could not create card\n", bus_id); error = -EINVAL; goto out0; } card->private_data = request_region(port[i], 4, CRD_NAME); if (!card->private_data) { - snd_printk(KERN_ERR DRV_NAME ": could not grab ports\n"); + snd_printk(KERN_ERR "%s: could not grab ports\n", bus_id); error = -EBUSY; goto out1; } @@ -69,13 +63,13 @@ static int __devinit snd_adlib_probe(str error = snd_opl3_create(card, port[i], port[i] + 2, OPL3_HW_AUTO, 1, &opl3); if (error < 0) { - snd_printk(KERN_ERR DRV_NAME ": could not create OPL\n"); + snd_printk(KERN_ERR "%s: could not create OPL\n", bus_id); goto out1; } error = snd_opl3_hwdep_new(opl3, 0, 0, NULL); if (error < 0) { - snd_printk(KERN_ERR DRV_NAME ": could not create FM\n"); + snd_printk(KERN_ERR "%s: could not create FM\n", bus_id); goto out1; } @@ -87,7 +81,7 @@ static int __devinit snd_adlib_probe(str error = snd_card_register(card); if (error < 0) { - snd_printk(KERN_ERR DRV_NAME ": could not register card\n"); + snd_printk(KERN_ERR "%s: could not register card\n", bus_id); goto out1; } @@ -95,8 +89,7 @@ static int __devinit snd_adlib_probe(str return 0; out1: snd_card_free(card); - out0: error = -EINVAL; /* FIXME: should be the original error code */ - return error; +out0: return error; } static int __devexit snd_adlib_remove(struct platform_device *device) @@ -109,7 +102,6 @@ static int __devexit snd_adlib_remove(st static struct platform_driver snd_adlib_driver = { .probe = snd_adlib_probe, .remove = __devexit_p(snd_adlib_remove), - .driver = { .name = DRV_NAME } @@ -119,9 +111,10 @@ static int __init alsa_card_adlib_init(v { int i, cards; - if (platform_driver_register(&snd_adlib_driver) < 0) { + i = platform_driver_register(&snd_adlib_driver); + if (i < 0) { snd_printk(KERN_ERR DRV_NAME ": could not register driver\n"); - return -ENODEV; + return i; } for (cards = 0, i = 0; i < SNDRV_CARDS; i++) { @@ -130,21 +123,26 @@ static int __init alsa_card_adlib_init(v if (!enable[i]) continue; + if (port[i] == SNDRV_AUTO_PORT) { + snd_printk(KERN_ERR DRV_NAME ": please specify port for card %d\n", i); + continue; + } + device = platform_device_register_simple(DRV_NAME, i, NULL, 0); - if (IS_ERR(device)) + if (IS_ERR(device)) { + snd_printk(KERN_ERR DRV_NAME ": could not register device for card %d\n", i); continue; + } devices[i] = device; cards++; } if (!cards) { -#ifdef MODULE - printk(KERN_ERR CRD_NAME " soundcard not found or device busy\n"); -#endif platform_driver_unregister(&snd_adlib_driver); - return -ENODEV; + return -EINVAL; } + return 0; }