aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-10-17 13:17:56 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-11-11 13:06:03 -0500
commitb36bdc5911effe819e415b144388853bf07a543b (patch)
treeae04570b767d79febf0d32a351964e1ad602a007 /drivers
parent585583f54f577d7fd93247101b9f61c8bbbd21f1 (diff)
pinctrl/u300: use managed resources
This converts the U300 pin controller to use managed resources (devm_*) for it's memory region. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/pinctrl-u300.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index 309f5b9a70ec..2e9825e304af 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -663,8 +663,6 @@ static const struct pinctrl_pin_desc u300_pads[] = {
663struct u300_pmx { 663struct u300_pmx {
664 struct device *dev; 664 struct device *dev;
665 struct pinctrl_dev *pctl; 665 struct pinctrl_dev *pctl;
666 u32 phybase;
667 u32 physize;
668 void __iomem *virtbase; 666 void __iomem *virtbase;
669}; 667};
670 668
@@ -1110,7 +1108,6 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
1110 struct u300_pmx *upmx; 1108 struct u300_pmx *upmx;
1111 struct resource *res; 1109 struct resource *res;
1112 struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev); 1110 struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev);
1113 int ret;
1114 int i; 1111 int i;
1115 1112
1116 /* Create state holders etc for this driver */ 1113 /* Create state holders etc for this driver */
@@ -1123,26 +1120,15 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
1123 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1120 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1124 if (!res) 1121 if (!res)
1125 return -ENOENT; 1122 return -ENOENT;
1126 upmx->phybase = res->start;
1127 upmx->physize = resource_size(res);
1128
1129 if (request_mem_region(upmx->phybase, upmx->physize,
1130 DRIVER_NAME) == NULL) {
1131 ret = -ENOMEM;
1132 goto out_no_memregion;
1133 }
1134 1123
1135 upmx->virtbase = ioremap(upmx->phybase, upmx->physize); 1124 upmx->virtbase = devm_request_and_ioremap(&pdev->dev, res);
1136 if (!upmx->virtbase) { 1125 if (!upmx->virtbase)
1137 ret = -ENOMEM; 1126 return -ENOMEM;
1138 goto out_no_remap;
1139 }
1140 1127
1141 upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx); 1128 upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
1142 if (!upmx->pctl) { 1129 if (!upmx->pctl) {
1143 dev_err(&pdev->dev, "could not register U300 pinmux driver\n"); 1130 dev_err(&pdev->dev, "could not register U300 pinmux driver\n");
1144 ret = -EINVAL; 1131 return -EINVAL;
1145 goto out_no_pmx;
1146 } 1132 }
1147 1133
1148 /* We will handle a range of GPIO pins */ 1134 /* We will handle a range of GPIO pins */
@@ -1156,14 +1142,6 @@ static int __devinit u300_pmx_probe(struct platform_device *pdev)
1156 dev_info(&pdev->dev, "initialized U300 pin control driver\n"); 1142 dev_info(&pdev->dev, "initialized U300 pin control driver\n");
1157 1143
1158 return 0; 1144 return 0;
1159
1160out_no_pmx:
1161 iounmap(upmx->virtbase);
1162out_no_remap:
1163 platform_set_drvdata(pdev, NULL);
1164out_no_memregion:
1165 release_mem_region(upmx->phybase, upmx->physize);
1166 return ret;
1167} 1145}
1168 1146
1169static int __devexit u300_pmx_remove(struct platform_device *pdev) 1147static int __devexit u300_pmx_remove(struct platform_device *pdev)
@@ -1171,8 +1149,6 @@ static int __devexit u300_pmx_remove(struct platform_device *pdev)
1171 struct u300_pmx *upmx = platform_get_drvdata(pdev); 1149 struct u300_pmx *upmx = platform_get_drvdata(pdev);
1172 1150
1173 pinctrl_unregister(upmx->pctl); 1151 pinctrl_unregister(upmx->pctl);
1174 iounmap(upmx->virtbase);
1175 release_mem_region(upmx->phybase, upmx->physize);
1176 platform_set_drvdata(pdev, NULL); 1152 platform_set_drvdata(pdev, NULL);
1177 1153
1178 return 0; 1154 return 0;