aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/omap_wdt.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2014-02-11 07:44:12 -0500
committerWim Van Sebroeck <wim@iguana.be>2014-03-31 07:24:31 -0400
commit6e272061391946fe28cadd5f9fbab1bab82b3748 (patch)
tree877a80a683a420b6a9fc8b102551ea9a19d54ad3 /drivers/watchdog/omap_wdt.c
parent4f6120b014c6a981a57a8951e01acfead1a57069 (diff)
watchdog: omap_wdt: Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler, and remove 'struct resource *mem' from 'struct omap_wdt_dev' and omap_wdt_probe(), resplectively. because the 'mem' variables are not used anymore. Also the redundant return value check of platform_get_resource() is removed, because the value is checked by devm_ioremap_resource(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/omap_wdt.c')
-rw-r--r--drivers/watchdog/omap_wdt.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index fbcb6f6a809d..3691b157516a 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -57,7 +57,6 @@ struct omap_wdt_dev {
57 void __iomem *base; /* physical */ 57 void __iomem *base; /* physical */
58 struct device *dev; 58 struct device *dev;
59 bool omap_wdt_users; 59 bool omap_wdt_users;
60 struct resource *mem;
61 int wdt_trgr_pattern; 60 int wdt_trgr_pattern;
62 struct mutex lock; /* to avoid races with PM */ 61 struct mutex lock; /* to avoid races with PM */
63}; 62};
@@ -206,7 +205,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
206{ 205{
207 struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev); 206 struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
208 struct watchdog_device *omap_wdt; 207 struct watchdog_device *omap_wdt;
209 struct resource *res, *mem; 208 struct resource *res;
210 struct omap_wdt_dev *wdev; 209 struct omap_wdt_dev *wdev;
211 u32 rs; 210 u32 rs;
212 int ret; 211 int ret;
@@ -215,29 +214,20 @@ static int omap_wdt_probe(struct platform_device *pdev)
215 if (!omap_wdt) 214 if (!omap_wdt)
216 return -ENOMEM; 215 return -ENOMEM;
217 216
218 /* reserve static register mappings */
219 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
220 if (!res)
221 return -ENOENT;
222
223 mem = devm_request_mem_region(&pdev->dev, res->start,
224 resource_size(res), pdev->name);
225 if (!mem)
226 return -EBUSY;
227
228 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); 217 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
229 if (!wdev) 218 if (!wdev)
230 return -ENOMEM; 219 return -ENOMEM;
231 220
232 wdev->omap_wdt_users = false; 221 wdev->omap_wdt_users = false;
233 wdev->mem = mem;
234 wdev->dev = &pdev->dev; 222 wdev->dev = &pdev->dev;
235 wdev->wdt_trgr_pattern = 0x1234; 223 wdev->wdt_trgr_pattern = 0x1234;
236 mutex_init(&wdev->lock); 224 mutex_init(&wdev->lock);
237 225
238 wdev->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 226 /* reserve static register mappings */
239 if (!wdev->base) 227 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
240 return -ENOMEM; 228 wdev->base = devm_ioremap_resource(&pdev->dev, res);
229 if (IS_ERR(wdev->base))
230 return PTR_ERR(wdev->base);
241 231
242 omap_wdt->info = &omap_wdt_info; 232 omap_wdt->info = &omap_wdt_info;
243 omap_wdt->ops = &omap_wdt_ops; 233 omap_wdt->ops = &omap_wdt_ops;