diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 22:32:44 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 22:32:44 +0000 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /sound | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) | |
download | linux-3.10-3ae5eaec1d2d9c0cf53745352e7d4b152810ba24.tar.gz linux-3.10-3ae5eaec1d2d9c0cf53745352e7d4b152810ba24.tar.bz2 linux-3.10-3ae5eaec1d2d9c0cf53745352e7d4b152810ba24.zip |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/arm/pxa2xx-ac97.c | 35 | ||||
-rw-r--r-- | sound/core/init.c | 17 | ||||
-rw-r--r-- | sound/core/sound.c | 8 |
3 files changed, 31 insertions, 29 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index d1f9da49872..c96c8a2aa1c 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -275,9 +275,9 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card) return 0; } -static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) +static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) { - snd_card_t *card = dev_get_drvdata(_dev); + snd_card_t *card = platform_get_drvdata(dev); int ret = 0; if (card) @@ -286,9 +286,9 @@ static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) return ret; } -static int pxa2xx_ac97_resume(struct device *_dev) +static int pxa2xx_ac97_resume(struct platform_device *dev) { - snd_card_t *card = dev_get_drvdata(_dev); + snd_card_t *card = platform_get_drvdata(dev); int ret = 0; if (card) @@ -302,7 +302,7 @@ static int pxa2xx_ac97_resume(struct device *_dev) #define pxa2xx_ac97_resume NULL #endif -static int pxa2xx_ac97_probe(struct device *dev) +static int pxa2xx_ac97_probe(struct platform_device *dev) { snd_card_t *card; ac97_bus_t *ac97_bus; @@ -315,8 +315,8 @@ static int pxa2xx_ac97_probe(struct device *dev) if (!card) goto err; - card->dev = dev; - strncpy(card->driver, dev->driver->name, sizeof(card->driver)); + card->dev = &dev->dev; + strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver)); ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); if (ret) @@ -347,13 +347,13 @@ static int pxa2xx_ac97_probe(struct device *dev) snprintf(card->shortname, sizeof(card->shortname), "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97)); snprintf(card->longname, sizeof(card->longname), - "%s (%s)", dev->driver->name, card->mixername); + "%s (%s)", dev->dev.driver->name, card->mixername); snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, pxa2xx_ac97_do_resume, NULL); ret = snd_card_register(card); if (ret == 0) { - dev_set_drvdata(dev, card); + platform_set_drvdata(dev, card); return 0; } @@ -368,13 +368,13 @@ static int pxa2xx_ac97_probe(struct device *dev) return ret; } -static int pxa2xx_ac97_remove(struct device *dev) +static int pxa2xx_ac97_remove(struct platform_device *dev) { - snd_card_t *card = dev_get_drvdata(dev); + snd_card_t *card = platform_get_drvdata(dev); if (card) { snd_card_free(card); - dev_set_drvdata(dev, NULL); + platform_set_drvdata(dev, NULL); GCR |= GCR_ACLINK_OFF; free_irq(IRQ_AC97, NULL); pxa_set_cken(CKEN2_AC97, 0); @@ -383,23 +383,24 @@ static int pxa2xx_ac97_remove(struct device *dev) return 0; } -static struct device_driver pxa2xx_ac97_driver = { - .name = "pxa2xx-ac97", - .bus = &platform_bus_type, +static struct platform_driver pxa2xx_ac97_driver = { .probe = pxa2xx_ac97_probe, .remove = pxa2xx_ac97_remove, .suspend = pxa2xx_ac97_suspend, .resume = pxa2xx_ac97_resume, + .driver = { + .name = "pxa2xx-ac97", + }, }; static int __init pxa2xx_ac97_init(void) { - return driver_register(&pxa2xx_ac97_driver); + return platform_driver_register(&pxa2xx_ac97_driver); } static void __exit pxa2xx_ac97_exit(void) { - driver_unregister(&pxa2xx_ac97_driver); + platform_driver_unregister(&pxa2xx_ac97_driver); } module_init(pxa2xx_ac97_init); diff --git a/sound/core/init.c b/sound/core/init.c index d9ee27ae9a5..33813f92ab5 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -674,23 +674,24 @@ struct snd_generic_device { snd_card_t *card; }; -#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card +#define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card #define SND_GENERIC_NAME "snd_generic" #ifdef CONFIG_PM -static int snd_generic_suspend(struct device *dev, pm_message_t state); -static int snd_generic_resume(struct device *dev); +static int snd_generic_suspend(struct platform_device *dev, pm_message_t state); +static int snd_generic_resume(struct platform_device *dev); #endif /* initialized in sound.c */ -struct device_driver snd_generic_driver = { - .name = SND_GENERIC_NAME, - .bus = &platform_bus_type, +struct platform_driver snd_generic_driver = { #ifdef CONFIG_PM .suspend = snd_generic_suspend, .resume = snd_generic_resume, #endif + .driver = { + .name = SND_GENERIC_NAME, + }, }; void snd_generic_device_release(struct device *dev) @@ -821,7 +822,7 @@ int snd_card_set_pm_callback(snd_card_t *card, #ifdef CONFIG_SND_GENERIC_DRIVER /* suspend/resume callbacks for snd_generic platform device */ -static int snd_generic_suspend(struct device *dev, pm_message_t state) +static int snd_generic_suspend(struct platform_device *dev, pm_message_t state) { snd_card_t *card; @@ -834,7 +835,7 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state) return 0; } -static int snd_generic_resume(struct device *dev) +static int snd_generic_resume(struct platform_device *dev) { snd_card_t *card; diff --git a/sound/core/sound.c b/sound/core/sound.c index 1139dd8ca8e..6e7cad1e947 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -32,7 +32,7 @@ #include <sound/initval.h> #include <linux/kmod.h> #include <linux/devfs_fs_kernel.h> -#include <linux/device.h> +#include <linux/platform_device.h> #define SNDRV_OS_MINORS 256 @@ -329,7 +329,7 @@ int __exit snd_minor_info_done(void) */ #ifdef CONFIG_SND_GENERIC_DRIVER -extern struct device_driver snd_generic_driver; +extern struct platform_driver snd_generic_driver; #endif static int __init alsa_sound_init(void) @@ -357,7 +357,7 @@ static int __init alsa_sound_init(void) } snd_info_minor_register(); #ifdef CONFIG_SND_GENERIC_DRIVER - driver_register(&snd_generic_driver); + platform_driver_register(&snd_generic_driver); #endif for (controlnum = 0; controlnum < cards_limit; controlnum++) devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); @@ -375,7 +375,7 @@ static void __exit alsa_sound_exit(void) devfs_remove("snd/controlC%d", controlnum); #ifdef CONFIG_SND_GENERIC_DRIVER - driver_unregister(&snd_generic_driver); + platform_driver_unregister(&snd_generic_driver); #endif snd_info_minor_unregister(); snd_info_done(); |