aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ti_am335x_tscadc.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2014-02-12 00:31:49 -0500
committerLee Jones <lee.jones@linaro.org>2014-03-19 04:58:13 -0400
commit924ff918ad8c7e5665b05d9c7b258623c88d65c5 (patch)
tree71dec6b0035696df513080423733b40cd4404c08 /drivers/mfd/ti_am335x_tscadc.c
parentbcb5a7d335da73a798d8a8f6ce9a8605d25426f4 (diff)
mfd: ti_am335x_tscadc: Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler, and remove redundant return value check of platform_get_resource() because the value is checked by devm_ioremap_resource(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/ti_am335x_tscadc.c')
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 6000c49a352c..dd4bf5816221 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -183,12 +183,6 @@ static int ti_tscadc_probe(struct platform_device *pdev)
183 return -EINVAL; 183 return -EINVAL;
184 } 184 }
185 185
186 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
187 if (!res) {
188 dev_err(&pdev->dev, "no memory resource defined.\n");
189 return -EINVAL;
190 }
191
192 /* Allocate memory for device */ 186 /* Allocate memory for device */
193 tscadc = devm_kzalloc(&pdev->dev, 187 tscadc = devm_kzalloc(&pdev->dev,
194 sizeof(struct ti_tscadc_dev), GFP_KERNEL); 188 sizeof(struct ti_tscadc_dev), GFP_KERNEL);
@@ -205,19 +199,10 @@ static int ti_tscadc_probe(struct platform_device *pdev)
205 } else 199 } else
206 tscadc->irq = err; 200 tscadc->irq = err;
207 201
208 res = devm_request_mem_region(&pdev->dev, 202 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
209 res->start, resource_size(res), pdev->name); 203 tscadc->tscadc_base = devm_ioremap_resource(&pdev->dev, res);
210 if (!res) { 204 if (IS_ERR(tscadc->tscadc_base))
211 dev_err(&pdev->dev, "failed to reserve registers.\n"); 205 return PTR_ERR(tscadc->tscadc_base);
212 return -EBUSY;
213 }
214
215 tscadc->tscadc_base = devm_ioremap(&pdev->dev,
216 res->start, resource_size(res));
217 if (!tscadc->tscadc_base) {
218 dev_err(&pdev->dev, "failed to map registers.\n");
219 return -ENOMEM;
220 }
221 206
222 tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev, 207 tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev,
223 tscadc->tscadc_base, &tscadc_regmap_config); 208 tscadc->tscadc_base, &tscadc_regmap_config);