Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69b39d25 authored by Chunyan Zhang's avatar Chunyan Zhang Committed by Stephen Boyd
Browse files

clk: sprd: Switch from of_iomap() to devm_ioremap_resource()



devm_ioremap_resources() automatically requests resources and devm_ wrappers
do better error handling and unmapping of the I/O region when needed,
that would make drivers more clean and simple.

Signed-off-by: default avatarChunyan Zhang <zhang.chunyan@linaro.org>
Reviewed-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent a188339c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
	void __iomem *base;
	struct device_node *node = pdev->dev.of_node;
	struct regmap *regmap;
	struct resource *res;

	if (of_find_property(node, "sprd,syscon", NULL)) {
		regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon");
@@ -50,7 +51,11 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
			return PTR_ERR(regmap);
		}
	} else {
		base = of_iomap(node, 0);
		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
		base = devm_ioremap_resource(&pdev->dev, res);
		if (IS_ERR(base))
			return PTR_ERR(base);

		regmap = devm_regmap_init_mmio(&pdev->dev, base,
					       &sprdclk_regmap_config);
		if (IS_ERR_OR_NULL(regmap)) {