mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2] watchdog: davinci_wdt: update to devm_* API
@ 2013-02-08  7:39 Kumar, Anil
  2013-02-18  3:42 ` Kumar, Anil
  2013-02-19 19:43 ` [PATCH V2] watchdog: davinci_wdt: update to devm_* API Wim Van Sebroeck
  0 siblings, 2 replies; 4+ messages in thread
From: Kumar, Anil @ 2013-02-08  7:39 UTC (permalink / raw)
  To: linux-watchdog, linux-kernel, davinci-linux-open-source
  Cc: wim, nsekhar, anilkumar.v

Update the code to use devm_* API so that driver
core will manage resources.

Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
---
This patch applies on top of v3.8-rc6.

Tested on da850 EVM.

Changes for V2:
 - Use return -EADDRNOTAVAIL in case of devm_request_and_ioremap() fail.
 - Use devm_clk_get() instead of clk_get().
 - Revert back the change for *dev.
 - Removes static type for "wdt_mem" structure as it is used only
   inside the function now. 

:100644 100644 e8e8724... 7df1fdc... M	drivers/watchdog/davinci_wdt.c
 drivers/watchdog/davinci_wdt.c |   29 ++++++-----------------------
 1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index e8e8724..7df1fdc 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -69,7 +69,6 @@ static unsigned long wdt_status;
 #define WDT_REGION_INITED 2
 #define WDT_DEVICE_INITED 3
 
-static struct resource	*wdt_mem;
 static void __iomem	*wdt_base;
 struct clk		*wdt_clk;
 
@@ -201,10 +200,11 @@ static struct miscdevice davinci_wdt_miscdev = {
 
 static int davinci_wdt_probe(struct platform_device *pdev)
 {
-	int ret = 0, size;
+	int ret = 0;
 	struct device *dev = &pdev->dev;
+	struct resource  *wdt_mem;
 
-	wdt_clk = clk_get(dev, NULL);
+	wdt_clk = devm_clk_get(dev, NULL);
 	if (WARN_ON(IS_ERR(wdt_clk)))
 		return PTR_ERR(wdt_clk);
 
@@ -221,43 +221,26 @@ static int davinci_wdt_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	size = resource_size(wdt_mem);
-	if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
-		dev_err(dev, "failed to get memory region\n");
-		return -ENOENT;
-	}
-
-	wdt_base = ioremap(wdt_mem->start, size);
+	wdt_base = devm_request_and_ioremap(dev, wdt_mem);
 	if (!wdt_base) {
-		dev_err(dev, "failed to map memory region\n");
-		release_mem_region(wdt_mem->start, size);
-		wdt_mem = NULL;
-		return -ENOMEM;
+		dev_err(dev, "ioremap failed\n");
+		return -EADDRNOTAVAIL;
 	}
 
 	ret = misc_register(&davinci_wdt_miscdev);
 	if (ret < 0) {
 		dev_err(dev, "cannot register misc device\n");
-		release_mem_region(wdt_mem->start, size);
-		wdt_mem = NULL;
 	} else {
 		set_bit(WDT_DEVICE_INITED, &wdt_status);
 	}
 
-	iounmap(wdt_base);
 	return ret;
 }
 
 static int davinci_wdt_remove(struct platform_device *pdev)
 {
 	misc_deregister(&davinci_wdt_miscdev);
-	if (wdt_mem) {
-		release_mem_region(wdt_mem->start, resource_size(wdt_mem));
-		wdt_mem = NULL;
-	}
-
 	clk_disable_unprepare(wdt_clk);
-	clk_put(wdt_clk);
 
 	return 0;
 }
-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH V2] watchdog: davinci_wdt: update to devm_* API
  2013-02-08  7:39 [PATCH V2] watchdog: davinci_wdt: update to devm_* API Kumar, Anil
@ 2013-02-18  3:42 ` Kumar, Anil
  2013-02-18  5:06   ` Please don't send update emails to me cstsai
  2013-02-19 19:43 ` [PATCH V2] watchdog: davinci_wdt: update to devm_* API Wim Van Sebroeck
  1 sibling, 1 reply; 4+ messages in thread
From: Kumar, Anil @ 2013-02-18  3:42 UTC (permalink / raw)
  To: linux-watchdog, linux-kernel, davinci-linux-open-source
  Cc: wim, Nori, Sekhar, Kumar, Anil

Hi,

On Fri, Feb 08, 2013 at 13:09:30, Kumar, Anil wrote:
> Update the code to use devm_* API so that driver
> core will manage resources.
> 
> Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
> ---
> This patch applies on top of v3.8-rc6.
> 
> Tested on da850 EVM.
> 
> Changes for V2:
>  - Use return -EADDRNOTAVAIL in case of devm_request_and_ioremap() fail.
>  - Use devm_clk_get() instead of clk_get().
>  - Revert back the change for *dev.
>  - Removes static type for "wdt_mem" structure as it is used only
>    inside the function now. 
>

Gentle Ping. As there are no review comments on this patch,
Could you please pull this patch ?    


> :100644 100644 e8e8724... 7df1fdc... M	drivers/watchdog/davinci_wdt.c
>  drivers/watchdog/davinci_wdt.c |   29 ++++++-----------------------
>  1 files changed, 6 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index e8e8724..7df1fdc 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -69,7 +69,6 @@ static unsigned long wdt_status;
>  #define WDT_REGION_INITED 2
>  #define WDT_DEVICE_INITED 3
>  
> -static struct resource	*wdt_mem;
>  static void __iomem	*wdt_base;
>  struct clk		*wdt_clk;
>  
> @@ -201,10 +200,11 @@ static struct miscdevice davinci_wdt_miscdev = {
>  
>  static int davinci_wdt_probe(struct platform_device *pdev)
>  {
> -	int ret = 0, size;
> +	int ret = 0;
>  	struct device *dev = &pdev->dev;
> +	struct resource  *wdt_mem;
>  
> -	wdt_clk = clk_get(dev, NULL);
> +	wdt_clk = devm_clk_get(dev, NULL);
>  	if (WARN_ON(IS_ERR(wdt_clk)))
>  		return PTR_ERR(wdt_clk);
>  
> @@ -221,43 +221,26 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>  		return -ENOENT;
>  	}
>  
> -	size = resource_size(wdt_mem);
> -	if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
> -		dev_err(dev, "failed to get memory region\n");
> -		return -ENOENT;
> -	}
> -
> -	wdt_base = ioremap(wdt_mem->start, size);
> +	wdt_base = devm_request_and_ioremap(dev, wdt_mem);
>  	if (!wdt_base) {
> -		dev_err(dev, "failed to map memory region\n");
> -		release_mem_region(wdt_mem->start, size);
> -		wdt_mem = NULL;
> -		return -ENOMEM;
> +		dev_err(dev, "ioremap failed\n");
> +		return -EADDRNOTAVAIL;
>  	}
>  
>  	ret = misc_register(&davinci_wdt_miscdev);
>  	if (ret < 0) {
>  		dev_err(dev, "cannot register misc device\n");
> -		release_mem_region(wdt_mem->start, size);
> -		wdt_mem = NULL;
>  	} else {
>  		set_bit(WDT_DEVICE_INITED, &wdt_status);
>  	}
>  
> -	iounmap(wdt_base);
>  	return ret;
>  }
>  
>  static int davinci_wdt_remove(struct platform_device *pdev)
>  {
>  	misc_deregister(&davinci_wdt_miscdev);
> -	if (wdt_mem) {
> -		release_mem_region(wdt_mem->start, resource_size(wdt_mem));
> -		wdt_mem = NULL;
> -	}
> -
>  	clk_disable_unprepare(wdt_clk);
> -	clk_put(wdt_clk);
>  
>  	return 0;
>  }
> -- 
> 1.7.4.1
> 
> 

Thanks,
Anil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Please don't send update emails to me
  2013-02-18  3:42 ` Kumar, Anil
@ 2013-02-18  5:06   ` cstsai
  0 siblings, 0 replies; 4+ messages in thread
From: cstsai @ 2013-02-18  5:06 UTC (permalink / raw)
  To: Kumar, Anil, linux-watchdog, linux-kernel, davinci-linux-open-source; +Cc: wim

Please don't send update emails to me

Whenever I need I can check from website

Thanks & Regards





Chun-Shian Tsai



----- Original Message ----- 
From: "Kumar, Anil" <anilkumar.v@ti.com>
To: <linux-watchdog@vger.kernel.org>; <linux-kernel@vger.kernel.org>; 
<davinci-linux-open-source@linux.davincidsp.com>
Cc: <wim@iguana.be>
Sent: Monday, February 18, 2013 11:42 AM
Subject: RE: [PATCH V2] watchdog: davinci_wdt: update to devm_* API


Hi,

On Fri, Feb 08, 2013 at 13:09:30, Kumar, Anil wrote:
> Update the code to use devm_* API so that driver
> core will manage resources.
>
> Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
> ---
> This patch applies on top of v3.8-rc6.
>
> Tested on da850 EVM.
>
> Changes for V2:
>  - Use return -EADDRNOTAVAIL in case of devm_request_and_ioremap() fail.
>  - Use devm_clk_get() instead of clk_get().
>  - Revert back the change for *dev.
>  - Removes static type for "wdt_mem" structure as it is used only
>    inside the function now.
>

Gentle Ping. As there are no review comments on this patch,
Could you please pull this patch ?


> :100644 100644 e8e8724... 7df1fdc... M drivers/watchdog/davinci_wdt.c
>  drivers/watchdog/davinci_wdt.c |   29 ++++++-----------------------
>  1 files changed, 6 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/watchdog/davinci_wdt.c 
> b/drivers/watchdog/davinci_wdt.c
> index e8e8724..7df1fdc 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -69,7 +69,6 @@ static unsigned long wdt_status;
>  #define WDT_REGION_INITED 2
>  #define WDT_DEVICE_INITED 3
>
> -static struct resource *wdt_mem;
>  static void __iomem *wdt_base;
>  struct clk *wdt_clk;
>
> @@ -201,10 +200,11 @@ static struct miscdevice davinci_wdt_miscdev = {
>
>  static int davinci_wdt_probe(struct platform_device *pdev)
>  {
> - int ret = 0, size;
> + int ret = 0;
>  struct device *dev = &pdev->dev;
> + struct resource  *wdt_mem;
>
> - wdt_clk = clk_get(dev, NULL);
> + wdt_clk = devm_clk_get(dev, NULL);
>  if (WARN_ON(IS_ERR(wdt_clk)))
>  return PTR_ERR(wdt_clk);
>
> @@ -221,43 +221,26 @@ static int davinci_wdt_probe(struct platform_device 
> *pdev)
>  return -ENOENT;
>  }
>
> - size = resource_size(wdt_mem);
> - if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
> - dev_err(dev, "failed to get memory region\n");
> - return -ENOENT;
> - }
> -
> - wdt_base = ioremap(wdt_mem->start, size);
> + wdt_base = devm_request_and_ioremap(dev, wdt_mem);
>  if (!wdt_base) {
> - dev_err(dev, "failed to map memory region\n");
> - release_mem_region(wdt_mem->start, size);
> - wdt_mem = NULL;
> - return -ENOMEM;
> + dev_err(dev, "ioremap failed\n");
> + return -EADDRNOTAVAIL;
>  }
>
>  ret = misc_register(&davinci_wdt_miscdev);
>  if (ret < 0) {
>  dev_err(dev, "cannot register misc device\n");
> - release_mem_region(wdt_mem->start, size);
> - wdt_mem = NULL;
>  } else {
>  set_bit(WDT_DEVICE_INITED, &wdt_status);
>  }
>
> - iounmap(wdt_base);
>  return ret;
>  }
>
>  static int davinci_wdt_remove(struct platform_device *pdev)
>  {
>  misc_deregister(&davinci_wdt_miscdev);
> - if (wdt_mem) {
> - release_mem_region(wdt_mem->start, resource_size(wdt_mem));
> - wdt_mem = NULL;
> - }
> -
>  clk_disable_unprepare(wdt_clk);
> - clk_put(wdt_clk);
>
>  return 0;
>  }
> -- 
> 1.7.4.1
>
>

Thanks,
Anil
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source 

====================================================================
This email may contain confidential information. Please do not use or disclose it in any way and delete it if you are not the intended recipient.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] watchdog: davinci_wdt: update to devm_* API
  2013-02-08  7:39 [PATCH V2] watchdog: davinci_wdt: update to devm_* API Kumar, Anil
  2013-02-18  3:42 ` Kumar, Anil
@ 2013-02-19 19:43 ` Wim Van Sebroeck
  1 sibling, 0 replies; 4+ messages in thread
From: Wim Van Sebroeck @ 2013-02-19 19:43 UTC (permalink / raw)
  To: Kumar, Anil
  Cc: linux-watchdog, linux-kernel, davinci-linux-open-source, nsekhar

Hi Kumar,

> Update the code to use devm_* API so that driver
> core will manage resources.
> 
> Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>

Added to linux-watchdog-next.

Kind regards,
Wim.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-19 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08  7:39 [PATCH V2] watchdog: davinci_wdt: update to devm_* API Kumar, Anil
2013-02-18  3:42 ` Kumar, Anil
2013-02-18  5:06   ` Please don't send update emails to me cstsai
2013-02-19 19:43 ` [PATCH V2] watchdog: davinci_wdt: update to devm_* API Wim Van Sebroeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®