Remove the assumption that pnp_register_driver() returns the number of devices
claimed.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
static int pnp_registered;
#endif
#endif /* CONFIG_PNP */
static int pnp_registered;
#endif
#endif /* CONFIG_PNP */
+static unsigned int snd_cs423x_devices;
struct snd_card_cs4236 {
struct snd_cs4231 *chip;
struct snd_card_cs4236 {
struct snd_cs4231 *chip;
snd_card_free(card);
return err;
}
snd_card_free(card);
return err;
}
platform_set_drvdata(pdev, card);
return 0;
}
platform_set_drvdata(pdev, card);
return 0;
}
}
pnp_set_drvdata(pdev, card);
dev++;
}
pnp_set_drvdata(pdev, card);
dev++;
}
pnp_set_card_drvdata(pcard, card);
dev++;
}
pnp_set_card_drvdata(pcard, card);
dev++;
snd_card_free(pnp_get_card_drvdata(pcard));
pnp_set_card_drvdata(pcard, NULL);
}
snd_card_free(pnp_get_card_drvdata(pcard));
pnp_set_card_drvdata(pcard, NULL);
}
#ifdef CONFIG_PM
static int snd_cs423x_pnpc_suspend(struct pnp_card_link *pcard, pm_message_t state)
{
#ifdef CONFIG_PM
static int snd_cs423x_pnpc_suspend(struct pnp_card_link *pcard, pm_message_t state)
{
static int __init alsa_card_cs423x_init(void)
{
static int __init alsa_card_cs423x_init(void)
{
if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0)
return err;
if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0)
return err;
goto errout;
}
platform_devices[i] = device;
goto errout;
}
platform_devices[i] = device;
}
#ifdef CONFIG_PNP
#ifdef CS4232
}
#ifdef CONFIG_PNP
#ifdef CS4232
- i = pnp_register_driver(&cs4232_pnp_driver);
- if (i >= 0) {
+ err = pnp_register_driver(&cs4232_pnp_driver);
+ if (!err)
- i = pnp_register_card_driver(&cs423x_pnpc_driver);
- if (i >= 0) {
+ err = pnp_register_card_driver(&cs423x_pnpc_driver);
+ if (!err)
+ if (!snd_cs423x_devices) {
#ifdef MODULE
printk(KERN_ERR IDENT " soundcard not found or device busy\n");
#endif
#ifdef MODULE
printk(KERN_ERR IDENT " soundcard not found or device busy\n");
#endif