diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2006-03-27 04:17:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:53 -0500 |
commit | f301ae6a690abe7edd2f92fa6df0b1b06986a6ad (patch) | |
tree | 7ba628b3d11143589c2c9242120a5f18278d70ac /sound/drivers/mpu401/mpu401.c | |
parent | 7597fee389b18e5ed3c8bd58f0012674beb279ed (diff) |
[PATCH] pnp: mpu401: adjust pnp_register_driver signature
This series of patches removes the assumption that pnp_register_driver()
returns the number of devices claimed. Returning the count is unreliable
because devices may be hot-plugged in the future. (Many devices don't support
hot-plug, of course, but PNP in general does.)
This changes the convention to "zero for success, or a negative error value,"
which matches pci_register_driver(), acpi_bus_register_driver(), and
platform_driver_register().
If drivers need to know the number of devices, they can count calls to their
.probe() methods.
This patch:
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>
Diffstat (limited to 'sound/drivers/mpu401/mpu401.c')
-rw-r--r-- | sound/drivers/mpu401/mpu401.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 9d10d79e27af..9ea3059a7064 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c | |||
@@ -59,7 +59,8 @@ module_param_array(irq, int, NULL, 0444); | |||
59 | MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); | 59 | MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); |
60 | 60 | ||
61 | static struct platform_device *platform_devices[SNDRV_CARDS]; | 61 | static struct platform_device *platform_devices[SNDRV_CARDS]; |
62 | static int pnp_registered = 0; | 62 | static int pnp_registered; |
63 | static unsigned int snd_mpu401_devices; | ||
63 | 64 | ||
64 | static int snd_mpu401_create(int dev, struct snd_card **rcard) | 65 | static int snd_mpu401_create(int dev, struct snd_card **rcard) |
65 | { | 66 | { |
@@ -197,6 +198,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, | |||
197 | } | 198 | } |
198 | snd_card_set_dev(card, &pnp_dev->dev); | 199 | snd_card_set_dev(card, &pnp_dev->dev); |
199 | pnp_set_drvdata(pnp_dev, card); | 200 | pnp_set_drvdata(pnp_dev, card); |
201 | snd_mpu401_devices++; | ||
200 | ++dev; | 202 | ++dev; |
201 | return 0; | 203 | return 0; |
202 | } | 204 | } |
@@ -234,12 +236,11 @@ static void __init_or_module snd_mpu401_unregister_all(void) | |||
234 | 236 | ||
235 | static int __init alsa_card_mpu401_init(void) | 237 | static int __init alsa_card_mpu401_init(void) |
236 | { | 238 | { |
237 | int i, err, devices; | 239 | int i, err; |
238 | 240 | ||
239 | if ((err = platform_driver_register(&snd_mpu401_driver)) < 0) | 241 | if ((err = platform_driver_register(&snd_mpu401_driver)) < 0) |
240 | return err; | 242 | return err; |
241 | 243 | ||
242 | devices = 0; | ||
243 | for (i = 0; i < SNDRV_CARDS; i++) { | 244 | for (i = 0; i < SNDRV_CARDS; i++) { |
244 | struct platform_device *device; | 245 | struct platform_device *device; |
245 | if (! enable[i]) | 246 | if (! enable[i]) |
@@ -255,14 +256,13 @@ static int __init alsa_card_mpu401_init(void) | |||
255 | goto errout; | 256 | goto errout; |
256 | } | 257 | } |
257 | platform_devices[i] = device; | 258 | platform_devices[i] = device; |
258 | devices++; | 259 | snd_mpu401_devices++; |
259 | } | 260 | } |
260 | if ((err = pnp_register_driver(&snd_mpu401_pnp_driver)) >= 0) { | 261 | err = pnp_register_driver(&snd_mpu401_pnp_driver); |
262 | if (!err) | ||
261 | pnp_registered = 1; | 263 | pnp_registered = 1; |
262 | devices += err; | ||
263 | } | ||
264 | 264 | ||
265 | if (!devices) { | 265 | if (!snd_mpu401_devices) { |
266 | #ifdef MODULE | 266 | #ifdef MODULE |
267 | printk(KERN_ERR "MPU-401 device not found or device busy\n"); | 267 | printk(KERN_ERR "MPU-401 device not found or device busy\n"); |
268 | #endif | 268 | #endif |