linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: Abhinav Kumar <abhinavk@codeaurora.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Kalyan Thota <kalyan_t@codeaurora.org>,
	Kuogee Hsieh <khsieh@codeaurora.org>,
	Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>
Cc: Rob Herring <robh+dt@kernel.org>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] drm/msm/dp: Remove global g_dp_display variable
Date: Mon, 26 Jul 2021 19:11:59 -0400	[thread overview]
Message-ID: <CAE-0n500_tQZK6cDfJgPWO-VWfzW3kj+oS5VEY2EOBHuqv+JHQ@mail.gmail.com> (raw)
In-Reply-To: <20210725042436.3967173-2-bjorn.andersson@linaro.org>

Quoting Bjorn Andersson (2021-07-24 21:24:31)
> As the Qualcomm DisplayPort driver only supports a single instance of
> the driver the commonly used struct dp_display is kept in a global
> variable. As we introduce additional instances this obviously doesn't
> work.
>
> Replace this with a combination of existing references to adjacent
> objects and drvdata.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---

Thanks for removing the global.

>  drivers/gpu/drm/msm/dp/dp_display.c | 78 ++++++++++++++---------------
>  1 file changed, 37 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 70b319a8fe83..8696b36d30e4 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -27,7 +27,6 @@
>  #include "dp_audio.h"
>  #include "dp_debug.h"
>
> -static struct msm_dp *g_dp_display;
>  #define HPD_STRING_SIZE 30
>
>  enum {
> @@ -122,6 +121,13 @@ static const struct of_device_id dp_dt_match[] = {
>         {}
>  };
>
> +static struct dp_display_private *dev_to_dp_display_private(struct device *dev)
> +{
> +       struct msm_dp *dp = dev_get_drvdata(dev);
> +
> +       return container_of(dp, struct dp_display_private, dp_display);
> +}
> +
>  static int dp_add_event(struct dp_display_private *dp_priv, u32 event,
>                                                 u32 data, u32 delay)
>  {
> @@ -198,14 +204,16 @@ static int dp_display_bind(struct device *dev, struct device *master,
>                            void *data)
>  {
>         int rc = 0;
> -       struct dp_display_private *dp;
> +       struct dp_display_private *dp = dev_to_dp_display_private(dev);
>         struct drm_device *drm;
>         struct msm_drm_private *priv;
>
>         drm = dev_get_drvdata(master);
>
> -       dp = container_of(g_dp_display,
> -                       struct dp_display_private, dp_display);
> +       if (!dp) {

How can it be NULL? dev_to_dp_display_private() returns container_of()
pointer so it doesn't look possible.

> +               DRM_ERROR("DP driver bind failed. Invalid driver data\n");
> +               return -EINVAL;
> +       }
>
>         dp->dp_display.drm_dev = drm;
>         priv = drm->dev_private;

  reply	other threads:[~2021-07-26 23:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25  4:24 [PATCH 0/5] drm/msm/dp: Support multiple DP instances and add sc8180x Bjorn Andersson
2021-07-25  4:24 ` [PATCH 1/5] drm/msm/dp: Remove global g_dp_display variable Bjorn Andersson
2021-07-26 23:11   ` Stephen Boyd [this message]
2021-07-27 18:15   ` Dmitry Baryshkov
2021-07-30 23:37   ` [Freedreno] " abhinavk
2021-07-25  4:24 ` [PATCH 2/5] drm/msm/dp: Modify prototype of encoder based API Bjorn Andersson
2021-07-26 23:55   ` Stephen Boyd
2021-07-27 18:42   ` Dmitry Baryshkov
2021-07-25  4:24 ` [PATCH 3/5] drm/msm/dp: Support up to 3 DP controllers Bjorn Andersson
2021-07-26 23:51   ` Stephen Boyd
2021-07-25  4:24 ` [PATCH 4/4] drm/msm/dp: Add sc8180x " Bjorn Andersson
2021-07-25  4:24 ` [PATCH 4/5] dt-bindings: msm/dp: Add SC8180x compatibles Bjorn Andersson
2021-07-26 23:52   ` Stephen Boyd
2021-07-25  4:24 ` [PATCH 5/5] drm/msm/dp: Add sc8180x DP controllers Bjorn Andersson
2021-07-26 23:54   ` Stephen Boyd
2021-07-31  1:21 ` [PATCH 0/5] drm/msm/dp: Support multiple DP instances and add sc8180x abhinavk

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=CAE-0n500_tQZK6cDfJgPWO-VWfzW3kj+oS5VEY2EOBHuqv+JHQ@mail.gmail.com \
    --to=swboyd@chromium.org \
    --cc=abhinavk@codeaurora.org \
    --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=kalyan_t@codeaurora.org \
    --cc=khsieh@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=sean@poorly.run \
    --subject='Re: [PATCH 1/5] drm/msm/dp: Remove global g_dp_display variable' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).