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>
This commit is contained in:
Родитель
4f6120b014
Коммит
6e27206139
|
@ -57,7 +57,6 @@ struct omap_wdt_dev {
|
||||||
void __iomem *base; /* physical */
|
void __iomem *base; /* physical */
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
bool omap_wdt_users;
|
bool omap_wdt_users;
|
||||||
struct resource *mem;
|
|
||||||
int wdt_trgr_pattern;
|
int wdt_trgr_pattern;
|
||||||
struct mutex lock; /* to avoid races with PM */
|
struct mutex lock; /* to avoid races with PM */
|
||||||
};
|
};
|
||||||
|
@ -206,7 +205,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||||
struct watchdog_device *omap_wdt;
|
struct watchdog_device *omap_wdt;
|
||||||
struct resource *res, *mem;
|
struct resource *res;
|
||||||
struct omap_wdt_dev *wdev;
|
struct omap_wdt_dev *wdev;
|
||||||
u32 rs;
|
u32 rs;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -215,29 +214,20 @@ static int omap_wdt_probe(struct platform_device *pdev)
|
||||||
if (!omap_wdt)
|
if (!omap_wdt)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* reserve static register mappings */
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
||||||
if (!res)
|
|
||||||
return -ENOENT;
|
|
||||||
|
|
||||||
mem = devm_request_mem_region(&pdev->dev, res->start,
|
|
||||||
resource_size(res), pdev->name);
|
|
||||||
if (!mem)
|
|
||||||
return -EBUSY;
|
|
||||||
|
|
||||||
wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
|
wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
|
||||||
if (!wdev)
|
if (!wdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
wdev->omap_wdt_users = false;
|
wdev->omap_wdt_users = false;
|
||||||
wdev->mem = mem;
|
|
||||||
wdev->dev = &pdev->dev;
|
wdev->dev = &pdev->dev;
|
||||||
wdev->wdt_trgr_pattern = 0x1234;
|
wdev->wdt_trgr_pattern = 0x1234;
|
||||||
mutex_init(&wdev->lock);
|
mutex_init(&wdev->lock);
|
||||||
|
|
||||||
wdev->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
|
/* reserve static register mappings */
|
||||||
if (!wdev->base)
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
return -ENOMEM;
|
wdev->base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
if (IS_ERR(wdev->base))
|
||||||
|
return PTR_ERR(wdev->base);
|
||||||
|
|
||||||
omap_wdt->info = &omap_wdt_info;
|
omap_wdt->info = &omap_wdt_info;
|
||||||
omap_wdt->ops = &omap_wdt_ops;
|
omap_wdt->ops = &omap_wdt_ops;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче