Message ID | 2059e872cc9cb129752c1656be073b1a6beb4cc5.1724726725.git.bo.wu@vivo.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6c4cdf4e126675d8ce0ead810c30831ee1c0997f |
Headers | show |
Series | [v2,1/2] bus: bt1-axi: change to use devm_clk_get_enabled() helper | expand |
On Mon, Aug 26, 2024 at 08:53:58PM -0600, Wu Bo wrote: > Use devm_clk_get_enabled() instead of devm_clk_get() to make the code > cleaner and avoid calling clk_disable_unprepare() Great! Thanks. Acked-by: Serge Semin <fancer.lancer@gmail.com> -Serge(y) > > Signed-off-by: Wu Bo <bo.wu@vivo.com> > --- > drivers/bus/bt1-apb.c | 23 +---------------------- > 1 file changed, 1 insertion(+), 22 deletions(-) > > diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c > index 595fb22b73e0..7463124b6dd9 100644 > --- a/drivers/bus/bt1-apb.c > +++ b/drivers/bus/bt1-apb.c > @@ -185,34 +185,13 @@ static int bt1_apb_request_rst(struct bt1_apb *apb) > return ret; > } > > -static void bt1_apb_disable_clk(void *data) > -{ > - struct bt1_apb *apb = data; > - > - clk_disable_unprepare(apb->pclk); > -} > - > static int bt1_apb_request_clk(struct bt1_apb *apb) > { > - int ret; > - > - apb->pclk = devm_clk_get(apb->dev, "pclk"); > + apb->pclk = devm_clk_get_enabled(apb->dev, "pclk"); > if (IS_ERR(apb->pclk)) > return dev_err_probe(apb->dev, PTR_ERR(apb->pclk), > "Couldn't get APB clock descriptor\n"); > > - ret = clk_prepare_enable(apb->pclk); > - if (ret) { > - dev_err(apb->dev, "Couldn't enable the APB clock\n"); > - return ret; > - } > - > - ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb); > - if (ret) { > - dev_err(apb->dev, "Can't add APB EHB clocks disable action\n"); > - return ret; > - } > - > apb->rate = clk_get_rate(apb->pclk); > if (!apb->rate) { > dev_err(apb->dev, "Invalid clock rate\n"); > -- > 2.25.1 >
diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c index 595fb22b73e0..7463124b6dd9 100644 --- a/drivers/bus/bt1-apb.c +++ b/drivers/bus/bt1-apb.c @@ -185,34 +185,13 @@ static int bt1_apb_request_rst(struct bt1_apb *apb) return ret; } -static void bt1_apb_disable_clk(void *data) -{ - struct bt1_apb *apb = data; - - clk_disable_unprepare(apb->pclk); -} - static int bt1_apb_request_clk(struct bt1_apb *apb) { - int ret; - - apb->pclk = devm_clk_get(apb->dev, "pclk"); + apb->pclk = devm_clk_get_enabled(apb->dev, "pclk"); if (IS_ERR(apb->pclk)) return dev_err_probe(apb->dev, PTR_ERR(apb->pclk), "Couldn't get APB clock descriptor\n"); - ret = clk_prepare_enable(apb->pclk); - if (ret) { - dev_err(apb->dev, "Couldn't enable the APB clock\n"); - return ret; - } - - ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb); - if (ret) { - dev_err(apb->dev, "Can't add APB EHB clocks disable action\n"); - return ret; - } - apb->rate = clk_get_rate(apb->pclk); if (!apb->rate) { dev_err(apb->dev, "Invalid clock rate\n");
Use devm_clk_get_enabled() instead of devm_clk_get() to make the code cleaner and avoid calling clk_disable_unprepare() Signed-off-by: Wu Bo <bo.wu@vivo.com> --- drivers/bus/bt1-apb.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-)