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
/
drivers
/
mpu401
/
mpu401.c
diff --git
a/sound/drivers/mpu401/mpu401.c
b/sound/drivers/mpu401/mpu401.c
index
915589a
..
2de181a
100644
(file)
--- a/
sound/drivers/mpu401/mpu401.c
+++ b/
sound/drivers/mpu401/mpu401.c
@@
-59,7
+59,8
@@
module_param_array(irq, int, NULL, 0444);
MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
static struct platform_device *platform_devices[SNDRV_CARDS];
MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
static struct platform_device *platform_devices[SNDRV_CARDS];
-static int pnp_registered = 0;
+static int pnp_registered;
+static unsigned int snd_mpu401_devices;
static int snd_mpu401_create(int dev, struct snd_card **rcard)
{
static int snd_mpu401_create(int dev, struct snd_card **rcard)
{
@@
-82,7
+83,7
@@
static int snd_mpu401_create(int dev, struct snd_card **rcard)
if ((err = snd_mpu401_uart_new(card, 0,
MPU401_HW_MPU401,
port[dev], 0,
if ((err = snd_mpu401_uart_new(card, 0,
MPU401_HW_MPU401,
port[dev], 0,
- irq[dev], irq[dev] >= 0 ?
SA_INTERRUPT
: 0, NULL)) < 0) {
+ irq[dev], irq[dev] >= 0 ?
IRQF_DISABLED
: 0, NULL)) < 0) {
printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
goto _err;
}
printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
goto _err;
}
@@
-150,7
+151,7
@@
static struct pnp_device_id snd_mpu401_pnpids[] = {
MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids);
MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids);
-static int __init snd_mpu401_pnp(int dev, struct pnp_dev *device,
+static int __
dev
init snd_mpu401_pnp(int dev, struct pnp_dev *device,
const struct pnp_device_id *id)
{
if (!pnp_port_valid(device, 0) ||
const struct pnp_device_id *id)
{
if (!pnp_port_valid(device, 0) ||
@@
-159,8
+160,9
@@
static int __init snd_mpu401_pnp(int dev, struct pnp_dev *device,
return -ENODEV;
}
if (pnp_port_len(device, 0) < IO_EXTENT) {
return -ENODEV;
}
if (pnp_port_len(device, 0) < IO_EXTENT) {
- snd_printk(KERN_ERR "PnP port length is %ld, expected %d\n",
- pnp_port_len(device, 0), IO_EXTENT);
+ snd_printk(KERN_ERR "PnP port length is %llu, expected %d\n",
+ (unsigned long long)pnp_port_len(device, 0),
+ IO_EXTENT);
return -ENODEV;
}
port[dev] = pnp_port_start(device, 0);
return -ENODEV;
}
port[dev] = pnp_port_start(device, 0);
@@
-197,6
+199,7
@@
static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
}
snd_card_set_dev(card, &pnp_dev->dev);
pnp_set_drvdata(pnp_dev, card);
}
snd_card_set_dev(card, &pnp_dev->dev);
pnp_set_drvdata(pnp_dev, card);
+ snd_mpu401_devices++;
++dev;
return 0;
}
++dev;
return 0;
}
@@
-208,7
+211,7
@@
static void __devexit snd_mpu401_pnp_remove(struct pnp_dev *dev)
struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev);
snd_card_disconnect(card);
struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev);
snd_card_disconnect(card);
- snd_card_free_
in_threa
d(card);
+ snd_card_free_
when_close
d(card);
}
static struct pnp_driver snd_mpu401_pnp_driver = {
}
static struct pnp_driver snd_mpu401_pnp_driver = {
@@
-234,44
+237,42
@@
static void __init_or_module snd_mpu401_unregister_all(void)
static int __init alsa_card_mpu401_init(void)
{
static int __init alsa_card_mpu401_init(void)
{
- int i, err
, devices
;
+ int i, err;
if ((err = platform_driver_register(&snd_mpu401_driver)) < 0)
return err;
if ((err = platform_driver_register(&snd_mpu401_driver)) < 0)
return err;
- devices = 0;
- for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+ for (i = 0; i < SNDRV_CARDS; i++) {
struct platform_device *device;
struct platform_device *device;
+ if (! enable[i])
+ continue;
#ifdef CONFIG_PNP
if (pnp[i])
continue;
#endif
device = platform_device_register_simple(SND_MPU401_DRIVER,
i, NULL, 0);
#ifdef CONFIG_PNP
if (pnp[i])
continue;
#endif
device = platform_device_register_simple(SND_MPU401_DRIVER,
i, NULL, 0);
- if (IS_ERR(device)) {
- err = PTR_ERR(device);
- goto errout;
+ if (IS_ERR(device))
+ continue;
+ if (!platform_get_drvdata(device)) {
+ platform_device_unregister(device);
+ continue;
}
platform_devices[i] = device;
}
platform_devices[i] = device;
- devices++;
+
snd_mpu401_
devices++;
}
}
- if ((err = pnp_register_driver(&snd_mpu401_pnp_driver)) >= 0) {
+ err = pnp_register_driver(&snd_mpu401_pnp_driver);
+ if (!err)
pnp_registered = 1;
pnp_registered = 1;
- devices += err;
- }
- if (!devices) {
+ if (!
snd_mpu401_
devices) {
#ifdef MODULE
printk(KERN_ERR "MPU-401 device not found or device busy\n");
#endif
#ifdef MODULE
printk(KERN_ERR "MPU-401 device not found or device busy\n");
#endif
-
err = -ENODEV
;
-
goto errout
;
+
snd_mpu401_unregister_all()
;
+
return -ENODEV
;
}
return 0;
}
return 0;
-
- errout:
- snd_mpu401_unregister_all();
- return err;
}
static void __exit alsa_card_mpu401_exit(void)
}
static void __exit alsa_card_mpu401_exit(void)