All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Marijn Suijten <marijn.suijten@somainline.org>
Cc: phone-devel@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
	~postmarketos/upstreaming@lists.sr.ht,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@somainline.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Martin Botka <martin.botka@somainline.org>,
	Jami Kettunen <jami.kettunen@somainline.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	Rajeev Nandan <quic_rajeevny@quicinc.com>,
	Vladimir Lypak <vladimir.lypak@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>, Jonathan Marek <jonathan@marek.ca>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org
Subject: Re: [PATCH 6/9] drm/msm/dsi_phy_28nm_8960: Use stack memory for temporary clock names
Date: Tue, 24 May 2022 01:45:29 +0300	[thread overview]
Message-ID: <CAA8EJpqhqtc1A0SJqAhOveZcdsBEjPNZLpR3tTM2L3+p3QtiWA@mail.gmail.com> (raw)
In-Reply-To: <20220523213837.1016542-7-marijn.suijten@somainline.org>

On Tue, 24 May 2022 at 00:38, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> The clock names formatted into the hw_clk's init structure are only used
> for the duration of the registration function where they are kstrdup'ed,
> making it unnecessary to keep the allocations alive for the duration of
> the device (through devm).
>
> Just like the other DSI PHY PLL clock trees, use a stack-local char
> array and save on memory outside of the pll_28nm_register function.
>
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Nit: we can use clk_name instead of vco_name too.

> ---
>  drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
> index 943a7e847c90..554978fc434d 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
> @@ -383,7 +383,7 @@ static int dsi_28nm_pll_restore_state(struct msm_dsi_phy *phy)
>
>  static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **provided_clocks)
>  {
> -       char *clk_name, *vco_name;
> +       char clk_name[32], vco_name[32];
>         struct clk_init_data vco_init = {
>                 .parent_data = &(const struct clk_parent_data) {
>                         .fw_name = "ref",
> @@ -404,14 +404,6 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov
>         if (!bytediv)
>                 return -ENOMEM;
>
> -       vco_name = devm_kzalloc(dev, 32, GFP_KERNEL);
> -       if (!vco_name)
> -               return -ENOMEM;
> -
> -       clk_name = devm_kzalloc(dev, 32, GFP_KERNEL);
> -       if (!clk_name)
> -               return -ENOMEM;
> -
>         snprintf(vco_name, 32, "dsi%dvco_clk", pll_28nm->phy->id);
>         vco_init.name = vco_name;
>
> --
> 2.36.1
>


-- 
With best wishes
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Marijn Suijten <marijn.suijten@somainline.org>
Cc: David Airlie <airlied@linux.ie>,
	Michael Turquette <mturquette@baylibre.com>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	dri-devel@lists.freedesktop.org,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@somainline.org>,
	phone-devel@vger.kernel.org, linux-clk@vger.kernel.org,
	Jonathan Marek <jonathan@marek.ca>,
	linux-arm-msm@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Rajeev Nandan <quic_rajeevny@quicinc.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Martin Botka <martin.botka@somainline.org>,
	~postmarketos/upstreaming@lists.sr.ht,
	Sean Paul <sean@poorly.run>, Stephen Boyd <sboyd@kernel.org>,
	Vladimir Lypak <vladimir.lypak@gmail.com>,
	linux-kernel@vger.kernel.org,
	Jami Kettunen <jami.kettunen@somainline.org>,
	freedreno@lists.freedesktop.org
Subject: Re: [PATCH 6/9] drm/msm/dsi_phy_28nm_8960: Use stack memory for temporary clock names
Date: Tue, 24 May 2022 01:45:29 +0300	[thread overview]
Message-ID: <CAA8EJpqhqtc1A0SJqAhOveZcdsBEjPNZLpR3tTM2L3+p3QtiWA@mail.gmail.com> (raw)
In-Reply-To: <20220523213837.1016542-7-marijn.suijten@somainline.org>

On Tue, 24 May 2022 at 00:38, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> The clock names formatted into the hw_clk's init structure are only used
> for the duration of the registration function where they are kstrdup'ed,
> making it unnecessary to keep the allocations alive for the duration of
> the device (through devm).
>
> Just like the other DSI PHY PLL clock trees, use a stack-local char
> array and save on memory outside of the pll_28nm_register function.
>
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Nit: we can use clk_name instead of vco_name too.

> ---
>  drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
> index 943a7e847c90..554978fc434d 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
> @@ -383,7 +383,7 @@ static int dsi_28nm_pll_restore_state(struct msm_dsi_phy *phy)
>
>  static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **provided_clocks)
>  {
> -       char *clk_name, *vco_name;
> +       char clk_name[32], vco_name[32];
>         struct clk_init_data vco_init = {
>                 .parent_data = &(const struct clk_parent_data) {
>                         .fw_name = "ref",
> @@ -404,14 +404,6 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov
>         if (!bytediv)
>                 return -ENOMEM;
>
> -       vco_name = devm_kzalloc(dev, 32, GFP_KERNEL);
> -       if (!vco_name)
> -               return -ENOMEM;
> -
> -       clk_name = devm_kzalloc(dev, 32, GFP_KERNEL);
> -       if (!clk_name)
> -               return -ENOMEM;
> -
>         snprintf(vco_name, 32, "dsi%dvco_clk", pll_28nm->phy->id);
>         vco_init.name = vco_name;
>
> --
> 2.36.1
>


-- 
With best wishes
Dmitry

  reply	other threads:[~2022-05-23 22:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 21:38 [PATCH 0/9] drm/msm/dsi_phy: Replace parent names with clk_hw pointers Marijn Suijten
2022-05-23 21:38 ` Marijn Suijten
2022-05-23 21:38 ` [PATCH 1/9] clk: divider: Introduce devm_clk_hw_register_divider_parent_hw() Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 21:38 ` [PATCH 2/9] clk: mux: Introduce devm_clk_hw_register_mux_parent_hws() Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 21:38 ` [PATCH 3/9] clk: fixed-factor: Introduce *clk_hw_register_fixed_factor_parent_hw() Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 21:38 ` [PATCH 4/9] drm/msm/dsi_phy_28nm: Replace parent names with clk_hw pointers Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 22:34   ` Dmitry Baryshkov
2022-05-23 22:34     ` Dmitry Baryshkov
2022-05-23 21:38 ` [PATCH 5/9] drm/msm/dsi_phy_28nm_8960: " Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 22:44   ` Dmitry Baryshkov
2022-05-23 22:44     ` Dmitry Baryshkov
2022-05-23 22:44     ` Dmitry Baryshkov
2022-05-23 22:44       ` Dmitry Baryshkov
2022-05-24 21:44       ` Marijn Suijten
2022-05-24 21:44         ` Marijn Suijten
2022-05-23 21:38 ` [PATCH 6/9] drm/msm/dsi_phy_28nm_8960: Use stack memory for temporary clock names Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 22:45   ` Dmitry Baryshkov [this message]
2022-05-23 22:45     ` Dmitry Baryshkov
2022-05-23 21:38 ` [PATCH 7/9] drm/msm/dsi_phy_14nm: Replace parent names with clk_hw pointers Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 22:50   ` Dmitry Baryshkov
2022-05-23 22:50     ` Dmitry Baryshkov
2022-05-23 21:38 ` [PATCH 8/9] drm/msm/dsi_phy_10nm: " Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 22:51   ` Dmitry Baryshkov
2022-05-23 22:51     ` Dmitry Baryshkov
2022-05-23 21:38 ` [PATCH 9/9] drm/msm/dsi_phy_7nm: " Marijn Suijten
2022-05-23 21:38   ` Marijn Suijten
2022-05-23 22:52   ` Dmitry Baryshkov
2022-05-23 22:52     ` Dmitry Baryshkov
2022-05-23 23:43 ` [PATCH 0/9] drm/msm/dsi_phy: " Dmitry Baryshkov
2022-05-23 23:43   ` Dmitry Baryshkov
2022-05-24 22:03   ` Marijn Suijten
2022-05-24 22:03     ` Marijn Suijten
2022-05-25  8:01     ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA8EJpqhqtc1A0SJqAhOveZcdsBEjPNZLpR3tTM2L3+p3QtiWA@mail.gmail.com \
    --to=dmitry.baryshkov@linaro.org \
    --cc=airlied@linux.ie \
    --cc=angelogioacchino.delregno@somainline.org \
    --cc=arnd@arndb.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jami.kettunen@somainline.org \
    --cc=jonathan@marek.ca \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=martin.botka@somainline.org \
    --cc=mturquette@baylibre.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_rajeevny@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sboyd@kernel.org \
    --cc=sean@poorly.run \
    --cc=vladimir.lypak@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.