aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
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 /drivers/mmc
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 'drivers/mmc')
-rw-r--r--drivers/mmc/pxamci.c42
-rw-r--r--drivers/mmc/wbsd.c27
2 files changed, 35 insertions, 34 deletions
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index f31e247b2cbe..ee8f8a0420d1 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -428,9 +428,8 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs)
428 return IRQ_HANDLED; 428 return IRQ_HANDLED;
429} 429}
430 430
431static int pxamci_probe(struct device *dev) 431static int pxamci_probe(struct platform_device *pdev)
432{ 432{
433 struct platform_device *pdev = to_platform_device(dev);
434 struct mmc_host *mmc; 433 struct mmc_host *mmc;
435 struct pxamci_host *host = NULL; 434 struct pxamci_host *host = NULL;
436 struct resource *r; 435 struct resource *r;
@@ -445,7 +444,7 @@ static int pxamci_probe(struct device *dev)
445 if (!r) 444 if (!r)
446 return -EBUSY; 445 return -EBUSY;
447 446
448 mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev); 447 mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev);
449 if (!mmc) { 448 if (!mmc) {
450 ret = -ENOMEM; 449 ret = -ENOMEM;
451 goto out; 450 goto out;
@@ -474,7 +473,7 @@ static int pxamci_probe(struct device *dev)
474 host->pdata->ocr_mask : 473 host->pdata->ocr_mask :
475 MMC_VDD_32_33|MMC_VDD_33_34; 474 MMC_VDD_32_33|MMC_VDD_33_34;
476 475
477 host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); 476 host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL);
478 if (!host->sg_cpu) { 477 if (!host->sg_cpu) {
479 ret = -ENOMEM; 478 ret = -ENOMEM;
480 goto out; 479 goto out;
@@ -511,10 +510,10 @@ static int pxamci_probe(struct device *dev)
511 if (ret) 510 if (ret)
512 goto out; 511 goto out;
513 512
514 dev_set_drvdata(dev, mmc); 513 platform_set_drvdata(pdev, mmc);
515 514
516 if (host->pdata && host->pdata->init) 515 if (host->pdata && host->pdata->init)
517 host->pdata->init(dev, pxamci_detect_irq, mmc); 516 host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc);
518 517
519 mmc_add_host(mmc); 518 mmc_add_host(mmc);
520 519
@@ -527,7 +526,7 @@ static int pxamci_probe(struct device *dev)
527 if (host->base) 526 if (host->base)
528 iounmap(host->base); 527 iounmap(host->base);
529 if (host->sg_cpu) 528 if (host->sg_cpu)
530 dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); 529 dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
531 } 530 }
532 if (mmc) 531 if (mmc)
533 mmc_free_host(mmc); 532 mmc_free_host(mmc);
@@ -535,17 +534,17 @@ static int pxamci_probe(struct device *dev)
535 return ret; 534 return ret;
536} 535}
537 536
538static int pxamci_remove(struct device *dev) 537static int pxamci_remove(struct platform_device *pdev)
539{ 538{
540 struct mmc_host *mmc = dev_get_drvdata(dev); 539 struct mmc_host *mmc = platform_get_drvdata(pdev);
541 540
542 dev_set_drvdata(dev, NULL); 541 platform_set_drvdata(pdev, NULL);
543 542
544 if (mmc) { 543 if (mmc) {
545 struct pxamci_host *host = mmc_priv(mmc); 544 struct pxamci_host *host = mmc_priv(mmc);
546 545
547 if (host->pdata && host->pdata->exit) 546 if (host->pdata && host->pdata->exit)
548 host->pdata->exit(dev, mmc); 547 host->pdata->exit(&pdev->dev, mmc);
549 548
550 mmc_remove_host(mmc); 549 mmc_remove_host(mmc);
551 550
@@ -560,7 +559,7 @@ static int pxamci_remove(struct device *dev)
560 free_irq(host->irq, host); 559 free_irq(host->irq, host);
561 pxa_free_dma(host->dma); 560 pxa_free_dma(host->dma);
562 iounmap(host->base); 561 iounmap(host->base);
563 dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); 562 dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
564 563
565 release_resource(host->res); 564 release_resource(host->res);
566 565
@@ -570,9 +569,9 @@ static int pxamci_remove(struct device *dev)
570} 569}
571 570
572#ifdef CONFIG_PM 571#ifdef CONFIG_PM
573static int pxamci_suspend(struct device *dev, pm_message_t state) 572static int pxamci_suspend(struct platform_device *dev, pm_message_t state)
574{ 573{
575 struct mmc_host *mmc = dev_get_drvdata(dev); 574 struct mmc_host *mmc = platform_get_drvdata(dev);
576 int ret = 0; 575 int ret = 0;
577 576
578 if (mmc) 577 if (mmc)
@@ -581,9 +580,9 @@ static int pxamci_suspend(struct device *dev, pm_message_t state)
581 return ret; 580 return ret;
582} 581}
583 582
584static int pxamci_resume(struct device *dev) 583static int pxamci_resume(struct platform_device *dev)
585{ 584{
586 struct mmc_host *mmc = dev_get_drvdata(dev); 585 struct mmc_host *mmc = platform_get_drvdata(dev);
587 int ret = 0; 586 int ret = 0;
588 587
589 if (mmc) 588 if (mmc)
@@ -596,23 +595,24 @@ static int pxamci_resume(struct device *dev)
596#define pxamci_resume NULL 595#define pxamci_resume NULL
597#endif 596#endif
598 597
599static struct device_driver pxamci_driver = { 598static struct platform_driver pxamci_driver = {
600 .name = DRIVER_NAME,
601 .bus = &platform_bus_type,
602 .probe = pxamci_probe, 599 .probe = pxamci_probe,
603 .remove = pxamci_remove, 600 .remove = pxamci_remove,
604 .suspend = pxamci_suspend, 601 .suspend = pxamci_suspend,
605 .resume = pxamci_resume, 602 .resume = pxamci_resume,
603 .driver = {
604 .name = DRIVER_NAME,
605 },
606}; 606};
607 607
608static int __init pxamci_init(void) 608static int __init pxamci_init(void)
609{ 609{
610 return driver_register(&pxamci_driver); 610 return platform_driver_register(&pxamci_driver);
611} 611}
612 612
613static void __exit pxamci_exit(void) 613static void __exit pxamci_exit(void)
614{ 614{
615 driver_unregister(&pxamci_driver); 615 platform_driver_unregister(&pxamci_driver);
616} 616}
617 617
618module_init(pxamci_init); 618module_init(pxamci_init);
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index e954b8354fef..ea23a31fac90 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -1932,14 +1932,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp)
1932 * Non-PnP 1932 * Non-PnP
1933 */ 1933 */
1934 1934
1935static int __devinit wbsd_probe(struct device* dev) 1935static int __devinit wbsd_probe(struct platform_device* dev)
1936{ 1936{
1937 return wbsd_init(dev, io, irq, dma, 0); 1937 return wbsd_init(&dev->dev, io, irq, dma, 0);
1938} 1938}
1939 1939
1940static int __devexit wbsd_remove(struct device* dev) 1940static int __devexit wbsd_remove(struct platform_device* dev)
1941{ 1941{
1942 wbsd_shutdown(dev, 0); 1942 wbsd_shutdown(&dev->dev, 0);
1943 1943
1944 return 0; 1944 return 0;
1945} 1945}
@@ -1983,9 +1983,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev)
1983 1983
1984#ifdef CONFIG_PM 1984#ifdef CONFIG_PM
1985 1985
1986static int wbsd_suspend(struct device *dev, pm_message_t state) 1986static int wbsd_suspend(struct platform_device *dev, pm_message_t state)
1987{ 1987{
1988 struct mmc_host *mmc = dev_get_drvdata(dev); 1988 struct mmc_host *mmc = platform_get_drvdata(dev);
1989 struct wbsd_host *host; 1989 struct wbsd_host *host;
1990 int ret; 1990 int ret;
1991 1991
@@ -2005,9 +2005,9 @@ static int wbsd_suspend(struct device *dev, pm_message_t state)
2005 return 0; 2005 return 0;
2006} 2006}
2007 2007
2008static int wbsd_resume(struct device *dev) 2008static int wbsd_resume(struct platform_device *dev)
2009{ 2009{
2010 struct mmc_host *mmc = dev_get_drvdata(dev); 2010 struct mmc_host *mmc = platform_get_drvdata(dev);
2011 struct wbsd_host *host; 2011 struct wbsd_host *host;
2012 2012
2013 if (!mmc) 2013 if (!mmc)
@@ -2038,14 +2038,15 @@ static int wbsd_resume(struct device *dev)
2038 2038
2039static struct platform_device *wbsd_device; 2039static struct platform_device *wbsd_device;
2040 2040
2041static struct device_driver wbsd_driver = { 2041static struct platform_driver wbsd_driver = {
2042 .name = DRIVER_NAME,
2043 .bus = &platform_bus_type,
2044 .probe = wbsd_probe, 2042 .probe = wbsd_probe,
2045 .remove = wbsd_remove, 2043 .remove = wbsd_remove,
2046 2044
2047 .suspend = wbsd_suspend, 2045 .suspend = wbsd_suspend,
2048 .resume = wbsd_resume, 2046 .resume = wbsd_resume,
2047 .driver = {
2048 .name = DRIVER_NAME,
2049 },
2049}; 2050};
2050 2051
2051#ifdef CONFIG_PNP 2052#ifdef CONFIG_PNP
@@ -2085,7 +2086,7 @@ static int __init wbsd_drv_init(void)
2085 2086
2086 if (nopnp) 2087 if (nopnp)
2087 { 2088 {
2088 result = driver_register(&wbsd_driver); 2089 result = platform_driver_register(&wbsd_driver);
2089 if (result < 0) 2090 if (result < 0)
2090 return result; 2091 return result;
2091 2092
@@ -2111,7 +2112,7 @@ static void __exit wbsd_drv_exit(void)
2111 { 2112 {
2112 platform_device_unregister(wbsd_device); 2113 platform_device_unregister(wbsd_device);
2113 2114
2114 driver_unregister(&wbsd_driver); 2115 platform_driver_unregister(&wbsd_driver);
2115 } 2116 }
2116 2117
2117 DBG("unloaded\n"); 2118 DBG("unloaded\n");