From 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 9 Nov 2005 22:32:44 +0000 Subject: [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 Acked-by: Greg Kroah-Hartman --- sound/core/init.c | 17 +++++++++-------- sound/core/sound.c | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'sound/core') diff --git a/sound/core/init.c b/sound/core/init.c index d9ee27ae9a51..33813f92ab52 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 1139dd8ca8eb..6e7cad1e947e 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #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(); -- cgit v1.2.1