[PATCH] clk: lan966x: use devm_platform_ioremap_resource()

Rosen Penev posted 1 patch 1 month, 1 week ago
drivers/clk/clk-lan966x.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
[PATCH] clk: lan966x: use devm_platform_ioremap_resource()
Posted by Rosen Penev 1 month, 1 week ago
Use it as another instance is used above. This one is optional so treat
it as such.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/clk/clk-lan966x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c
index 3c7a48c616bb..8c7b273eb756 100644
--- a/drivers/clk/clk-lan966x.c
+++ b/drivers/clk/clk-lan966x.c
@@ -253,7 +253,6 @@ static int lan966x_clk_probe(struct platform_device *pdev)
 	struct clk_hw_onecell_data *hw_data;
 	struct device *dev = &pdev->dev;
 	void __iomem *gate_base;
-	struct resource *res;
 	int i, ret;
 
 	data = device_get_match_data(dev);
@@ -283,12 +282,8 @@ static int lan966x_clk_probe(struct platform_device *pdev)
 		}
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (res) {
-		gate_base = devm_ioremap_resource(&pdev->dev, res);
-		if (IS_ERR(gate_base))
-			return PTR_ERR(gate_base);
-
+	gate_base = devm_platform_ioremap_resource(pdev, 1);
+	if (!IS_ERR(gate_base)) {
 		hw_data->num = data->num_total_clks;
 
 		ret = lan966x_gate_clk_register(dev, data, hw_data, gate_base);
-- 
2.54.0
Re: [PATCH] clk: lan966x: use devm_platform_ioremap_resource()
Posted by Brian Masney 1 month ago
Hi Rosen,

On Wed, May 06, 2026 at 04:35:32PM -0700, Rosen Penev wrote:
> Use it as another instance is used above. This one is optional so treat
> it as such.

The second sentence show go under the ---.

> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/clk/clk-lan966x.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/clk-lan966x.c b/drivers/clk/clk-lan966x.c
> index 3c7a48c616bb..8c7b273eb756 100644
> --- a/drivers/clk/clk-lan966x.c
> +++ b/drivers/clk/clk-lan966x.c
> @@ -253,7 +253,6 @@ static int lan966x_clk_probe(struct platform_device *pdev)
>  	struct clk_hw_onecell_data *hw_data;
>  	struct device *dev = &pdev->dev;
>  	void __iomem *gate_base;
> -	struct resource *res;
>  	int i, ret;
>  
>  	data = device_get_match_data(dev);
> @@ -283,12 +282,8 @@ static int lan966x_clk_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (res) {
> -		gate_base = devm_ioremap_resource(&pdev->dev, res);
> -		if (IS_ERR(gate_base))
> -			return PTR_ERR(gate_base);
> -
> +	gate_base = devm_platform_ioremap_resource(pdev, 1);
> +	if (!IS_ERR(gate_base)) {

The original code makes the gate clock as optional. With this change, if
the memory range is not specified, then a warning message will appear in
dmesg.

Brian