aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPaulius Zaleckas <paulius.zaleckas@teltonika.lt>2008-07-09 09:03:17 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-07-26 19:26:15 -0400
commit5fc63dfba8a016caf832572aeaa90abef82f0ba0 (patch)
treedfa412a594558f7c9ec163681e21e2e78c979580 /drivers/mmc
parent322069c9df1fd4da269b2a57d78f753684962523 (diff)
imxmmc: fix platform resources
Fixup platform resources handling. Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt> Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/imxmmc.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index 77493339303b..9cda12fba9aa 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -901,26 +901,6 @@ static const struct mmc_host_ops imxmci_ops = {
901 .get_ro = imxmci_get_ro, 901 .get_ro = imxmci_get_ro,
902}; 902};
903 903
904static struct resource *platform_device_resource(struct platform_device *dev, unsigned int mask, int nr)
905{
906 int i;
907
908 for (i = 0; i < dev->num_resources; i++)
909 if (dev->resource[i].flags == mask && nr-- == 0)
910 return &dev->resource[i];
911 return NULL;
912}
913
914static int platform_device_irq(struct platform_device *dev, int nr)
915{
916 int i;
917
918 for (i = 0; i < dev->num_resources; i++)
919 if (dev->resource[i].flags == IORESOURCE_IRQ && nr-- == 0)
920 return dev->resource[i].start;
921 return NO_IRQ;
922}
923
924static void imxmci_check_status(unsigned long data) 904static void imxmci_check_status(unsigned long data)
925{ 905{
926 struct imxmci_host *host = (struct imxmci_host *)data; 906 struct imxmci_host *host = (struct imxmci_host *)data;
@@ -956,13 +936,12 @@ static int imxmci_probe(struct platform_device *pdev)
956 936
957 printk(KERN_INFO "i.MX mmc driver\n"); 937 printk(KERN_INFO "i.MX mmc driver\n");
958 938
959 r = platform_device_resource(pdev, IORESOURCE_MEM, 0); 939 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
960 irq = platform_device_irq(pdev, 0); 940 irq = platform_get_irq(pdev, 0);
961 if (!r || irq == NO_IRQ) 941 if (!r || irq < 0)
962 return -ENXIO; 942 return -ENXIO;
963 943
964 r = request_mem_region(r->start, 0x100, "IMXMCI"); 944 if (!request_mem_region(r->start, 0x100, pdev->name))
965 if (!r)
966 return -EBUSY; 945 return -EBUSY;
967 946
968 mmc = mmc_alloc_host(sizeof(struct imxmci_host), &pdev->dev); 947 mmc = mmc_alloc_host(sizeof(struct imxmci_host), &pdev->dev);
@@ -1067,7 +1046,7 @@ out:
1067 } 1046 }
1068 if (mmc) 1047 if (mmc)
1069 mmc_free_host(mmc); 1048 mmc_free_host(mmc);
1070 release_resource(r); 1049 release_mem_region(r->start, 0x100);
1071 return ret; 1050 return ret;
1072} 1051}
1073 1052
@@ -1096,7 +1075,7 @@ static int imxmci_remove(struct platform_device *pdev)
1096 clk_disable(host->clk); 1075 clk_disable(host->clk);
1097 clk_put(host->clk); 1076 clk_put(host->clk);
1098 1077
1099 release_resource(host->res); 1078 release_mem_region(host->res->start, 0x100);
1100 1079
1101 mmc_free_host(mmc); 1080 mmc_free_host(mmc);
1102 } 1081 }