X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Fsb_card.c;h=de3fd492d0b0bd1fd61fc15c6489796391144aaa;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=b5f5ecbf25a95d9de93052e904de489b761a35cc;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index b5f5ecbf2..de3fd492d 100644 --- a/sound/oss/sb_card.c +++ b/sound/oss/sb_card.c @@ -52,7 +52,7 @@ static int __initdata esstype = 0; /* ESS chip type */ static int __initdata acer = 0; /* Do acer notebook init? */ static int __initdata sm_games = 0; /* Logitech soundman games? */ -struct sb_card_config *legacy = NULL; +static struct sb_card_config *legacy = NULL; #ifdef CONFIG_PNP static int __initdata pnp = 1; @@ -100,7 +100,14 @@ MODULE_PARM_DESC(uart401, "When set to 1, will attempt to detect and enable"\ /* OSS subsystem card registration shared by PnP and legacy routines */ static int sb_register_oss(struct sb_card_config *scc, struct sb_module_options *sbmo) { - if(!sb_dsp_detect(&scc->conf, 0, 0, sbmo)) { + if (!request_region(scc->conf.io_base, 16, "soundblaster")) { + printk(KERN_ERR "sb: ports busy.\n"); + kfree(scc); + return -EBUSY; + } + + if (!sb_dsp_detect(&scc->conf, 0, 0, sbmo)) { + release_region(scc->conf.io_base, 16); printk(KERN_ERR "sb: Failed DSP Detect.\n"); kfree(scc); return -ENODEV; @@ -309,7 +316,13 @@ static int __init sb_init(void) /* If either PnP or Legacy registered a card then return * success */ - return (pres > 0 || lres > 0) ? 0 : -ENODEV; + if (pres <= 0 && lres <= 0) { +#ifdef CONFIG_PNP + pnp_unregister_card_driver(&sb_pnp_driver); +#endif + return -ENODEV; + } + return 0; } static void __exit sb_exit(void)