[PATCH] PNP: adjust pnp_register_card_driver() signature: ad1816a
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Mon, 27 Mar 2006 09:17:08 +0000 (01:17 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 27 Mar 2006 16:44:53 +0000 (08:44 -0800)
Remove the assumption that pnp_register_card_driver() returns the
number of devices claimed.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Jaroslav Kysela <perex@suse.cz>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
sound/isa/ad1816a/ad1816a.c

index 7051f77..31f299a 100644 (file)
@@ -262,6 +262,8 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
        return 0;
 }
 
+static unsigned int __devinitdata ad1816a_devices;
+
 static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card,
                                            const struct pnp_card_device_id *id)
 {
@@ -275,6 +277,7 @@ static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card,
                if (res < 0)
                        return res;
                dev++;
+               ad1816a_devices++;
                return 0;
        }
         return -ENODEV;
@@ -297,10 +300,13 @@ static struct pnp_card_driver ad1816a_pnpc_driver = {
 
 static int __init alsa_card_ad1816a_init(void)
 {
-       int cards;
+       int err;
+
+       err = pnp_register_card_driver(&ad1816a_pnpc_driver);
+       if (err)
+               return err;
 
-       cards = pnp_register_card_driver(&ad1816a_pnpc_driver);
-       if (cards <= 0) {
+       if (!ad1816a_devices) {
                pnp_unregister_card_driver(&ad1816a_pnpc_driver);
 #ifdef MODULE
                printk(KERN_ERR "no AD1816A based soundcards found.\n");