Message ID | 20240823023103.1984437-1-bo.wu@vivo.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | bus: bt1-axi: change to use devm_clk_get_enabled() helpers | expand |
Hi Wu On Thu, Aug 22, 2024 at 08:31:03PM -0600, Wu Bo wrote: > Make the code cleaner and avoid call clk_disable_unprepare() > > Signed-off-by: Wu Bo <bo.wu@vivo.com> Awesome! Thanks. Acked-by: Serge Semin <fancer.lancer@gmail.com> Could you also apply the same change to drivers/bus/bt1-apb.c ? -Serge(y) > --- > drivers/bus/bt1-axi.c | 19 +------------------ > 1 file changed, 1 insertion(+), 18 deletions(-) > > diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c > index 4007e7322cf2..b0baae49aca6 100644 > --- a/drivers/bus/bt1-axi.c > +++ b/drivers/bus/bt1-axi.c > @@ -146,32 +146,15 @@ static int bt1_axi_request_rst(struct bt1_axi *axi) > return ret; > } > > -static void bt1_axi_disable_clk(void *data) > -{ > - struct bt1_axi *axi = data; > - > - clk_disable_unprepare(axi->aclk); > -} > - > static int bt1_axi_request_clk(struct bt1_axi *axi) > { > int ret; > > - axi->aclk = devm_clk_get(axi->dev, "aclk"); > + axi->aclk = devm_clk_get_enabled(axi->dev, "aclk"); > if (IS_ERR(axi->aclk)) > return dev_err_probe(axi->dev, PTR_ERR(axi->aclk), > "Couldn't get AXI Interconnect clock\n"); > > - ret = clk_prepare_enable(axi->aclk); > - if (ret) { > - dev_err(axi->dev, "Couldn't enable the AXI clock\n"); > - return ret; > - } > - > - ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); > - if (ret) > - dev_err(axi->dev, "Can't add AXI clock disable action\n"); > - > return ret; > } > > -- > 2.25.1 >
On Fri, Aug 23, 2024 at 11:56:55AM +0300, Serge Semin wrote: > Hi Wu > > On Thu, Aug 22, 2024 at 08:31:03PM -0600, Wu Bo wrote: > > Make the code cleaner and avoid call clk_disable_unprepare() > > > > Signed-off-by: Wu Bo <bo.wu@vivo.com> > > Awesome! Thanks. > > Acked-by: Serge Semin <fancer.lancer@gmail.com> > > Could you also apply the same change to drivers/bus/bt1-apb.c ? Grrr, too fast. Please see my further note. > > -Serge(y) > > > --- > > drivers/bus/bt1-axi.c | 19 +------------------ > > 1 file changed, 1 insertion(+), 18 deletions(-) > > > > diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c > > index 4007e7322cf2..b0baae49aca6 100644 > > --- a/drivers/bus/bt1-axi.c > > +++ b/drivers/bus/bt1-axi.c > > @@ -146,32 +146,15 @@ static int bt1_axi_request_rst(struct bt1_axi *axi) > > return ret; > > } > > > > -static void bt1_axi_disable_clk(void *data) > > -{ > > - struct bt1_axi *axi = data; > > - > > - clk_disable_unprepare(axi->aclk); > > -} > > - > > static int bt1_axi_request_clk(struct bt1_axi *axi) > > { > > int ret; > > > > - axi->aclk = devm_clk_get(axi->dev, "aclk"); > > + axi->aclk = devm_clk_get_enabled(axi->dev, "aclk"); > > if (IS_ERR(axi->aclk)) > > return dev_err_probe(axi->dev, PTR_ERR(axi->aclk), > > "Couldn't get AXI Interconnect clock\n"); > > > > - ret = clk_prepare_enable(axi->aclk); > > - if (ret) { > > - dev_err(axi->dev, "Couldn't enable the AXI clock\n"); > > - return ret; > > - } > > - > > - ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); > > - if (ret) > > - dev_err(axi->dev, "Can't add AXI clock disable action\n"); > > - > > return ret; This will lead to the undefined value returned. Please drop the "ret" variable and just return 0 in the last statement. After that feel free to add my Ab-tag. -Serge(y) > > } > > > > -- > > 2.25.1 > >
Hi Wu,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.11-rc5 next-20240826]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wu-Bo/bus-bt1-axi-change-to-use-devm_clk_get_enabled-helpers/20240826-122401
base: linus/master
patch link: https://lore.kernel.org/r/20240823023103.1984437-1-bo.wu%40vivo.com
patch subject: [PATCH] bus: bt1-axi: change to use devm_clk_get_enabled() helpers
config: arm-randconfig-002-20240826 (https://download.01.org/0day-ci/archive/20240826/202408262130.M4pjxUDC-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240826/202408262130.M4pjxUDC-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408262130.M4pjxUDC-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/bus/bt1-axi.c:158:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
158 | return ret;
| ^~~
drivers/bus/bt1-axi.c:151:9: note: initialize the variable 'ret' to silence this warning
151 | int ret;
| ^
| = 0
1 warning generated.
vim +/ret +158 drivers/bus/bt1-axi.c
63cb77136e04ff Serge Semin 2020-05-26 148
63cb77136e04ff Serge Semin 2020-05-26 149 static int bt1_axi_request_clk(struct bt1_axi *axi)
63cb77136e04ff Serge Semin 2020-05-26 150 {
63cb77136e04ff Serge Semin 2020-05-26 151 int ret;
63cb77136e04ff Serge Semin 2020-05-26 152
6ac8fb96f7dfde Wu Bo 2024-08-22 153 axi->aclk = devm_clk_get_enabled(axi->dev, "aclk");
5e93207e962a6d Serge Semin 2022-06-10 154 if (IS_ERR(axi->aclk))
5e93207e962a6d Serge Semin 2022-06-10 155 return dev_err_probe(axi->dev, PTR_ERR(axi->aclk),
5e93207e962a6d Serge Semin 2022-06-10 156 "Couldn't get AXI Interconnect clock\n");
63cb77136e04ff Serge Semin 2020-05-26 157
7f57416f2aebe6 Serge Semin 2020-05-28 @158 return ret;
63cb77136e04ff Serge Semin 2020-05-26 159 }
63cb77136e04ff Serge Semin 2020-05-26 160
diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c index 4007e7322cf2..b0baae49aca6 100644 --- a/drivers/bus/bt1-axi.c +++ b/drivers/bus/bt1-axi.c @@ -146,32 +146,15 @@ static int bt1_axi_request_rst(struct bt1_axi *axi) return ret; } -static void bt1_axi_disable_clk(void *data) -{ - struct bt1_axi *axi = data; - - clk_disable_unprepare(axi->aclk); -} - static int bt1_axi_request_clk(struct bt1_axi *axi) { int ret; - axi->aclk = devm_clk_get(axi->dev, "aclk"); + axi->aclk = devm_clk_get_enabled(axi->dev, "aclk"); if (IS_ERR(axi->aclk)) return dev_err_probe(axi->dev, PTR_ERR(axi->aclk), "Couldn't get AXI Interconnect clock\n"); - ret = clk_prepare_enable(axi->aclk); - if (ret) { - dev_err(axi->dev, "Couldn't enable the AXI clock\n"); - return ret; - } - - ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); - if (ret) - dev_err(axi->dev, "Can't add AXI clock disable action\n"); - return ret; }
Make the code cleaner and avoid call clk_disable_unprepare() Signed-off-by: Wu Bo <bo.wu@vivo.com> --- drivers/bus/bt1-axi.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)