aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bus
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-04-01 09:23:47 -0400
committerNishanth Menon <nm@ti.com>2014-05-05 15:32:01 -0400
commit56c4a0224add82ced3af81c3a898a228a0560720 (patch)
tree925fdabcee3fbbf28f4c3bcc5db7fc8061dd7d85 /drivers/bus
parentbae74510179bc6d2c71168eeef33b7b157e244d0 (diff)
drivers: bus: omap_l3: Convert to use devm_ioremap_resource()
We can then remove the iounmap() calls from probe and remove. Since the driver requests the resources via index we can do the mem resource request within a for loop. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Nishanth Menon <nm@ti.com> Tested-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/omap_l3_noc.c59
1 files changed, 11 insertions, 48 deletions
diff --git a/drivers/bus/omap_l3_noc.c b/drivers/bus/omap_l3_noc.c
index d25d727e7cfb..6f58be3c2f76 100644
--- a/drivers/bus/omap_l3_noc.c
+++ b/drivers/bus/omap_l3_noc.c
@@ -131,52 +131,24 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
131static int omap4_l3_probe(struct platform_device *pdev) 131static int omap4_l3_probe(struct platform_device *pdev)
132{ 132{
133 static struct omap4_l3 *l3; 133 static struct omap4_l3 *l3;
134 struct resource *res; 134 int ret, i;
135 int ret;
136 135
137 l3 = devm_kzalloc(&pdev->dev, sizeof(*l3), GFP_KERNEL); 136 l3 = devm_kzalloc(&pdev->dev, sizeof(*l3), GFP_KERNEL);
138 if (!l3) 137 if (!l3)
139 return -ENOMEM; 138 return -ENOMEM;
140 139
141 platform_set_drvdata(pdev, l3); 140 platform_set_drvdata(pdev, l3);
142 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
143 if (!res) {
144 dev_err(&pdev->dev, "couldn't find resource 0\n");
145 return -ENODEV;
146 }
147
148 l3->l3_base[0] = ioremap(res->start, resource_size(res));
149 if (!l3->l3_base[0]) {
150 dev_err(&pdev->dev, "ioremap failed\n");
151 return -ENOMEM;
152 }
153
154 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
155 if (!res) {
156 dev_err(&pdev->dev, "couldn't find resource 1\n");
157 ret = -ENODEV;
158 goto err1;
159 }
160 141
161 l3->l3_base[1] = ioremap(res->start, resource_size(res)); 142 /* Get mem resources */
162 if (!l3->l3_base[1]) { 143 for (i = 0; i < L3_MODULES; i++) {
163 dev_err(&pdev->dev, "ioremap failed\n"); 144 struct resource *res = platform_get_resource(pdev,
164 ret = -ENOMEM; 145 IORESOURCE_MEM, i);
165 goto err1;
166 }
167
168 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
169 if (!res) {
170 dev_err(&pdev->dev, "couldn't find resource 2\n");
171 ret = -ENODEV;
172 goto err2;
173 }
174 146
175 l3->l3_base[2] = ioremap(res->start, resource_size(res)); 147 l3->l3_base[i] = devm_ioremap_resource(&pdev->dev, res);
176 if (!l3->l3_base[2]) { 148 if (IS_ERR(l3->l3_base[i])) {
177 dev_err(&pdev->dev, "ioremap failed\n"); 149 dev_err(&pdev->dev, "ioremap %d failed\n", i);
178 ret = -ENOMEM; 150 return PTR_ERR(l3->l3_base[i]);
179 goto err2; 151 }
180 } 152 }
181 153
182 /* 154 /*
@@ -189,7 +161,7 @@ static int omap4_l3_probe(struct platform_device *pdev)
189 if (ret) { 161 if (ret) {
190 pr_crit("L3: request_irq failed to register for 0x%x\n", 162 pr_crit("L3: request_irq failed to register for 0x%x\n",
191 l3->debug_irq); 163 l3->debug_irq);
192 goto err3; 164 return ret;
193 } 165 }
194 166
195 l3->app_irq = platform_get_irq(pdev, 1); 167 l3->app_irq = platform_get_irq(pdev, 1);
@@ -206,12 +178,6 @@ static int omap4_l3_probe(struct platform_device *pdev)
206 178
207err4: 179err4:
208 free_irq(l3->debug_irq, l3); 180 free_irq(l3->debug_irq, l3);
209err3:
210 iounmap(l3->l3_base[2]);
211err2:
212 iounmap(l3->l3_base[1]);
213err1:
214 iounmap(l3->l3_base[0]);
215 return ret; 181 return ret;
216} 182}
217 183
@@ -221,9 +187,6 @@ static int omap4_l3_remove(struct platform_device *pdev)
221 187
222 free_irq(l3->app_irq, l3); 188 free_irq(l3->app_irq, l3);
223 free_irq(l3->debug_irq, l3); 189 free_irq(l3->debug_irq, l3);
224 iounmap(l3->l3_base[0]);
225 iounmap(l3->l3_base[1]);
226 iounmap(l3->l3_base[2]);
227 190
228 return 0; 191 return 0;
229} 192}