From f301ae6a690abe7edd2f92fa6df0b1b06986a6ad Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:04 -0800 Subject: [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 Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/drivers/mpu401/mpu401.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 9d10d79e27a..9ea3059a706 100644 --- 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]; -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) { @@ -197,6 +198,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_mpu401_devices++; ++dev; return 0; } @@ -234,12 +236,11 @@ static void __init_or_module snd_mpu401_unregister_all(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; - devices = 0; for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; if (! enable[i]) @@ -255,14 +256,13 @@ static int __init alsa_card_mpu401_init(void) goto errout; } 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; - devices += err; - } - if (!devices) { + if (!snd_mpu401_devices) { #ifdef MODULE printk(KERN_ERR "MPU-401 device not found or device busy\n"); #endif -- cgit v1.2.3-18-g5258 From ed7cb1913168fdce6d084f2f5cd6818851313383 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:04 -0800 Subject: [PATCH] pnp: cs4236: adjust pnp_register_driver signature Remove the assumption that pnp_register_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/cs423x/cs4236.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 4060918e032..382bb17ef49 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -133,6 +133,7 @@ static int pnpc_registered; static int pnp_registered; #endif #endif /* CONFIG_PNP */ +static unsigned int snd_cs423x_devices; struct snd_card_cs4236 { struct snd_cs4231 *chip; @@ -564,7 +565,7 @@ static int __init snd_cs423x_nonpnp_probe(struct platform_device *pdev) snd_card_free(card); return err; } - + platform_set_drvdata(pdev, card); return 0; } @@ -650,6 +651,7 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, } pnp_set_drvdata(pdev, card); dev++; + snd_cs423x_devices++; return 0; } @@ -713,6 +715,7 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + snd_cs423x_devices++; return 0; } @@ -721,7 +724,7 @@ static void __devexit snd_cs423x_pnpc_remove(struct pnp_card_link * pcard) 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) { @@ -766,7 +769,7 @@ static void __init_or_module snd_cs423x_unregister_all(void) static int __init alsa_card_cs423x_init(void) { - int i, err, cards = 0; + int i, err; if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) return err; @@ -782,24 +785,20 @@ static int __init alsa_card_cs423x_init(void) goto errout; } platform_devices[i] = device; - cards++; + snd_cs423x_devices++; } #ifdef CONFIG_PNP #ifdef CS4232 - i = pnp_register_driver(&cs4232_pnp_driver); - if (i >= 0) { + err = pnp_register_driver(&cs4232_pnp_driver); + if (!err) pnp_registered = 1; - cards += i; - } #endif - i = pnp_register_card_driver(&cs423x_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&cs423x_pnpc_driver); + if (!err) pnpc_registered = 1; - cards += i; - } #endif /* CONFIG_PNP */ - if (!cards) { + if (!snd_cs423x_devices) { #ifdef MODULE printk(KERN_ERR IDENT " soundcard not found or device busy\n"); #endif -- cgit v1.2.3-18-g5258 From 8c59c4a2216583cf79eaaaf71ef1dd5757e12854 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:05 -0800 Subject: [PATCH] pnp: opl3sa2: adjust pnp_register_driver signature Remove the assumption that pnp_register_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/opl3sa2.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 56fcd8a946a..c906e205d7d 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -95,6 +95,7 @@ static struct platform_device *platform_devices[SNDRV_CARDS]; static int pnp_registered; static int pnpc_registered; #endif +static unsigned int snd_opl3sa2_devices; /* control ports */ #define OPL3SA2_PM_CTRL 0x01 @@ -760,6 +761,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, } pnp_set_drvdata(pdev, card); dev++; + snd_opl3sa2_devices++; return 0; } @@ -826,6 +828,7 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + snd_opl3sa2_devices++; return 0; } @@ -944,7 +947,7 @@ static void __init_or_module snd_opl3sa2_unregister_all(void) static int __init alsa_card_opl3sa2_init(void) { - int i, err, cards = 0; + int i, err; if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) return err; @@ -964,23 +967,19 @@ static int __init alsa_card_opl3sa2_init(void) goto errout; } platform_devices[i] = device; - cards++; + snd_opl3sa2_devices++; } #ifdef CONFIG_PNP err = pnp_register_driver(&opl3sa2_pnp_driver); - if (err >= 0) { + if (!err) pnp_registered = 1; - cards += err; - } err = pnp_register_card_driver(&opl3sa2_pnpc_driver); - if (err >= 0) { + if (!err) pnpc_registered = 1; - cards += err; - } #endif - if (!cards) { + if (!snd_opl3sa2_devices) { #ifdef MODULE snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); #endif -- cgit v1.2.3-18-g5258 From 070c6999831dc4cfd9b07c74c2fea1964d7adfec Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:07 -0800 Subject: [PATCH] pnp: cs4232: adjust pnp_register_driver signature Remove the assumption that pnp_register_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/cs4232.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c index 7c59e2d4003..c7f86f09c28 100644 --- a/sound/oss/cs4232.c +++ b/sound/oss/cs4232.c @@ -360,6 +360,8 @@ static int __initdata synthio = -1; static int __initdata synthirq = -1; static int __initdata isapnp = 1; +static unsigned int cs4232_devices; + MODULE_DESCRIPTION("CS4232 based soundcard driver"); MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis"); MODULE_LICENSE("GPL"); @@ -421,6 +423,7 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev return -ENODEV; } pnp_set_drvdata(dev,isapnpcfg); + cs4232_devices++; return 0; } @@ -455,10 +458,11 @@ static int __init init_cs4232(void) #endif cfg.irq = -1; - if (isapnp && - (pnp_register_driver(&cs4232_driver) > 0) - ) - return 0; + if (isapnp) { + pnp_register_driver(&cs4232_driver); + if (cs4232_devices) + return 0; + } if(io==-1||irq==-1||dma==-1) { @@ -503,7 +507,8 @@ static int __init setup_cs4232(char *str) int ints[7]; /* If we have isapnp cards, no need for options */ - if (pnp_register_driver(&cs4232_driver) > 0) + pnp_register_driver(&cs4232_driver); + if (cs4232_devices) return 1; str = get_options(str, ARRAY_SIZE(ints), ints); -- cgit v1.2.3-18-g5258 From 5f53f4e2107fcfdd33da1cc34a86c9aef5e76af6 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:08 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: ad1816a Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/ad1816a/ad1816a.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 7051f7798ed..31f299aed28 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -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"); -- cgit v1.2.3-18-g5258 From 51427ec0f222cb73b21f3849416a95d751bdd742 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:09 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: als100 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix a __init/__devinit issue. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/als100.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/isa/als100.c b/sound/isa/als100.c index 9b77c17b3f6..a52bd8a14c9 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c @@ -199,7 +199,7 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard, return 0; } -static int __init snd_card_als100_probe(int dev, +static int __devinit snd_card_als100_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -281,6 +281,8 @@ static int __init snd_card_als100_probe(int dev, return 0; } +static unsigned int __devinitdata als100_devices; + static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -294,6 +296,7 @@ static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + als100_devices++; return 0; } return -ENODEV; @@ -345,10 +348,13 @@ static struct pnp_card_driver als100_pnpc_driver = { static int __init alsa_card_als100_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&als100_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&als100_pnpc_driver); - if (cards <= 0) { + if (!als100_devices) { pnp_unregister_card_driver(&als100_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no ALS100 based soundcards found\n"); -- cgit v1.2.3-18-g5258 From db2735eb9076c5176ec9dcbbaefd38e7d82f0e47 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:10 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: azt2320 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/azt2320.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index a530691bf4f..15e59283aac 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c @@ -310,6 +310,8 @@ static int __devinit snd_card_azt2320_probe(int dev, return 0; } +static unsigned int __devinitdata azt2320_devices; + static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -323,6 +325,7 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + azt2320_devices++; return 0; } return -ENODEV; @@ -372,10 +375,13 @@ static struct pnp_card_driver azt2320_pnpc_driver = { static int __init alsa_card_azt2320_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&azt2320_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&azt2320_pnpc_driver); - if (cards <= 0) { + if (!azt2320_devices) { pnp_unregister_card_driver(&azt2320_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no AZT2320 based soundcards found\n"); -- cgit v1.2.3-18-g5258 From 07d58ad06b46e630a5ff6b10e9b81f370b175b56 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:11 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: cmi8330 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/cmi8330.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index fd9bb2575de..fa63048a8b9 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -175,7 +175,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids); #endif -static struct ad1848_mix_elem snd_cmi8330_controls[] __initdata = { +static struct ad1848_mix_elem snd_cmi8330_controls[] __devinitdata = { AD1848_DOUBLE("Master Playback Volume", 0, CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), AD1848_SINGLE("Loud Playback Switch", 0, CMI8330_MUTEMUX, 6, 1, 1), AD1848_DOUBLE("PCM Playback Switch", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 7, 7, 1, 1), @@ -204,7 +204,7 @@ AD1848_SINGLE(SNDRV_CTL_NAME_IEC958("Input ",PLAYBACK,SWITCH), 0, CMI8330_MUTEMU }; #ifdef ENABLE_SB_MIXER -static struct sbmix_elem cmi8330_sb_mixers[] __initdata = { +static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata = { SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), @@ -222,7 +222,7 @@ SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6 SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), }; -static unsigned char cmi8330_sb_init_values[][2] __initdata = { +static unsigned char cmi8330_sb_init_values[][2] __devinitdata = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -545,7 +545,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_cmi8330_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_cmi8330_nonpnp_probe(struct platform_device *pdev) { struct snd_card *card; int err; @@ -607,6 +607,8 @@ static struct platform_driver snd_cmi8330_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata cmi8330_pnp_devices; + static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -636,6 +638,7 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + cmi8330_pnp_devices++; return 0; } @@ -706,9 +709,9 @@ static int __init alsa_card_cmi8330_init(void) #ifdef CONFIG_PNP err = pnp_register_card_driver(&cmi8330_pnpc_driver); - if (err >= 0) { + if (!err) { pnp_registered = 1; - cards += err; + cards += cmi8330_pnp_devices; } #endif -- cgit v1.2.3-18-g5258 From 6736a6587b991477aae927c37176e8cab8689f9e Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:12 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: dt019x Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/dt019x.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c index 50e7bc5ef56..0acb4e5da47 100644 --- a/sound/isa/dt019x.c +++ b/sound/isa/dt019x.c @@ -272,6 +272,8 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard, return 0; } +static unsigned int __devinitdata dt019x_devices; + static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *pid) { @@ -285,6 +287,7 @@ static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, if (res < 0) return res; dev++; + dt019x_devices++; return 0; } return -ENODEV; @@ -336,10 +339,13 @@ static struct pnp_card_driver dt019x_pnpc_driver = { static int __init alsa_card_dt019x_init(void) { - int cards = 0; + int err; + + err = pnp_register_card_driver(&dt019x_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&dt019x_pnpc_driver); - if (cards <= 0) { + if (!dt019x_devices) { pnp_unregister_card_driver(&dt019x_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n"); -- cgit v1.2.3-18-g5258 From fea9739f2a1aed1cfb9b7af7cce66b28b68d4394 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:13 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: es18xx Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/es18xx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 721955d2619..9fbc185b4cc 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -2204,7 +2204,7 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card *card; int err; @@ -2221,7 +2221,7 @@ static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devp return 0; } -static int __init snd_es18xx_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -2297,6 +2297,8 @@ static struct platform_driver snd_es18xx_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata es18xx_pnp_devices; + static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -2327,6 +2329,7 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, pnp_set_card_drvdata(pcard, card); dev++; + es18xx_pnp_devices++; return 0; } @@ -2397,10 +2400,10 @@ static int __init alsa_card_es18xx_init(void) } #ifdef CONFIG_PNP - i = pnp_register_card_driver(&es18xx_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&es18xx_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += es18xx_pnp_devices; } #endif -- cgit v1.2.3-18-g5258 From 6a3a3a0260cf5a4e5942db8d56cae4db4dc139a6 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:14 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: es968 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/sb/es968.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c index 9da80bfa302..d4d65b84265 100644 --- a/sound/isa/sb/es968.c +++ b/sound/isa/sb/es968.c @@ -124,7 +124,7 @@ static int __devinit snd_card_es968_pnp(int dev, struct snd_card_es968 *acard, return 0; } -static int __init snd_card_es968_probe(int dev, +static int __devinit snd_card_es968_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -182,6 +182,8 @@ static int __init snd_card_es968_probe(int dev, return 0; } +static unsigned int __devinitdata es968_devices; + static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -195,6 +197,7 @@ static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + es968_devices++; return 0; } return -ENODEV; @@ -246,8 +249,11 @@ static struct pnp_card_driver es968_pnpc_driver = { static int __init alsa_card_es968_init(void) { - int cards = pnp_register_card_driver(&es968_pnpc_driver); - if (cards <= 0) { + int err = pnp_register_card_driver(&es968_pnpc_driver); + if (err) + return err; + + if (!es968_devices) { pnp_unregister_card_driver(&es968_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no ES968 based soundcards found\n"); -- cgit v1.2.3-18-g5258 From ebdb71ea7b384ff3f32dd038dba0aad58580e832 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:14 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: interwave Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/gus/interwave.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 2cacd0fa687..de71b7a99c8 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -791,7 +791,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) return 0; } -static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card *card; int err; @@ -809,7 +809,7 @@ static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *d return 0; } -static int __init snd_interwave_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -867,6 +867,7 @@ static struct platform_driver snd_interwave_driver = { }; #ifdef CONFIG_PNP +static unsigned int __devinitdata interwave_pnp_devices; static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -897,6 +898,7 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + interwave_pnp_devices++; return 0; } @@ -954,10 +956,10 @@ static int __init alsa_card_interwave_init(void) } /* ISA PnP cards */ - i = pnp_register_card_driver(&interwave_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&interwave_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += interwave_pnp_devices;; } if (!cards) { -- cgit v1.2.3-18-g5258 From 312fef308cb15e793d8902f1dbd318d01268d36e Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:15 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: sb16 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/sb/sb16.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 5737ab76160..21ea65925a9 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -369,7 +369,7 @@ static struct snd_card *snd_sb16_card_new(int dev) return card; } -static int __init snd_sb16_probe(struct snd_card *card, int dev) +static int __devinit snd_sb16_probe(struct snd_card *card, int dev) { int xirq, xdma8, xdma16; struct snd_sb *chip; @@ -518,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card) } #endif -static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card_sb16 *acard; struct snd_card *card; @@ -548,7 +548,7 @@ static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr } -static int __init snd_sb16_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -629,6 +629,7 @@ static struct platform_driver snd_sb16_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata sb16_pnp_devices; static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -651,6 +652,7 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + sb16_pnp_devices++; return 0; } @@ -727,10 +729,10 @@ static int __init alsa_card_sb16_init(void) } #ifdef CONFIG_PNP /* PnP cards at last */ - i = pnp_register_card_driver(&sb16_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&sb16_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += sb16_pnp_devices; } #endif -- cgit v1.2.3-18-g5258 From be54414d597b168d8c4eb2dafb8933ea15a7c148 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:16 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: sb_card Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/sb_card.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index 680b82e1529..d38e88abc8f 100644 --- a/sound/oss/sb_card.c +++ b/sound/oss/sb_card.c @@ -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; @@ -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}; @@ -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) { @@ -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); } @@ -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; @@ -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; @@ -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); -- cgit v1.2.3-18-g5258 From 38125956441c5cab28333414cee308d162507477 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:17 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: sscape Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/sscape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 29bba8cc3ef..48e5552d344 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -1255,7 +1255,7 @@ static int __devinit create_sscape(int dev, struct snd_card **rcardp) } -static int __init snd_sscape_probe(struct platform_device *pdev) +static int __devinit snd_sscape_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; @@ -1469,7 +1469,7 @@ static int __init sscape_init(void) if (ret < 0) return ret; #ifdef CONFIG_PNP - if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0) + if (pnp_register_card_driver(&sscape_pnpc_driver) == 0) pnp_registered = 1; #endif return 0; -- cgit v1.2.3-18-g5258 From c94ded6e602594c8e66fd5b1ba832d5327f5c103 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:18 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: wavefront Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/wavefront/wavefront.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index c0115bf9065..2f13cd5d4dc 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -589,7 +589,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_wavefront_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; @@ -637,6 +637,7 @@ static struct platform_driver snd_wavefront_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata wavefront_pnp_devices; static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -670,6 +671,7 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, pnp_set_card_drvdata(pcard, card); dev++; + wavefront_pnp_devices++; return 0; } @@ -729,10 +731,10 @@ static int __init alsa_card_wavefront_init(void) } #ifdef CONFIG_PNP - i = pnp_register_card_driver(&wavefront_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&wavefront_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += wavefront_pnp_devices; } #endif -- cgit v1.2.3-18-g5258 From 99ac48f54a91d02140c497edc31dc57d4bc5c85d Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Tue, 28 Mar 2006 01:56:41 -0800 Subject: [PATCH] mark f_ops const in the inode Mark the f_ops members of inodes as const, as well as fix the ripple-through this causes by places that copy this f_ops and then "do stuff" with it. Signed-off-by: Arjan van de Ven Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/core/init.c | 3 ++- sound/core/sound.c | 4 ++-- sound/core/sound_oss.c | 2 +- sound/sound_core.c | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/core/init.c b/sound/core/init.c index ad68761abba..5bb8a8b23d5 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -223,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card) struct snd_monitor_file *mfile; struct file *file; struct snd_shutdown_f_ops *s_f_ops; - struct file_operations *f_ops, *old_f_ops; + struct file_operations *f_ops; + const struct file_operations *old_f_ops; int err; spin_lock(&card->files_lock); diff --git a/sound/core/sound.c b/sound/core/sound.c index 4d28e521261..108e430b503 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -137,7 +137,7 @@ static int snd_open(struct inode *inode, struct file *file) { unsigned int minor = iminor(inode); struct snd_minor *mptr = NULL; - struct file_operations *old_fops; + const struct file_operations *old_fops; int err = 0; if (minor >= ARRAY_SIZE(snd_minors)) @@ -240,7 +240,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) * Retrurns zero if successful, or a negative error code on failure. */ int snd_register_device(int type, struct snd_card *card, int dev, - struct file_operations *f_ops, void *private_data, + const struct file_operations *f_ops, void *private_data, const char *name) { int minor; diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index 4023d3b406d..9055c6de958 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -95,7 +95,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev) } int snd_register_oss_device(int type, struct snd_card *card, int dev, - struct file_operations *f_ops, void *private_data, + const struct file_operations *f_ops, void *private_data, const char *name) { int minor = snd_oss_kernel_minor(type, card, dev); diff --git a/sound/sound_core.c b/sound/sound_core.c index 394b53e20cb..6f849720aef 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c @@ -53,7 +53,7 @@ struct sound_unit { int unit_minor; - struct file_operations *unit_fops; + const struct file_operations *unit_fops; struct sound_unit *next; char name[32]; }; @@ -73,7 +73,7 @@ EXPORT_SYMBOL(sound_class); * join into it. Called with the lock asserted */ -static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, struct file_operations *fops, int index, int low, int top) +static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, const struct file_operations *fops, int index, int low, int top) { int n=low; @@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock); * list. Acquires locks as needed */ -static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) +static int sound_insert_unit(struct sound_unit **list, const struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) { struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); int r; @@ -237,7 +237,7 @@ static struct sound_unit *chains[SOUND_STEP]; * a negative error code is returned. */ -int register_sound_special_device(struct file_operations *fops, int unit, +int register_sound_special_device(const struct file_operations *fops, int unit, struct device *dev) { const int chain = unit % SOUND_STEP; @@ -301,7 +301,7 @@ int register_sound_special_device(struct file_operations *fops, int unit, EXPORT_SYMBOL(register_sound_special_device); -int register_sound_special(struct file_operations *fops, int unit) +int register_sound_special(const struct file_operations *fops, int unit) { return register_sound_special_device(fops, unit, NULL); } @@ -318,7 +318,7 @@ EXPORT_SYMBOL(register_sound_special); * number is returned, on failure a negative error code is returned. */ -int register_sound_mixer(struct file_operations *fops, int dev) +int register_sound_mixer(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[0], fops, dev, 0, 128, "mixer", S_IRUSR | S_IWUSR, NULL); @@ -336,7 +336,7 @@ EXPORT_SYMBOL(register_sound_mixer); * number is returned, on failure a negative error code is returned. */ -int register_sound_midi(struct file_operations *fops, int dev) +int register_sound_midi(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[2], fops, dev, 2, 130, "midi", S_IRUSR | S_IWUSR, NULL); @@ -362,7 +362,7 @@ EXPORT_SYMBOL(register_sound_midi); * and will always allocate them as a matching pair - eg dsp3/audio3 */ -int register_sound_dsp(struct file_operations *fops, int dev) +int register_sound_dsp(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[3], fops, dev, 3, 131, "dsp", S_IWUSR | S_IRUSR, NULL); @@ -381,7 +381,7 @@ EXPORT_SYMBOL(register_sound_dsp); */ -int register_sound_synth(struct file_operations *fops, int dev) +int register_sound_synth(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[9], fops, dev, 9, 137, "synth", S_IRUSR | S_IWUSR, NULL); @@ -501,7 +501,7 @@ int soundcore_open(struct inode *inode, struct file *file) int chain; int unit = iminor(inode); struct sound_unit *s; - struct file_operations *new_fops = NULL; + const struct file_operations *new_fops = NULL; chain=unit&0x0F; if(chain==4 || chain==5) /* dsp/audio/dsp16 */ @@ -540,7 +540,7 @@ int soundcore_open(struct inode *inode, struct file *file) * switching ->f_op in the first place. */ int err = 0; - struct file_operations *old_fops = file->f_op; + const struct file_operations *old_fops = file->f_op; file->f_op = new_fops; spin_unlock(&sound_loader_lock); if(file->f_op->open) -- cgit v1.2.3-18-g5258 From 910638ae7ed4be27d6af55f6c9b5bf54b838e78b Mon Sep 17 00:00:00 2001 From: Matthias Gehre Date: Tue, 28 Mar 2006 01:56:48 -0800 Subject: [PATCH] Replace 0xff.. with correct DMA_xBIT_MASK Replace all occurences of 0xff.. in calls to function pci_set_dma_mask() and pci_set_consistant_dma_mask() with the corresponding DMA_xBIT_MASK from linux/dma-mapping.h. Signed-off-by: Matthias Gehre Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/esssolo1.c | 2 +- sound/oss/sonicvibes.c | 3 ++- sound/pci/ad1889.c | 1 + sound/pci/ali5451/ali5451.c | 5 +++-- sound/pci/als4000.c | 5 +++-- sound/pci/azt3328.c | 5 +++-- sound/pci/emu10k1/emu10k1x.c | 1 + sound/pci/es1938.c | 5 +++-- sound/pci/es1968.c | 1 + sound/pci/ice1712/ice1712.c | 2 ++ sound/pci/maestro3.c | 1 + sound/pci/mixart/mixart.c | 2 ++ sound/pci/pcxhr/pcxhr.c | 1 + sound/pci/sonicvibes.c | 5 +++-- sound/pci/trident/trident_main.c | 5 +++-- 15 files changed, 30 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c index 78d3e29ce96..6861563d752 100644 --- a/sound/oss/esssolo1.c +++ b/sound/oss/esssolo1.c @@ -2348,7 +2348,7 @@ static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device /* Recording requires 24-bit DMA, so attempt to set dma mask * to 24 bits first, then 32 bits (playback only) if that fails. */ - if (pci_set_dma_mask(pcidev, 0x00ffffff) && + if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK) && pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) { printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n"); return -ENODEV; diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c index 4471757b798..42bd276cfc3 100644 --- a/sound/oss/sonicvibes.c +++ b/sound/oss/sonicvibes.c @@ -116,6 +116,7 @@ #include #include #include +#include #include @@ -2535,7 +2536,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id return -ENODEV; if (pcidev->irq == 0) return -ENODEV; - if (pci_set_dma_mask(pcidev, 0x00ffffff)) { + if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK)) { printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n"); return -ENODEV; } diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 2aa5a7fdb6e..c6c8333acc6 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index e264136e8fb..fc92b6896c2 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -2220,8 +2221,8 @@ static int __devinit snd_ali_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 31 bits */ - if (pci_set_dma_mask(pci, 0x7fffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_31BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_31BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 7b2ff5f4672..100d8127a41 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -688,8 +689,8 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci, return err; } /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index e077eb3fbe2..680077e1e05 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -104,6 +104,7 @@ #include #include #include +#include #include #include #include @@ -1669,8 +1670,8 @@ snd_azf3328_create(struct snd_card *card, chip->irq = -1; /* check if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); err = -ENXIO; goto out_err; diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 2208dbd48be..3e332f39816 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 0d556b09ad0..4d62fe43917 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -1517,8 +1518,8 @@ static int __devinit snd_es1938_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index dd465a186e1..e3ad17f53c2 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -104,6 +104,7 @@ #include #include #include +#include #include #include diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 672e198317e..b88eeba2f5d 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -56,7 +56,9 @@ #include #include #include +#include #include + #include #include #include diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 8bc084956c2..44393e19092 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 43ee3b2b948..b5a095052d4 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include #include diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index f679779d96e..35875c8aa29 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 7bbea3738b8..2d66a09fe5e 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1227,8 +1228,8 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 83b7d8aba9e..52178b8ad49 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -3554,8 +3555,8 @@ int __devinit snd_trident_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 30 bits */ - if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_30BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; -- cgit v1.2.3-18-g5258 From 457d3d432bede99ed04d3bdeb5efb238a3627e8f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Tue, 28 Mar 2006 01:56:49 -0800 Subject: [PATCH] vfree NULL check fixup for sb_card There's no need to check the vfree() argument for NULL. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/sb_card.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index d38e88abc8f..4708cbdc314 100644 --- a/sound/oss/sb_card.c +++ b/sound/oss/sb_card.c @@ -348,10 +348,8 @@ static void __exit sb_exit(void) sb_unregister_all(); - if (smw_free) { - vfree(smw_free); - smw_free = NULL; - } + vfree(smw_free); + smw_free = NULL; } module_init(sb_init); -- cgit v1.2.3-18-g5258 From 07e0e93d9a3cdbe3cad450e0d0a2937585dffc55 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Tue, 28 Mar 2006 01:56:49 -0800 Subject: [PATCH] maestro3 vfree NULL check fixup vfree() checks for NULL, no need to do it explicitly. Signed-off-by: Jesper Juhl Acked-by: Zach Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/maestro3.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c index 66044aff258..4a5e4237a11 100644 --- a/sound/oss/maestro3.c +++ b/sound/oss/maestro3.c @@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m3_card *card) return 0; } -static void free_dsp_suspendmem(struct m3_card *card) -{ - if(card->suspend_mem) - vfree(card->suspend_mem); -} #else #define alloc_dsp_suspendmem(args...) 0 -#define free_dsp_suspendmem(args...) #endif /* @@ -2717,7 +2711,7 @@ out: if(ret) { if(card->iobase) release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - free_dsp_suspendmem(card); + vfree(card->suspend_mem); if(card->ac97) { unregister_sound_mixer(card->ac97->dev_mixer); kfree(card->ac97); @@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pci_dev) } release_region(card->iobase, 256); - free_dsp_suspendmem(card); + vfree(card->suspend_mem); kfree(card); } devs = NULL; -- cgit v1.2.3-18-g5258 From 5a83fdddb8a104c021837637a59f93948b906819 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Tue, 28 Mar 2006 01:56:50 -0800 Subject: [PATCH] no need to check vfree arg for null in oss/sequencer There's no need to check pointers for NULL before handing them to vfree(). Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/sequencer.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 347cd79c250..6815c30e0bc 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c @@ -1671,14 +1671,7 @@ void sequencer_init(void) void sequencer_unload(void) { - if(queue) - { - vfree(queue); - queue=NULL; - } - if(iqueue) - { - vfree(iqueue); - iqueue=NULL; - } + vfree(queue); + vfree(iqueue); + queue = iqueue = NULL; } -- cgit v1.2.3-18-g5258 From ca43b317fc557bbcca845c684d93375286bf9e0b Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Tue, 28 Mar 2006 01:56:51 -0800 Subject: [PATCH] vfree does its own NULL check, no need to be explicit in oss/msnd.c vfree() does it's own NULL checking, no need for explicit check before calling it. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/msnd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c index a7ad2b0a2ac..5dbfc0f9c3c 100644 --- a/sound/oss/msnd.c +++ b/sound/oss/msnd.c @@ -95,10 +95,8 @@ void msnd_fifo_init(msnd_fifo *f) void msnd_fifo_free(msnd_fifo *f) { - if (f->data) { - vfree(f->data); - f->data = NULL; - } + vfree(f->data); + f->data = NULL; } int msnd_fifo_alloc(msnd_fifo *f, size_t n) -- cgit v1.2.3-18-g5258 From 7f927fcc2fd1575d01efb4b76665975007945690 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 28 Mar 2006 01:56:53 -0800 Subject: [PATCH] Typo fixes Fix a lot of typos. Eyeballed by jmc@ in OpenBSD. Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/pci/rme32.c | 8 ++++---- sound/pci/rme96.c | 8 ++++---- sound/pci/rme9652/hdspm.c | 2 +- sound/usb/usx2y/usx2yhwdeppcm.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 0cbef5fe6c6..ab78544bf04 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -313,7 +313,7 @@ static int snd_rme32_capture_copy(struct snd_pcm_substream *substream, int chann } /* - * SPDIF I/O capabilites (half-duplex mode) + * SPDIF I/O capabilities (half-duplex mode) */ static struct snd_pcm_hardware snd_rme32_spdif_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | @@ -339,7 +339,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_info = { }; /* - * ADAT I/O capabilites (half-duplex mode) + * ADAT I/O capabilities (half-duplex mode) */ static struct snd_pcm_hardware snd_rme32_adat_info = { @@ -364,7 +364,7 @@ static struct snd_pcm_hardware snd_rme32_adat_info = }; /* - * SPDIF I/O capabilites (full-duplex mode) + * SPDIF I/O capabilities (full-duplex mode) */ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { .info = (SNDRV_PCM_INFO_MMAP | @@ -390,7 +390,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { }; /* - * ADAT I/O capabilites (full-duplex mode) + * ADAT I/O capabilities (full-duplex mode) */ static struct snd_pcm_hardware snd_rme32_adat_fd_info = { diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 0e694b011dc..6c2a9f4a765 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -359,7 +359,7 @@ snd_rme96_capture_copy(struct snd_pcm_substream *substream, } /* - * Digital output capabilites (S/PDIF) + * Digital output capabilities (S/PDIF) */ static struct snd_pcm_hardware snd_rme96_playback_spdif_info = { @@ -388,7 +388,7 @@ static struct snd_pcm_hardware snd_rme96_playback_spdif_info = }; /* - * Digital input capabilites (S/PDIF) + * Digital input capabilities (S/PDIF) */ static struct snd_pcm_hardware snd_rme96_capture_spdif_info = { @@ -417,7 +417,7 @@ static struct snd_pcm_hardware snd_rme96_capture_spdif_info = }; /* - * Digital output capabilites (ADAT) + * Digital output capabilities (ADAT) */ static struct snd_pcm_hardware snd_rme96_playback_adat_info = { @@ -442,7 +442,7 @@ static struct snd_pcm_hardware snd_rme96_playback_adat_info = }; /* - * Digital input capabilites (ADAT) + * Digital input capabilities (ADAT) */ static struct snd_pcm_hardware snd_rme96_capture_adat_info = { diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 980b9cd689d..b5538efd146 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -2256,7 +2256,7 @@ static int snd_hdspm_create_controls(struct snd_card *card, struct hdspm * hdspm } /* Channel playback mixer as default control - Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats to big for any alsamixer + Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats too big for any alsamixer they are accesible via special IOCTL on hwdep and the mixer 2dimensional mixer control */ diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 315855082fe..fe67a92e2a1 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c @@ -404,7 +404,7 @@ static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs) struct usX2Ydev * usX2Y = subs->usX2Y; usX2Y->prepare_subs = subs; subs->urb[0]->start_frame = -1; - smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup() + smp_wmb(); // Make sure above modifications are seen by i_usX2Y_subs_startup() usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); } -- cgit v1.2.3-18-g5258 From 4fa95ef639830ccf0ca1ad42ee9bed87ef642f32 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Tue, 28 Mar 2006 01:56:54 -0800 Subject: [PATCH] sound: Remove unneeded kmalloc() return value casts Get rid of unnessesary casts of kmalloc() return value in sound/ Signed-off-by: Jesper Juhl Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/core/rawmidi.c | 6 ++++-- sound/oss/dmasound/dmasound_awacs.c | 2 +- sound/oss/emu10k1/midi.c | 9 ++++++--- sound/oss/sh_dac_audio.c | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 6b7a3677429..87b47c9564f 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -631,7 +631,8 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, return -EINVAL; } if (params->buffer_size != runtime->buffer_size) { - if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) + newbuf = kmalloc(params->buffer_size, GFP_KERNEL); + if (!newbuf) return -ENOMEM; kfree(runtime->buffer); runtime->buffer = newbuf; @@ -657,7 +658,8 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, return -EINVAL; } if (params->buffer_size != runtime->buffer_size) { - if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) + newbuf = kmalloc(params->buffer_size, GFP_KERNEL); + if (!newbuf) return -ENOMEM; kfree(runtime->buffer); runtime->buffer = newbuf; diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c index 6ba8d6f45fe..3bbc8105e9f 100644 --- a/sound/oss/dmasound/dmasound_awacs.c +++ b/sound/oss/dmasound/dmasound_awacs.c @@ -2798,7 +2798,7 @@ __init setup_beep(void) DBDMA_ALIGN(beep_dbdma_cmd_space); /* set up emergency dbdma cmd */ emergency_dbdma_cmd = beep_dbdma_cmd+1 ; - beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); + beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); if (beep_buf == NULL) { printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); kfree(beep_dbdma_cmd_space) ; diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c index 959a96794db..25ae8e4a488 100644 --- a/sound/oss/emu10k1/midi.c +++ b/sound/oss/emu10k1/midi.c @@ -65,7 +65,8 @@ static int midiin_add_buffer(struct emu10k1_mididevice *midi_dev, struct midi_hd init_midi_hdr(midihdr); - if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(MIDIIN_BUFLEN, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -1; @@ -334,7 +335,8 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, midihdr->bytesrecorded = 0; midihdr->flags = 0; - if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(count, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -EINVAL; @@ -545,7 +547,8 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte) midihdr->bytesrecorded = 0; midihdr->flags = 0; - if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(1, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -EINVAL; diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 8a9917c919c..3f7427cd195 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c @@ -289,7 +289,7 @@ static int __init dac_audio_init(void) in_use = 0; - data_buffer = (char *)kmalloc(BUFFER_SIZE, GFP_KERNEL); + data_buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL); if (data_buffer == NULL) return -ENOMEM; -- cgit v1.2.3-18-g5258