Message ID | 20220827094151.3323450-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next,1/3] clk: sunxi-ng: sun8i-de2: Use dev_err_probe() helper | expand |
Dne sobota, 27. avgust 2022 ob 11:41:49 CEST je Yang Yingliang napisal(a): > dev_err() can be replace with dev_err_probe() which will check if error > code is -EPROBE_DEFER. > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej > --- > drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 28 +++++++++------------------- > 1 file changed, 9 insertions(+), 19 deletions(-) > > diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c > b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 2f6f02f00be2..b70b312e7483 > 100644 > --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c > +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c > @@ -256,29 +256,19 @@ static int sunxi_de2_clk_probe(struct platform_device > *pdev) return PTR_ERR(reg); > > bus_clk = devm_clk_get(&pdev->dev, "bus"); > - if (IS_ERR(bus_clk)) { > - ret = PTR_ERR(bus_clk); > - if (ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, "Couldn't get bus clk: %d\n", ret); > - return ret; > - } > + if (IS_ERR(bus_clk)) > + return dev_err_probe(&pdev->dev, PTR_ERR(bus_clk), > + "Couldn't get bus clk\n"); > > mod_clk = devm_clk_get(&pdev->dev, "mod"); > - if (IS_ERR(mod_clk)) { > - ret = PTR_ERR(mod_clk); > - if (ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, "Couldn't get mod clk: %d\n", ret); > - return ret; > - } > + if (IS_ERR(mod_clk)) > + return dev_err_probe(&pdev->dev, PTR_ERR(mod_clk), > + "Couldn't get mod clk\n"); > > rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); > - if (IS_ERR(rstc)) { > - ret = PTR_ERR(rstc); > - if (ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, > - "Couldn't get reset control: %d\n", ret); > - return ret; > - } > + if (IS_ERR(rstc)) > + return dev_err_probe(&pdev->dev, PTR_ERR(rstc), > + "Couldn't get reset control\n"); > > /* The clocks need to be enabled for us to access the registers */ > ret = clk_prepare_enable(bus_clk);
Dne sobota, 27. avgust 2022 ob 11:41:49 CEST je Yang Yingliang napisal(a): > dev_err() can be replace with dev_err_probe() which will check if error > code is -EPROBE_DEFER. > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Applied all three, thanks! Best regards, Jernej
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c index 2f6f02f00be2..b70b312e7483 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c @@ -256,29 +256,19 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev) return PTR_ERR(reg); bus_clk = devm_clk_get(&pdev->dev, "bus"); - if (IS_ERR(bus_clk)) { - ret = PTR_ERR(bus_clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Couldn't get bus clk: %d\n", ret); - return ret; - } + if (IS_ERR(bus_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(bus_clk), + "Couldn't get bus clk\n"); mod_clk = devm_clk_get(&pdev->dev, "mod"); - if (IS_ERR(mod_clk)) { - ret = PTR_ERR(mod_clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Couldn't get mod clk: %d\n", ret); - return ret; - } + if (IS_ERR(mod_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(mod_clk), + "Couldn't get mod clk\n"); rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); - if (IS_ERR(rstc)) { - ret = PTR_ERR(rstc); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "Couldn't get reset control: %d\n", ret); - return ret; - } + if (IS_ERR(rstc)) + return dev_err_probe(&pdev->dev, PTR_ERR(rstc), + "Couldn't get reset control\n"); /* The clocks need to be enabled for us to access the registers */ ret = clk_prepare_enable(bus_clk);
dev_err() can be replace with dev_err_probe() which will check if error code is -EPROBE_DEFER. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)