aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /sound
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff)
[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.c35
-rw-r--r--sound/core/init.c17
-rw-r--r--sound/core/sound.c8
3 files changed, 31 insertions, 29 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index d1f9da498729..c96c8a2aa1c2 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)
275 return 0; 275 return 0;
276} 276}
277 277
278static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) 278static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state)
279{ 279{
280 snd_card_t *card = dev_get_drvdata(_dev); 280 snd_card_t *card = platform_get_drvdata(dev);
281 int ret = 0; 281 int ret = 0;
282 282
283 if (card) 283 if (card)
@@ -286,9 +286,9 @@ static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state)
286 return ret; 286 return ret;
287} 287}
288 288
289static int pxa2xx_ac97_resume(struct device *_dev) 289static int pxa2xx_ac97_resume(struct platform_device *dev)
290{ 290{
291 snd_card_t *card = dev_get_drvdata(_dev); 291 snd_card_t *card = platform_get_drvdata(dev);
292 int ret = 0; 292 int ret = 0;
293 293
294 if (card) 294 if (card)
@@ -302,7 +302,7 @@ static int pxa2xx_ac97_resume(struct device *_dev)
302#define pxa2xx_ac97_resume NULL 302#define pxa2xx_ac97_resume NULL
303#endif 303#endif
304 304
305static int pxa2xx_ac97_probe(struct device *dev) 305static int pxa2xx_ac97_probe(struct platform_device *dev)
306{ 306{
307 snd_card_t *card; 307 snd_card_t *card;
308 ac97_bus_t *ac97_bus; 308 ac97_bus_t *ac97_bus;
@@ -315,8 +315,8 @@ static int pxa2xx_ac97_probe(struct device *dev)
315 if (!card) 315 if (!card)
316 goto err; 316 goto err;
317 317
318 card->dev = dev; 318 card->dev = &dev->dev;
319 strncpy(card->driver, dev->driver->name, sizeof(card->driver)); 319 strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
320 320
321 ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); 321 ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
322 if (ret) 322 if (ret)
@@ -347,13 +347,13 @@ static int pxa2xx_ac97_probe(struct device *dev)
347 snprintf(card->shortname, sizeof(card->shortname), 347 snprintf(card->shortname, sizeof(card->shortname),
348 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97)); 348 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
349 snprintf(card->longname, sizeof(card->longname), 349 snprintf(card->longname, sizeof(card->longname),
350 "%s (%s)", dev->driver->name, card->mixername); 350 "%s (%s)", dev->dev.driver->name, card->mixername);
351 351
352 snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, 352 snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend,
353 pxa2xx_ac97_do_resume, NULL); 353 pxa2xx_ac97_do_resume, NULL);
354 ret = snd_card_register(card); 354 ret = snd_card_register(card);
355 if (ret == 0) { 355 if (ret == 0) {
356 dev_set_drvdata(dev, card); 356 platform_set_drvdata(dev, card);
357 return 0; 357 return 0;
358 } 358 }
359 359
@@ -368,13 +368,13 @@ static int pxa2xx_ac97_probe(struct device *dev)
368 return ret; 368 return ret;
369} 369}
370 370
371static int pxa2xx_ac97_remove(struct device *dev) 371static int pxa2xx_ac97_remove(struct platform_device *dev)
372{ 372{
373 snd_card_t *card = dev_get_drvdata(dev); 373 snd_card_t *card = platform_get_drvdata(dev);
374 374
375 if (card) { 375 if (card) {
376 snd_card_free(card); 376 snd_card_free(card);
377 dev_set_drvdata(dev, NULL); 377 platform_set_drvdata(dev, NULL);
378 GCR |= GCR_ACLINK_OFF; 378 GCR |= GCR_ACLINK_OFF;
379 free_irq(IRQ_AC97, NULL); 379 free_irq(IRQ_AC97, NULL);
380 pxa_set_cken(CKEN2_AC97, 0); 380 pxa_set_cken(CKEN2_AC97, 0);
@@ -383,23 +383,24 @@ static int pxa2xx_ac97_remove(struct device *dev)
383 return 0; 383 return 0;
384} 384}
385 385
386static struct device_driver pxa2xx_ac97_driver = { 386static struct platform_driver pxa2xx_ac97_driver = {
387 .name = "pxa2xx-ac97",
388 .bus = &platform_bus_type,
389 .probe = pxa2xx_ac97_probe, 387 .probe = pxa2xx_ac97_probe,
390 .remove = pxa2xx_ac97_remove, 388 .remove = pxa2xx_ac97_remove,
391 .suspend = pxa2xx_ac97_suspend, 389 .suspend = pxa2xx_ac97_suspend,
392 .resume = pxa2xx_ac97_resume, 390 .resume = pxa2xx_ac97_resume,
391 .driver = {
392 .name = "pxa2xx-ac97",
393 },
393}; 394};
394 395
395static int __init pxa2xx_ac97_init(void) 396static int __init pxa2xx_ac97_init(void)
396{ 397{
397 return driver_register(&pxa2xx_ac97_driver); 398 return platform_driver_register(&pxa2xx_ac97_driver);
398} 399}
399 400
400static void __exit pxa2xx_ac97_exit(void) 401static void __exit pxa2xx_ac97_exit(void)
401{ 402{
402 driver_unregister(&pxa2xx_ac97_driver); 403 platform_driver_unregister(&pxa2xx_ac97_driver);
403} 404}
404 405
405module_init(pxa2xx_ac97_init); 406module_init(pxa2xx_ac97_init);
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 {
674 snd_card_t *card; 674 snd_card_t *card;
675}; 675};
676 676
677#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card 677#define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card
678 678
679#define SND_GENERIC_NAME "snd_generic" 679#define SND_GENERIC_NAME "snd_generic"
680 680
681#ifdef CONFIG_PM 681#ifdef CONFIG_PM
682static int snd_generic_suspend(struct device *dev, pm_message_t state); 682static int snd_generic_suspend(struct platform_device *dev, pm_message_t state);
683static int snd_generic_resume(struct device *dev); 683static int snd_generic_resume(struct platform_device *dev);
684#endif 684#endif
685 685
686/* initialized in sound.c */ 686/* initialized in sound.c */
687struct device_driver snd_generic_driver = { 687struct platform_driver snd_generic_driver = {
688 .name = SND_GENERIC_NAME,
689 .bus = &platform_bus_type,
690#ifdef CONFIG_PM 688#ifdef CONFIG_PM
691 .suspend = snd_generic_suspend, 689 .suspend = snd_generic_suspend,
692 .resume = snd_generic_resume, 690 .resume = snd_generic_resume,
693#endif 691#endif
692 .driver = {
693 .name = SND_GENERIC_NAME,
694 },
694}; 695};
695 696
696void snd_generic_device_release(struct device *dev) 697void snd_generic_device_release(struct device *dev)
@@ -821,7 +822,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
821 822
822#ifdef CONFIG_SND_GENERIC_DRIVER 823#ifdef CONFIG_SND_GENERIC_DRIVER
823/* suspend/resume callbacks for snd_generic platform device */ 824/* suspend/resume callbacks for snd_generic platform device */
824static int snd_generic_suspend(struct device *dev, pm_message_t state) 825static int snd_generic_suspend(struct platform_device *dev, pm_message_t state)
825{ 826{
826 snd_card_t *card; 827 snd_card_t *card;
827 828
@@ -834,7 +835,7 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state)
834 return 0; 835 return 0;
835} 836}
836 837
837static int snd_generic_resume(struct device *dev) 838static int snd_generic_resume(struct platform_device *dev)
838{ 839{
839 snd_card_t *card; 840 snd_card_t *card;
840 841
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 @@
32#include <sound/initval.h> 32#include <sound/initval.h>
33#include <linux/kmod.h> 33#include <linux/kmod.h>
34#include <linux/devfs_fs_kernel.h> 34#include <linux/devfs_fs_kernel.h>
35#include <linux/device.h> 35#include <linux/platform_device.h>
36 36
37#define SNDRV_OS_MINORS 256 37#define SNDRV_OS_MINORS 256
38 38
@@ -329,7 +329,7 @@ int __exit snd_minor_info_done(void)
329 */ 329 */
330 330
331#ifdef CONFIG_SND_GENERIC_DRIVER 331#ifdef CONFIG_SND_GENERIC_DRIVER
332extern struct device_driver snd_generic_driver; 332extern struct platform_driver snd_generic_driver;
333#endif 333#endif
334 334
335static int __init alsa_sound_init(void) 335static int __init alsa_sound_init(void)
@@ -357,7 +357,7 @@ static int __init alsa_sound_init(void)
357 } 357 }
358 snd_info_minor_register(); 358 snd_info_minor_register();
359#ifdef CONFIG_SND_GENERIC_DRIVER 359#ifdef CONFIG_SND_GENERIC_DRIVER
360 driver_register(&snd_generic_driver); 360 platform_driver_register(&snd_generic_driver);
361#endif 361#endif
362 for (controlnum = 0; controlnum < cards_limit; controlnum++) 362 for (controlnum = 0; controlnum < cards_limit; controlnum++)
363 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); 363 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)
375 devfs_remove("snd/controlC%d", controlnum); 375 devfs_remove("snd/controlC%d", controlnum);
376 376
377#ifdef CONFIG_SND_GENERIC_DRIVER 377#ifdef CONFIG_SND_GENERIC_DRIVER
378 driver_unregister(&snd_generic_driver); 378 platform_driver_unregister(&snd_generic_driver);
379#endif 379#endif
380 snd_info_minor_unregister(); 380 snd_info_minor_unregister();
381 snd_info_done(); 381 snd_info_done();