Re: [PATCHv3 net-next] net: modernize ioremap in probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  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





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux