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] [thread-next>] [day] [month] [year] [list]
Message-ID: <26a1dd4d-80b1-411a-abb5-92e20f5751e7@omp.ru>
Date: Tue, 19 Nov 2024 23:02:33 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Rosen Penev <rosenp@...il.com>, <netdev@...r.kernel.org>
CC: Kurt Kanzenbach <kurt@...utronix.de>, Andrew Lunn <andrew@...n.ch>,
	Vladimir Oltean <olteanv@...il.com>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
 Abeni <pabeni@...hat.com>, Chris Snook <chris.snook@...il.com>, Marcin Wojtas
	<marcin.s.wojtas@...il.com>, Russell King <linux@...linux.org.uk>, Yoshihiro
 Shimoda <yoshihiro.shimoda.uh@...esas.com>, Niklas Söderlund
	<niklas.soderlund@...natech.se>, Heiner Kallweit <hkallweit1@...il.com>,
	Richard Cochran <richardcochran@...il.com>, open list
	<linux-kernel@...r.kernel.org>, "open list:RENESAS ETHERNET SWITCH DRIVER"
	<linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCHv3 net-next] net: modernize ioremap in probe

On 11/18/24 12:27 AM, Rosen Penev wrote:

> Convert platform_get_resource_bynam + devm_ioremap_resource to
> devm_platform_ioremap_resource_byname.
> 
> Convert platform_get_resource + devm_ioremap_resource to
> devm_platform_ioremap_resource.
> 
> resource aquisition and ioremap can be performed in one step.
> 
> Signed-off-by: Rosen Penev <rosenp@...il.com>
> ---
>  v3: reworded commit message again. Also removed devm_ioremap
>  conversions. Even though they use normal resource, they are not
>  the same.
>  v2: fixed compilation errors on PPC and reworded commit message
>  drivers/net/dsa/hirschmann/hellcreek.c         | 18 +++---------------
>  drivers/net/ethernet/atheros/ag71xx.c          | 13 +++++--------
>  drivers/net/ethernet/broadcom/bcm63xx_enet.c   |  6 ++----
>  .../net/ethernet/marvell/mvpp2/mvpp2_main.c    | 14 +++++---------
>  drivers/net/ethernet/renesas/rswitch.c         |  9 +--------
>  drivers/net/ethernet/renesas/rtsn.c            | 10 ++--------
>  drivers/net/mdio/mdio-ipq4019.c                |  5 +----
>  7 files changed, 19 insertions(+), 56 deletions(-)
> 
> diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
> index 283ec5a6e23c..940c4fa6a924 100644
> --- a/drivers/net/dsa/hirschmann/hellcreek.c
> +++ b/drivers/net/dsa/hirschmann/hellcreek.c
[...]
> @@ -1982,23 +1981,12 @@ static int hellcreek_probe(struct platform_device *pdev)
>  
>  	hellcreek->dev = dev;
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tsn");
> -	if (!res) {
> -		dev_err(dev, "No memory region provided!\n");
> -		return -ENODEV;
> -	}
> -
> -	hellcreek->base = devm_ioremap_resource(dev, res);
> +	hellcreek->base = devm_platform_ioremap_resource_byname(pdev, "tsn");
>  	if (IS_ERR(hellcreek->base))
>  		return PTR_ERR(hellcreek->base);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ptp");
> -	if (!res) {
> -		dev_err(dev, "No PTP memory region provided!\n");
> -		return -ENODEV;
> -	}
> -
> -	hellcreek->ptp_base = devm_ioremap_resource(dev, res);
> +	hellcreek->ptp_base = 
> +		devm_platform_ioremap_resource_byname(pdev, "ptp");

   You have full 100 columns now, so doing this with 2 lines doesn't seem necessary --
checkpatch.pl shouldn't complain...

[...]

   Other than that, looks saner now... :-)

MBR, Sergey


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ