From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>
Cc: Stephen Boyd <swboyd@chromium.org>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
<linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>
Subject: Re: [PATCH v1 2/4] drm/msm/dpu: move resource allocation to the _probe function
Date: Thu, 1 Sep 2022 14:37:30 -0700 [thread overview]
Message-ID: <9627ff41-6bd8-e380-0e8e-438aecdb824f@quicinc.com> (raw)
In-Reply-To: <20220620213054.1872954-3-dmitry.baryshkov@linaro.org>
On 6/20/2022 2:30 PM, Dmitry Baryshkov wrote:
> To let the probe function bail early if any of the resources is
> unavailable, move resource allocattion from kms_init directly to the
allocation
> probe callback. While we are at it, replace irq_of_parse_and_map() with
> platform_get_irq().
Any specific reason to replace this?
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
With those two addressed,
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 62 +++++++++++++------------
> 1 file changed, 32 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index ae13a3a5d8a5..756be04d804b 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -1206,31 +1206,13 @@ static int dpu_kms_init(struct drm_device *ddev)
> struct device *dev = ddev->dev;
> struct platform_device *pdev = to_platform_device(dev);
> struct dpu_kms *dpu_kms;
> - int irq;
> struct dev_pm_opp *opp;
> int ret = 0;
> unsigned long max_freq = ULONG_MAX;
>
> - dpu_kms = devm_kzalloc(&pdev->dev, sizeof(*dpu_kms), GFP_KERNEL);
> + dpu_kms = to_dpu_kms(priv->kms);
> if (!dpu_kms)
> - return -ENOMEM;
> -
> - ret = devm_pm_opp_set_clkname(dev, "core");
> - if (ret)
> - return ret;
> - /* OPP table is optional */
> - ret = devm_pm_opp_of_add_table(dev);
> - if (ret && ret != -ENODEV) {
> - dev_err(dev, "invalid OPP table in device tree\n");
> - return ret;
> - }
> -
> - ret = devm_clk_bulk_get_all(&pdev->dev, &dpu_kms->clocks);
> - if (ret < 0) {
> - DPU_ERROR("failed to parse clocks, ret=%d\n", ret);
> - return ret;
> - }
> - dpu_kms->num_clocks = ret;
> + return -EINVAL;
>
> opp = dev_pm_opp_find_freq_floor(dev, &max_freq);
> if (!IS_ERR(opp))
> @@ -1249,21 +1231,41 @@ static int dpu_kms_init(struct drm_device *ddev)
> pm_runtime_enable(&pdev->dev);
> dpu_kms->rpm_enabled = true;
>
> - priv->kms = &dpu_kms->base;
> -
> - irq = irq_of_parse_and_map(dpu_kms->pdev->dev.of_node, 0);
> - if (!irq) {
> - DPU_ERROR("failed to get irq\n");
> - return -EINVAL;
> - }
> - dpu_kms->base.irq = irq;
> -
> return 0;
> }
>
> static int dpu_dev_probe(struct platform_device *pdev)
> {
> - return msm_drv_probe(&pdev->dev, dpu_kms_init, NULL);
> + struct device *dev = &pdev->dev;
> + struct dpu_kms *dpu_kms;
> + int irq;
> + int ret = 0;
> +
> + dpu_kms = devm_kzalloc(dev, sizeof(*dpu_kms), GFP_KERNEL);
> + if (!dpu_kms)
> + return -ENOMEM;
> +
> + ret = devm_pm_opp_set_clkname(dev, "core");
> + if (ret)
> + return ret;
> + /* OPP table is optional */
> + ret = devm_pm_opp_of_add_table(dev);
> + if (ret && ret != -ENODEV)
> + return dev_err_probe(dev, ret, "invalid OPP table in device tree\n");
> +
> + ret = devm_clk_bulk_get_all(&pdev->dev, &dpu_kms->clocks);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "failed to parse clocks\n");
> +
> + dpu_kms->num_clocks = ret;
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return dev_err_probe(dev, irq, "failed to get irq\n");
> +
> + dpu_kms->base.irq = irq;
> +
> + return msm_drv_probe(&pdev->dev, dpu_kms_init, &dpu_kms->base);
> }
>
> static int dpu_dev_remove(struct platform_device *pdev)
next prev parent reply other threads:[~2022-09-01 21:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 21:30 [PATCH v1 0/4] drm/msm: move resource allocation to the _probe function Dmitry Baryshkov
2022-06-20 21:30 ` [PATCH v1 1/4] drm/msm/mdp5: stop overriding drvdata Dmitry Baryshkov
2022-08-24 1:25 ` Abhinav Kumar
2022-08-24 8:29 ` Dmitry Baryshkov
2022-08-24 17:20 ` Abhinav Kumar
2022-08-26 14:23 ` Dmitry Baryshkov
2022-08-31 22:16 ` Abhinav Kumar
2022-09-22 18:52 ` Luca Weiss
2022-06-20 21:30 ` [PATCH v1 2/4] drm/msm/dpu: move resource allocation to the _probe function Dmitry Baryshkov
2022-09-01 21:37 ` Abhinav Kumar [this message]
2022-09-02 6:01 ` Dmitry Baryshkov
2022-06-20 21:30 ` [PATCH v1 3/4] drm/msm/mdp4: " Dmitry Baryshkov
2022-09-02 0:24 ` Abhinav Kumar
2022-09-02 6:06 ` Dmitry Baryshkov
2022-09-02 17:48 ` Abhinav Kumar
2022-09-02 19:05 ` Dmitry Baryshkov
2022-09-02 19:10 ` [Freedreno] " Abhinav Kumar
2022-06-20 21:30 ` [PATCH v1 4/4] drm/msm/mdp5: " Dmitry Baryshkov
2022-09-02 1:00 ` Abhinav Kumar
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=9627ff41-6bd8-e380-0e8e-438aecdb824f@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=airlied@linux.ie \
--cc=bjorn.andersson@linaro.org \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=swboyd@chromium.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox