Skip to content

Commit 170d588

Browse files
bbkzzjernejsk
authored andcommitted
clk: sunxi: sun9i-mmc: Use devm_platform_get_and_ioremap_resource()
Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Yangtao Li <frank.li@vivo.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/20230705065313.67043-1-frank.li@vivo.com Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
1 parent 06c2afb commit 170d588

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/clk/sunxi/clk-sun9i-mmc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,13 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)
108108

109109
spin_lock_init(&data->lock);
110110

111-
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
112-
if (!r)
113-
return -EINVAL;
114-
/* one clock/reset pair per word */
115-
count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
116-
data->membase = devm_ioremap_resource(&pdev->dev, r);
111+
data->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
117112
if (IS_ERR(data->membase))
118113
return PTR_ERR(data->membase);
119114

115+
/* one clock/reset pair per word */
116+
count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
117+
120118
clk_data = &data->clk_data;
121119
clk_data->clk_num = count;
122120
clk_data->clks = devm_kcalloc(&pdev->dev, count, sizeof(struct clk *),

0 commit comments

Comments
 (0)