git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
sound
/
oss
/
sb_card.c
diff --git
a/sound/oss/sb_card.c
b/sound/oss/sb_card.c
index
07191b3
..
8666291
100644
(file)
--- a/
sound/oss/sb_card.c
+++ b/
sound/oss/sb_card.c
@@
-22,13
+22,9
@@
* 02-07-2003 Bug made it into first release. Take two.
*/
* 02-07-2003 Bug made it into first release. Take two.
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
-#ifdef CONFIG_MCA
-#include <linux/mca.h>
-#endif /* CONFIG_MCA */
#include "sound_config.h"
#include "sb_mixer.h"
#include "sb.h"
#include "sound_config.h"
#include "sb_mixer.h"
#include "sb.h"
@@
-52,9
+48,10
@@
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? */
static int __initdata acer = 0; /* Do acer notebook init? */
static int __initdata sm_games = 0; /* Logitech soundman games? */
-struct sb_card_config *legacy = NULL;
+st
atic st
ruct sb_card_config *legacy = NULL;
#ifdef CONFIG_PNP
#ifdef CONFIG_PNP
+static int pnp_registered;
static int __initdata pnp = 1;
/*
static int __initdata uart401 = 0;
static int __initdata pnp = 1;
/*
static int __initdata uart401 = 0;
@@
-136,7
+133,7
@@
static void sb_unload(struct sb_card_config *scc)
}
/* Register legacy card with OSS subsystem */
}
/* Register legacy card with OSS subsystem */
-static int sb_init_legacy(void)
+static int
__init
sb_init_legacy(void)
{
struct sb_module_options sbmo = {0};
{
struct sb_module_options sbmo = {0};
@@
-237,6
+234,8
@@
static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc)
}
}
}
}
+static unsigned int sb_pnp_devices;
+
/* Probe callback function for the PnP API */
static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id)
{
/* Probe callback function for the PnP API */
static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id)
{
@@
-267,6
+266,7
@@
static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device
scc->conf.dma, scc->conf.dma2);
pnp_set_card_drvdata(card, scc);
scc->conf.dma, scc->conf.dma2);
pnp_set_card_drvdata(card, scc);
+ sb_pnp_devices++;
return sb_register_oss(scc, &sbmo);
}
return sb_register_oss(scc, &sbmo);
}
@@
-289,8
+289,17
@@
static struct pnp_card_driver sb_pnp_driver = {
.probe = sb_pnp_probe,
.remove = sb_pnp_remove,
};
.probe = sb_pnp_probe,
.remove = sb_pnp_remove,
};
+MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table);
#endif /* CONFIG_PNP */
#endif /* CONFIG_PNP */
+static void __init_or_module sb_unregister_all(void)
+{
+#ifdef CONFIG_PNP
+ if (pnp_registered)
+ pnp_unregister_card_driver(&sb_pnp_driver);
+#endif
+}
+
static int __init sb_init(void)
{
int lres = 0;
static int __init sb_init(void)
{
int lres = 0;
@@
-309,17
+318,18
@@
static int __init sb_init(void)
#ifdef CONFIG_PNP
if(pnp) {
#ifdef CONFIG_PNP
if(pnp) {
- pres = pnp_register_card_driver(&sb_pnp_driver);
+ int err = pnp_register_card_driver(&sb_pnp_driver);
+ if (!err)
+ pnp_registered = 1;
+ pres = sb_pnp_devices;
}
#endif
printk(KERN_INFO "sb: Init: Done\n");
/* If either PnP or Legacy registered a card then return
* success */
}
#endif
printk(KERN_INFO "sb: Init: Done\n");
/* If either PnP or Legacy registered a card then return
* success */
- if (pres <= 0 && lres <= 0) {
-#ifdef CONFIG_PNP
- pnp_unregister_card_driver(&sb_pnp_driver);
-#endif
+ if (pres == 0 && lres <= 0) {
+ sb_unregister_all();
return -ENODEV;
}
return 0;
return -ENODEV;
}
return 0;
@@
-335,14
+345,10
@@
static void __exit sb_exit(void)
sb_unload(legacy);
}
sb_unload(legacy);
}
-#ifdef CONFIG_PNP
- pnp_unregister_card_driver(&sb_pnp_driver);
-#endif
+ sb_unregister_all();
- if (smw_free) {
- vfree(smw_free);
- smw_free = NULL;
- }
+ vfree(smw_free);
+ smw_free = NULL;
}
module_init(sb_init);
}
module_init(sb_init);