Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24361
b: refs/heads/master
c: be54414
h: refs/heads/master
i:
  24359: 92edf71
v: v3
  • Loading branch information
Bjorn Helgaas authored and Linus Torvalds committed Mar 27, 2006
1 parent 3960867 commit f32f6d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 312fef308cb15e793d8902f1dbd318d01268d36e
refs/heads/master: be54414d597b168d8c4eb2dafb8933ea15a7c148
29 changes: 20 additions & 9 deletions trunk/sound/oss/sb_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static int __initdata sm_games = 0; /* Logitech soundman games? */
static struct sb_card_config *legacy = NULL;

#ifdef CONFIG_PNP
static int pnp_registered;
static int __initdata pnp = 1;
/*
static int __initdata uart401 = 0;
Expand Down Expand Up @@ -133,7 +134,7 @@ static void sb_unload(struct sb_card_config *scc)
}

/* 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};

Expand Down Expand Up @@ -234,6 +235,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)
{
Expand Down Expand Up @@ -264,6 +267,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);
sb_pnp_devices++;

return sb_register_oss(scc, &sbmo);
}
Expand All @@ -289,6 +293,14 @@ static struct pnp_card_driver sb_pnp_driver = {
MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table);
#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;
Expand All @@ -307,17 +319,18 @@ static int __init sb_init(void)

#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 */
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;
Expand All @@ -333,9 +346,7 @@ static void __exit sb_exit(void)
sb_unload(legacy);
}

#ifdef CONFIG_PNP
pnp_unregister_card_driver(&sb_pnp_driver);
#endif
sb_unregister_all();

if (smw_free) {
vfree(smw_free);
Expand Down

0 comments on commit f32f6d3

Please sign in to comment.