lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <112ed5c1-1761-2d04-fd9c-49fc9ef3d8f7@mleia.com>
Date:   Fri, 5 Apr 2019 20:59:49 +0300
From:   Vladimir Zapolskiy <vz@...ia.com>
To:     Guenter Roeck <linux@...ck-us.net>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>
Cc:     linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
        Joel Stanley <joel@....id.au>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Baruch Siach <baruch@...s.co.il>,
        Keguang Zhang <keguang.zhang@...il.com>,
        Kevin Hilman <khilman@...libre.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Avi Fishman <avifishman70@...il.com>,
        Nancy Yuen <yuenn@...gle.com>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Wan ZongShun <mcuos.com@...il.com>,
        Michal Simek <michal.simek@...inx.com>,
        Sylvain Lemieux <slemieux.tyco@...il.com>,
        Kukjin Kim <kgene@...nel.org>, Barry Song <baohua@...nel.org>,
        Orson Zhai <orsonzhai@...il.com>,
        Patrice Chotard <patrice.chotard@...com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Chen-Yu Tsai <wens@...e.org>,
        Marc Gonzalez <marc.w.gonzalez@...e.fr>,
        Thierry Reding <thierry.reding@...il.com>,
        Shawn Guo <shawnguo@...nel.org>
Subject: Re: [PATCH] watchdog: Convert to use devm_platform_ioremap_resource

On 04/02/2019 10:01 PM, Guenter Roeck wrote:
> Use devm_platform_ioremap_resource to reduce source code size,
> improve readability, and reduce the likelyhood of bugs.
> 
> The conversion was done automatically with coccinelle using the
> following semantic patch.
> 
> @r@
> identifier res, pdev;
> expression a;
> expression index;
> expression e;
> @@
> 
> <+...
> - res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> - a = devm_ioremap_resource(e, res);
> + a = devm_platform_ioremap_resource(pdev, index);
> ...+>
> 
> @depends on r@
> identifier r.res;
> @@
> - struct resource *res;
>   ... when != res
> 
> @@
> identifier res, pdev;
> expression index;
> expression a;
> @@
> - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> - a = devm_ioremap_resource(&pdev->dev, res);
> + a = devm_platform_ioremap_resource(pdev, index);
> 
> Cc: Joel Stanley <joel@....id.au>
> Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>
> Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>
> Cc: Florian Fainelli <f.fainelli@...il.com>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Cc: Baruch Siach <baruch@...s.co.il>
> Cc: Keguang Zhang <keguang.zhang@...il.com>
> Cc: Vladimir Zapolskiy <vz@...ia.com>
> Cc: Kevin Hilman <khilman@...libre.com>
> Cc: Matthias Brugger <matthias.bgg@...il.com>
> Cc: Avi Fishman <avifishman70@...il.com>
> Cc: Nancy Yuen <yuenn@...gle.com>
> Cc: Brendan Higgins <brendanhiggins@...gle.com>
> Cc: Wan ZongShun <mcuos.com@...il.com>
> Cc: Michal Simek <michal.simek@...inx.com>
> Cc: Sylvain Lemieux <slemieux.tyco@...il.com>
> Cc: Kukjin Kim <kgene@...nel.org>
> Cc: Barry Song <baohua@...nel.org>
> Cc: Orson Zhai <orsonzhai@...il.com>
> Cc: Patrice Chotard <patrice.chotard@...com>
> Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>
> Cc: Maxime Ripard <maxime.ripard@...tlin.com>
> Cc: Chen-Yu Tsai <wens@...e.org>
> Cc: Marc Gonzalez <marc.w.gonzalez@...e.fr>
> Cc: Thierry Reding <thierry.reding@...il.com>
> Cc: Shawn Guo <shawnguo@...nel.org>
> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
> ---
>  drivers/watchdog/asm9260_wdt.c    | 4 +---
>  drivers/watchdog/aspeed_wdt.c     | 4 +---
>  drivers/watchdog/at91sam9_wdt.c   | 4 +---
>  drivers/watchdog/ath79_wdt.c      | 4 +---
>  drivers/watchdog/atlas7_wdt.c     | 4 +---
>  drivers/watchdog/bcm7038_wdt.c    | 4 +---
>  drivers/watchdog/bcm_kona_wdt.c   | 4 +---
>  drivers/watchdog/cadence_wdt.c    | 4 +---
>  drivers/watchdog/coh901327_wdt.c  | 4 +---
>  drivers/watchdog/davinci_wdt.c    | 4 +---
>  drivers/watchdog/digicolor_wdt.c  | 4 +---
>  drivers/watchdog/dw_wdt.c         | 4 +---
>  drivers/watchdog/ep93xx_wdt.c     | 4 +---
>  drivers/watchdog/ftwdt010_wdt.c   | 4 +---
>  drivers/watchdog/imgpdc_wdt.c     | 4 +---
>  drivers/watchdog/jz4740_wdt.c     | 4 +---
>  drivers/watchdog/lantiq_wdt.c     | 4 +---
>  drivers/watchdog/loongson1_wdt.c  | 4 +---
>  drivers/watchdog/lpc18xx_wdt.c    | 4 +---
>  drivers/watchdog/max63xx_wdt.c    | 4 +---
>  drivers/watchdog/meson_gxbb_wdt.c | 4 +---
>  drivers/watchdog/meson_wdt.c      | 4 +---
>  drivers/watchdog/moxart_wdt.c     | 4 +---
>  drivers/watchdog/mpc8xxx_wdt.c    | 3 +--
>  drivers/watchdog/mt7621_wdt.c     | 5 +----
>  drivers/watchdog/mtk_wdt.c        | 4 +---
>  drivers/watchdog/npcm_wdt.c       | 4 +---
>  drivers/watchdog/nuc900_wdt.c     | 4 +---
>  drivers/watchdog/of_xilinx_wdt.c  | 4 +---
>  drivers/watchdog/omap_wdt.c       | 4 +---
>  drivers/watchdog/orion_wdt.c      | 6 ++----
>  drivers/watchdog/pic32-dmt.c      | 4 +---
>  drivers/watchdog/pic32-wdt.c      | 4 +---
>  drivers/watchdog/pnx4008_wdt.c    | 4 +---
>  drivers/watchdog/renesas_wdt.c    | 4 +---
>  drivers/watchdog/rt2880_wdt.c     | 4 +---
>  drivers/watchdog/rtd119x_wdt.c    | 4 +---
>  drivers/watchdog/rza_wdt.c        | 4 +---
>  drivers/watchdog/s3c2410_wdt.c    | 4 +---
>  drivers/watchdog/sama5d4_wdt.c    | 4 +---
>  drivers/watchdog/sbsa_gwdt.c      | 7 ++-----
>  drivers/watchdog/shwdt.c          | 4 +---
>  drivers/watchdog/sirfsoc_wdt.c    | 4 +---
>  drivers/watchdog/sprd_wdt.c       | 4 +---
>  drivers/watchdog/st_lpc_wdt.c     | 4 +---
>  drivers/watchdog/stm32_iwdg.c     | 4 +---
>  drivers/watchdog/sunxi_wdt.c      | 4 +---
>  drivers/watchdog/tangox_wdt.c     | 4 +---
>  drivers/watchdog/tegra_wdt.c      | 4 +---
>  drivers/watchdog/ts72xx_wdt.c     | 7 ++-----
>  drivers/watchdog/txx9wdt.c        | 4 +---
>  drivers/watchdog/zx2967_wdt.c     | 4 +---
>  52 files changed, 55 insertions(+), 161 deletions(-)

[snip]

> diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c
> index 331cadb459ac..f6f66634cedf 100644
> --- a/drivers/watchdog/lpc18xx_wdt.c
> +++ b/drivers/watchdog/lpc18xx_wdt.c
> @@ -204,15 +204,13 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
>  {
>  	struct lpc18xx_wdt_dev *lpc18xx_wdt;
>  	struct device *dev = &pdev->dev;
> -	struct resource *res;
>  	int ret;
>  
>  	lpc18xx_wdt = devm_kzalloc(dev, sizeof(*lpc18xx_wdt), GFP_KERNEL);
>  	if (!lpc18xx_wdt)
>  		return -ENOMEM;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	lpc18xx_wdt->base = devm_ioremap_resource(dev, res);
> +	lpc18xx_wdt->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(lpc18xx_wdt->base))
>  		return PTR_ERR(lpc18xx_wdt->base);
>  

[snip]

> diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
> index 8e261799c84e..24c266a9e1dc 100644
> --- a/drivers/watchdog/pnx4008_wdt.c
> +++ b/drivers/watchdog/pnx4008_wdt.c
> @@ -185,13 +185,11 @@ static struct watchdog_device pnx4008_wdd = {
>  
>  static int pnx4008_wdt_probe(struct platform_device *pdev)
>  {
> -	struct resource *r;
>  	int ret = 0;
>  
>  	watchdog_init_timeout(&pnx4008_wdd, heartbeat, &pdev->dev);
>  
> -	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	wdt_base = devm_ioremap_resource(&pdev->dev, r);
> +	wdt_base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(wdt_base))
>  		return PTR_ERR(wdt_base);
>  

For lpc18xx_wdt.c and pnx4008_wdt.c:

Acked-by: Vladimir Zapolskiy <vz@...ia.com>

--
Best wishes,
Vladimir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ