Skip to contentSkip to conversation

clk: lan966x: use devm_platform_ioremap_resource()

PATCH In review Rosen Penev 2 participants 2 messages May 6 – May 7 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: lan966x: use devm_platform_ioremap_resource()

Use it as another instance is used above. This one is optional so treat it as such.

---
 drivers/clk/clk-lan966x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/clk/clk-lan966x.c +2 -7
index 3c7a48c616bb..8c7b273eb756 100644
@@ -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);
Signature · 1 line
2.54.0
#1 lore raw

Hi Rosen,

Quoted 2 lines · Rosen Penev

Use it as another instance is used above. This one is optional so treat it as such.

The second sentence show go under the ---.

Quoted 20 lines
---
 drivers/clk/clk-lan966x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/clk/clk-lan966x.c +0 -1
index 3c7a48c616bb..8c7b273eb756 100644
@@ -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)
 		}

drivers/clk/clk-lan966x.c static int lan966x_clk_probe(struct platform_device *pdev) · line 286

Quoted 10 lines
drivers/clk/clk-lan966x.c +2 -6
 	}
 
-	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