pt., 23 sie 2024 o 09:07 Yangtao Li <frank.li@xxxxxxxx> napisał(a): > > Convert devm_clk_get(), clk_prepare_enable() to a single > call to devm_clk_get_enabled(), as this is exactly > what this function does. > > Signed-off-by: Yangtao Li <frank.li@xxxxxxxx> > Reviewed-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx> > --- Reviewed-by: Marcin Wojtas <marcin.s.wojtas@xxxxxxxxx> Thanks! Marcin > drivers/net/ethernet/marvell/mvneta_bm.c | 16 +++++----------- > drivers/net/ethernet/marvell/mvneta_bm.h | 1 - > 2 files changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c > index 3f46a0fed048..bfd1ed12d98c 100644 > --- a/drivers/net/ethernet/marvell/mvneta_bm.c > +++ b/drivers/net/ethernet/marvell/mvneta_bm.c > @@ -411,6 +411,7 @@ static int mvneta_bm_probe(struct platform_device *pdev) > { > struct device_node *dn = pdev->dev.of_node; > struct mvneta_bm *priv; > + struct clk *clk; > int err; > > priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL); > @@ -421,17 +422,14 @@ static int mvneta_bm_probe(struct platform_device *pdev) > if (IS_ERR(priv->reg_base)) > return PTR_ERR(priv->reg_base); > > - priv->clk = devm_clk_get(&pdev->dev, NULL); > - if (IS_ERR(priv->clk)) > - return PTR_ERR(priv->clk); > - err = clk_prepare_enable(priv->clk); > - if (err < 0) > - return err; > + clk = devm_clk_get_enabled(&pdev->dev, NULL); > + if (IS_ERR(clk)) > + return PTR_ERR(clk); > > err = mvneta_bm_get_sram(dn, priv); > if (err < 0) { > dev_err(&pdev->dev, "failed to allocate internal memory\n"); > - goto err_clk; > + return err; > } > > priv->pdev = pdev; > @@ -452,8 +450,6 @@ static int mvneta_bm_probe(struct platform_device *pdev) > > err_sram: > mvneta_bm_put_sram(priv); > -err_clk: > - clk_disable_unprepare(priv->clk); > return err; > } > > @@ -473,8 +469,6 @@ static void mvneta_bm_remove(struct platform_device *pdev) > > /* Dectivate BM unit */ > mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_STOP_MASK); > - > - clk_disable_unprepare(priv->clk); > } > > static const struct of_device_id mvneta_bm_match[] = { > diff --git a/drivers/net/ethernet/marvell/mvneta_bm.h b/drivers/net/ethernet/marvell/mvneta_bm.h > index e47783ce77e0..396dced914aa 100644 > --- a/drivers/net/ethernet/marvell/mvneta_bm.h > +++ b/drivers/net/ethernet/marvell/mvneta_bm.h > @@ -94,7 +94,6 @@ enum mvneta_bm_type { > > struct mvneta_bm { > void __iomem *reg_base; > - struct clk *clk; > struct platform_device *pdev; > > struct gen_pool *bppi_pool; > -- > 2.39.0 >