linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: iTCO_wdt: Make use of the helper function devm_platform_ioremap_resource()
@ 2021-09-07  7:42 Cai Huoqing
  2021-09-07 12:39 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-09-07  7:42 UTC (permalink / raw)
  To: caihuoqing; +Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/watchdog/iTCO_wdt.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index 643c6c2d0b72..ebf7e5bc1199 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -96,7 +96,6 @@ struct iTCO_wdt_private {
 	 * NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2),
 	 * or memory-mapped PMC register bit 4 (TCO version 3).
 	 */
-	struct resource *gcs_pmc_res;
 	unsigned long __iomem *gcs_pmc;
 	/* the lock for io operations */
 	spinlock_t io_lock;
@@ -503,10 +502,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
 	 */
 	if (p->iTCO_version >= 2 && p->iTCO_version < 6 &&
 	    !pdata->no_reboot_use_pmc) {
-		p->gcs_pmc_res = platform_get_resource(pdev,
-						       IORESOURCE_MEM,
-						       ICH_RES_MEM_GCS_PMC);
-		p->gcs_pmc = devm_ioremap_resource(dev, p->gcs_pmc_res);
+		p->gcs_pmc = devm_platform_ioremap_resource(pdev, ICH_RES_MEM_GCS_PMC);
 		if (IS_ERR(p->gcs_pmc))
 			return PTR_ERR(p->gcs_pmc);
 	}
-- 
2.25.1


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

* Re: [PATCH] watchdog: iTCO_wdt: Make use of the helper function devm_platform_ioremap_resource()
  2021-09-07  7:42 [PATCH] watchdog: iTCO_wdt: Make use of the helper function devm_platform_ioremap_resource() Cai Huoqing
@ 2021-09-07 12:39 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-09-07 12:39 UTC (permalink / raw)
  To: Cai Huoqing; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Tue, Sep 07, 2021 at 03:42:29PM +0800, Cai Huoqing wrote:
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/iTCO_wdt.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
> index 643c6c2d0b72..ebf7e5bc1199 100644
> --- a/drivers/watchdog/iTCO_wdt.c
> +++ b/drivers/watchdog/iTCO_wdt.c
> @@ -96,7 +96,6 @@ struct iTCO_wdt_private {
>  	 * NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2),
>  	 * or memory-mapped PMC register bit 4 (TCO version 3).
>  	 */
> -	struct resource *gcs_pmc_res;
>  	unsigned long __iomem *gcs_pmc;
>  	/* the lock for io operations */
>  	spinlock_t io_lock;
> @@ -503,10 +502,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
>  	 */
>  	if (p->iTCO_version >= 2 && p->iTCO_version < 6 &&
>  	    !pdata->no_reboot_use_pmc) {
> -		p->gcs_pmc_res = platform_get_resource(pdev,
> -						       IORESOURCE_MEM,
> -						       ICH_RES_MEM_GCS_PMC);
> -		p->gcs_pmc = devm_ioremap_resource(dev, p->gcs_pmc_res);
> +		p->gcs_pmc = devm_platform_ioremap_resource(pdev, ICH_RES_MEM_GCS_PMC);
>  		if (IS_ERR(p->gcs_pmc))
>  			return PTR_ERR(p->gcs_pmc);
>  	}
> -- 
> 2.25.1
> 

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

end of thread, other threads:[~2021-09-07 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  7:42 [PATCH] watchdog: iTCO_wdt: Make use of the helper function devm_platform_ioremap_resource() Cai Huoqing
2021-09-07 12:39 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).