Message ID | 20240402103406.3638821-1-quic_varada@quicinc.com |
---|---|
Headers | show |
Series | Add interconnect driver for IPQ9574 SoC | expand |
On Tue, 2 Apr 2024 at 13:40, Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote: > > On Tue, 2 Apr 2024 at 13:34, Varadarajan Narayanan > <quic_varada@quicinc.com> wrote: > > > > Wrap icc_clk_register to create devm_icc_clk_register to be > > able to release the resources properly. > > > > Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com> > > --- > > v5: Introduced devm_icc_clk_register > > --- > > drivers/interconnect/icc-clk.c | 29 +++++++++++++++++++++++++++++ > > include/linux/interconnect-clk.h | 4 ++++ > > 2 files changed, 33 insertions(+) > > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Wait. Actually, Unreviewed-by: me Please return int from devm_icc_clk_register instead of returning the pointer.
On Tue, Apr 02, 2024 at 02:16:56PM +0300, Dmitry Baryshkov wrote: > On Tue, 2 Apr 2024 at 14:02, Varadarajan Narayanan > <quic_varada@quicinc.com> wrote: > > > > On Tue, Apr 02, 2024 at 01:48:08PM +0300, Dmitry Baryshkov wrote: > > > On Tue, 2 Apr 2024 at 13:40, Dmitry Baryshkov > > > <dmitry.baryshkov@linaro.org> wrote: > > > > > > > > On Tue, 2 Apr 2024 at 13:34, Varadarajan Narayanan > > > > <quic_varada@quicinc.com> wrote: > > > > > > > > > > Wrap icc_clk_register to create devm_icc_clk_register to be > > > > > able to release the resources properly. > > > > > > > > > > Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com> > > > > > --- > > > > > v5: Introduced devm_icc_clk_register > > > > > --- > > > > > drivers/interconnect/icc-clk.c | 29 +++++++++++++++++++++++++++++ > > > > > include/linux/interconnect-clk.h | 4 ++++ > > > > > 2 files changed, 33 insertions(+) > > > > > > > > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > > > > > Wait. Actually, > > > > > > Unreviewed-by: me > > > > > > Please return int from devm_icc_clk_register instead of returning the pointer. > > > > Wouldn't returning int break the general assumption that > > devm_foo(), returns the same type as foo(). For example > > devm_clk_hw_get_clk and clk_hw_get_clk return struct clk *? > > Not always. The only reason to return icc_provider was to make it > possible to destroy it. With devres-managed function you don't have to > do anything. Ok. Will change as follows return prov; -> return PTR_ERR_OR_ZERO(prov); Thanks Varada
On Tue, 2 Apr 2024 at 14:23, Varadarajan Narayanan <quic_varada@quicinc.com> wrote: > > On Tue, Apr 02, 2024 at 02:16:56PM +0300, Dmitry Baryshkov wrote: > > On Tue, 2 Apr 2024 at 14:02, Varadarajan Narayanan > > <quic_varada@quicinc.com> wrote: > > > > > > On Tue, Apr 02, 2024 at 01:48:08PM +0300, Dmitry Baryshkov wrote: > > > > On Tue, 2 Apr 2024 at 13:40, Dmitry Baryshkov > > > > <dmitry.baryshkov@linaro.org> wrote: > > > > > > > > > > On Tue, 2 Apr 2024 at 13:34, Varadarajan Narayanan > > > > > <quic_varada@quicinc.com> wrote: > > > > > > > > > > > > Wrap icc_clk_register to create devm_icc_clk_register to be > > > > > > able to release the resources properly. > > > > > > > > > > > > Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com> > > > > > > --- > > > > > > v5: Introduced devm_icc_clk_register > > > > > > --- > > > > > > drivers/interconnect/icc-clk.c | 29 +++++++++++++++++++++++++++++ > > > > > > include/linux/interconnect-clk.h | 4 ++++ > > > > > > 2 files changed, 33 insertions(+) > > > > > > > > > > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > > > > > > > Wait. Actually, > > > > > > > > Unreviewed-by: me > > > > > > > > Please return int from devm_icc_clk_register instead of returning the pointer. > > > > > > Wouldn't returning int break the general assumption that > > > devm_foo(), returns the same type as foo(). For example > > > devm_clk_hw_get_clk and clk_hw_get_clk return struct clk *? > > > > Not always. The only reason to return icc_provider was to make it > > possible to destroy it. With devres-managed function you don't have to > > do anything. > > Ok. Will change as follows > > return prov; -> return PTR_ERR_OR_ZERO(prov); > I think the code might become simpler if you first allocate the ICC provider and then just 'return devm_add_action_or_reset(dev, your_icc_clk_release, provider)'
On Tue, Apr 02, 2024 at 03:12:04PM +0300, Dmitry Baryshkov wrote: > On Tue, 2 Apr 2024 at 14:23, Varadarajan Narayanan > <quic_varada@quicinc.com> wrote: > > > > On Tue, Apr 02, 2024 at 02:16:56PM +0300, Dmitry Baryshkov wrote: > > > On Tue, 2 Apr 2024 at 14:02, Varadarajan Narayanan > > > <quic_varada@quicinc.com> wrote: > > > > > > > > On Tue, Apr 02, 2024 at 01:48:08PM +0300, Dmitry Baryshkov wrote: > > > > > On Tue, 2 Apr 2024 at 13:40, Dmitry Baryshkov > > > > > <dmitry.baryshkov@linaro.org> wrote: > > > > > > > > > > > > On Tue, 2 Apr 2024 at 13:34, Varadarajan Narayanan > > > > > > <quic_varada@quicinc.com> wrote: > > > > > > > > > > > > > > Wrap icc_clk_register to create devm_icc_clk_register to be > > > > > > > able to release the resources properly. > > > > > > > > > > > > > > Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com> > > > > > > > --- > > > > > > > v5: Introduced devm_icc_clk_register > > > > > > > --- > > > > > > > drivers/interconnect/icc-clk.c | 29 +++++++++++++++++++++++++++++ > > > > > > > include/linux/interconnect-clk.h | 4 ++++ > > > > > > > 2 files changed, 33 insertions(+) > > > > > > > > > > > > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > > > > > > > > > Wait. Actually, > > > > > > > > > > Unreviewed-by: me > > > > > > > > > > Please return int from devm_icc_clk_register instead of returning the pointer. > > > > > > > > Wouldn't returning int break the general assumption that > > > > devm_foo(), returns the same type as foo(). For example > > > > devm_clk_hw_get_clk and clk_hw_get_clk return struct clk *? > > > > > > Not always. The only reason to return icc_provider was to make it > > > possible to destroy it. With devres-managed function you don't have to > > > do anything. > > > > Ok. Will change as follows > > > > return prov; -> return PTR_ERR_OR_ZERO(prov); > > > > I think the code might become simpler if you first allocate the ICC > provider and then just 'return devm_add_action_or_reset(dev, > your_icc_clk_release, provider)' Have posted v7 incorporating these and other feedback. Please review. Thanks Varada