aboutsummaryrefslogtreecommitdiffstats
path: root/sound/arm/pxa2xx-ac97.c
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/arm/pxa2xx-ac97.c
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/arm/pxa2xx-ac97.c')
-rw-r--r--sound/arm/pxa2xx-ac97.c35
1 files changed, 18 insertions, 17 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);