aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2009-10-22 12:09:47 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-11-30 20:02:52 -0500
commit6427d45068dd4357c44a5a623e5efb6990eb43c9 (patch)
tree666b0ffa7b839c0aea064c52e4b55e39e8f93d0a /arch
parent4092855d9634fd0cce879b0f47a7e128f86d869e (diff)
[ARM] pxa: use platform_device_id table for SSP driver
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/ssp.c73
1 files changed, 15 insertions, 58 deletions
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 965e38c6bafe..9ebe658590fa 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -342,8 +342,9 @@ void ssp_free(struct ssp_device *ssp)
342} 342}
343EXPORT_SYMBOL(ssp_free); 343EXPORT_SYMBOL(ssp_free);
344 344
345static int __devinit ssp_probe(struct platform_device *pdev, int type) 345static int __devinit ssp_probe(struct platform_device *pdev)
346{ 346{
347 const struct platform_device_id *id = platform_get_device_id(pdev);
347 struct resource *res; 348 struct resource *res;
348 struct ssp_device *ssp; 349 struct ssp_device *ssp;
349 int ret = 0; 350 int ret = 0;
@@ -413,7 +414,7 @@ static int __devinit ssp_probe(struct platform_device *pdev, int type)
413 */ 414 */
414 ssp->port_id = pdev->id + 1; 415 ssp->port_id = pdev->id + 1;
415 ssp->use_count = 0; 416 ssp->use_count = 0;
416 ssp->type = type; 417 ssp->type = (int)id->driver_data;
417 418
418 mutex_lock(&ssp_lock); 419 mutex_lock(&ssp_lock);
419 list_add(&ssp->node, &ssp_list); 420 list_add(&ssp->node, &ssp_list);
@@ -457,75 +458,31 @@ static int __devexit ssp_remove(struct platform_device *pdev)
457 return 0; 458 return 0;
458} 459}
459 460
460static int __devinit pxa25x_ssp_probe(struct platform_device *pdev) 461static const struct platform_device_id ssp_id_table[] = {
461{ 462 { "pxa25x-ssp", PXA25x_SSP },
462 return ssp_probe(pdev, PXA25x_SSP); 463 { "pxa25x-nssp", PXA25x_NSSP },
463} 464 { "pxa27x-ssp", PXA27x_SSP },
464 465 { },
465static int __devinit pxa25x_nssp_probe(struct platform_device *pdev)
466{
467 return ssp_probe(pdev, PXA25x_NSSP);
468}
469
470static int __devinit pxa27x_ssp_probe(struct platform_device *pdev)
471{
472 return ssp_probe(pdev, PXA27x_SSP);
473}
474
475static struct platform_driver pxa25x_ssp_driver = {
476 .driver = {
477 .name = "pxa25x-ssp",
478 },
479 .probe = pxa25x_ssp_probe,
480 .remove = __devexit_p(ssp_remove),
481}; 466};
482 467
483static struct platform_driver pxa25x_nssp_driver = { 468static struct platform_driver ssp_driver = {
484 .driver = { 469 .probe = ssp_probe,
485 .name = "pxa25x-nssp",
486 },
487 .probe = pxa25x_nssp_probe,
488 .remove = __devexit_p(ssp_remove), 470 .remove = __devexit_p(ssp_remove),
489};
490
491static struct platform_driver pxa27x_ssp_driver = {
492 .driver = { 471 .driver = {
493 .name = "pxa27x-ssp", 472 .owner = THIS_MODULE,
473 .name = "pxa2xx-ssp",
494 }, 474 },
495 .probe = pxa27x_ssp_probe, 475 .id_table = ssp_id_table,
496 .remove = __devexit_p(ssp_remove),
497}; 476};
498 477
499static int __init pxa_ssp_init(void) 478static int __init pxa_ssp_init(void)
500{ 479{
501 int ret = 0; 480 return platform_driver_register(&ssp_driver);
502
503 ret = platform_driver_register(&pxa25x_ssp_driver);
504 if (ret) {
505 printk(KERN_ERR "failed to register pxa25x_ssp_driver");
506 return ret;
507 }
508
509 ret = platform_driver_register(&pxa25x_nssp_driver);
510 if (ret) {
511 printk(KERN_ERR "failed to register pxa25x_nssp_driver");
512 return ret;
513 }
514
515 ret = platform_driver_register(&pxa27x_ssp_driver);
516 if (ret) {
517 printk(KERN_ERR "failed to register pxa27x_ssp_driver");
518 return ret;
519 }
520
521 return ret;
522} 481}
523 482
524static void __exit pxa_ssp_exit(void) 483static void __exit pxa_ssp_exit(void)
525{ 484{
526 platform_driver_unregister(&pxa25x_ssp_driver); 485 platform_driver_unregister(&ssp_driver);
527 platform_driver_unregister(&pxa25x_nssp_driver);
528 platform_driver_unregister(&pxa27x_ssp_driver);
529} 486}
530 487
531arch_initcall(pxa_ssp_init); 488arch_initcall(pxa_ssp_init);