All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Expósito" <jose.exposito89@gmail.com>
To: Robert Foss <robert.foss@linaro.org>
Cc: jonas@kwiboo.se, airlied@linux.ie,
	dri-devel@lists.freedesktop.org, narmstrong@baylibre.com,
	linux-kernel@vger.kernel.org, jernej.skrabec@gmail.com,
	Liu Ying <victor.liu@oss.nxp.com>,
	laurent.pinchart@ideasonboard.com, andrzej.hajda@intel.com
Subject: Re: [PATCH v2] drm/bridge: nwl-dsi: switch to devm_drm_of_get_bridge
Date: Mon, 28 Mar 2022 18:10:04 +0200	[thread overview]
Message-ID: <20220328161004.GA9156@elementary> (raw)
In-Reply-To: <CAG3jFysp1xas4eVcRh5rysbgrhLAEJvsfYjHU=gHDT_JECaEUg@mail.gmail.com>

On Mon, Mar 28, 2022 at 03:24:05PM +0200, Robert Foss wrote:
> On Fri, 18 Mar 2022 at 10:25, Liu Ying <victor.liu@oss.nxp.com> wrote:
> >
> > On Thu, 2022-03-17 at 18:58 +0100, José Expósito wrote:
> > > The function "drm_of_find_panel_or_bridge" has been deprecated in
> > > favor of "devm_drm_of_get_bridge".
> > >
> > > Switch to the new function and reduce boilerplate.
> > >
> > > Signed-off-by: José Expósito <jose.exposito89@gmail.com>
> > >
> > > ---
> > >
> > > v2: (Thanks to Liu Ying)
> > >
> > >  - Rebase on top of drm-misc-next
> > >  - Remove drm_of_panel_bridge_remove
> > > ---
> > >  drivers/gpu/drm/bridge/nwl-dsi.c | 23 ++++-------------------
> > >  1 file changed, 4 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c
> > > b/drivers/gpu/drm/bridge/nwl-dsi.c
> > > index e34fb09b90b9..de62e3fc6a59 100644
> > > --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> > > +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> > > @@ -912,19 +912,11 @@ static int nwl_dsi_bridge_attach(struct
> > > drm_bridge *bridge,
> > >  {
> > >       struct nwl_dsi *dsi = bridge_to_dsi(bridge);
> > >       struct drm_bridge *panel_bridge;
> > > -     struct drm_panel *panel;
> > > -     int ret;
> > > -
> > > -     ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0,
> > > &panel,
> > > -                                       &panel_bridge);
> > > -     if (ret)
> > > -             return ret;
> > >
> > > -     if (panel) {
> > > -             panel_bridge = drm_panel_bridge_add(panel);
> > > -             if (IS_ERR(panel_bridge))
> > > -                     return PTR_ERR(panel_bridge);
> > > -     }
> > > +     panel_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev-
> > > >of_node,
> > > +                                           1, 0);
> > > +     if (IS_ERR(panel_bridge))
> > > +             return PTR_ERR(panel_bridge);
> > >
> > >       if (!panel_bridge)
> > >               return -EPROBE_DEFER;
> >
> > I don't think panel_bridge can be NULL here, so this check can be
> > removed.  However, even if this patch is not applied, the check is not
> > necessary.  I think it can be removed with a separate patch.
> 
> José, do you mind clearing up if this check is needed, and then
> spinning a v3 removing this snippet if it is needed?
> 
> Rob.

Hi Robert,

I think that as Liu pointed out, the "panel_bridge" variable can not
be NULL. However, as I don't have access to the required hardware to
test it, I'd prefer to keep the patch as it is, i.e., a refactor that
does not change the previous behaviour, rather than introducing an
untested change.

Jose

WARNING: multiple messages have this Message-ID (diff)
From: "José Expósito" <jose.exposito89@gmail.com>
To: Robert Foss <robert.foss@linaro.org>
Cc: Liu Ying <victor.liu@oss.nxp.com>,
	andrzej.hajda@intel.com, narmstrong@baylibre.com,
	laurent.pinchart@ideasonboard.com, jonas@kwiboo.se,
	jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch,
	p.zabel@pengutronix.de, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drm/bridge: nwl-dsi: switch to devm_drm_of_get_bridge
Date: Mon, 28 Mar 2022 18:10:04 +0200	[thread overview]
Message-ID: <20220328161004.GA9156@elementary> (raw)
In-Reply-To: <CAG3jFysp1xas4eVcRh5rysbgrhLAEJvsfYjHU=gHDT_JECaEUg@mail.gmail.com>

On Mon, Mar 28, 2022 at 03:24:05PM +0200, Robert Foss wrote:
> On Fri, 18 Mar 2022 at 10:25, Liu Ying <victor.liu@oss.nxp.com> wrote:
> >
> > On Thu, 2022-03-17 at 18:58 +0100, José Expósito wrote:
> > > The function "drm_of_find_panel_or_bridge" has been deprecated in
> > > favor of "devm_drm_of_get_bridge".
> > >
> > > Switch to the new function and reduce boilerplate.
> > >
> > > Signed-off-by: José Expósito <jose.exposito89@gmail.com>
> > >
> > > ---
> > >
> > > v2: (Thanks to Liu Ying)
> > >
> > >  - Rebase on top of drm-misc-next
> > >  - Remove drm_of_panel_bridge_remove
> > > ---
> > >  drivers/gpu/drm/bridge/nwl-dsi.c | 23 ++++-------------------
> > >  1 file changed, 4 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c
> > > b/drivers/gpu/drm/bridge/nwl-dsi.c
> > > index e34fb09b90b9..de62e3fc6a59 100644
> > > --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> > > +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> > > @@ -912,19 +912,11 @@ static int nwl_dsi_bridge_attach(struct
> > > drm_bridge *bridge,
> > >  {
> > >       struct nwl_dsi *dsi = bridge_to_dsi(bridge);
> > >       struct drm_bridge *panel_bridge;
> > > -     struct drm_panel *panel;
> > > -     int ret;
> > > -
> > > -     ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0,
> > > &panel,
> > > -                                       &panel_bridge);
> > > -     if (ret)
> > > -             return ret;
> > >
> > > -     if (panel) {
> > > -             panel_bridge = drm_panel_bridge_add(panel);
> > > -             if (IS_ERR(panel_bridge))
> > > -                     return PTR_ERR(panel_bridge);
> > > -     }
> > > +     panel_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev-
> > > >of_node,
> > > +                                           1, 0);
> > > +     if (IS_ERR(panel_bridge))
> > > +             return PTR_ERR(panel_bridge);
> > >
> > >       if (!panel_bridge)
> > >               return -EPROBE_DEFER;
> >
> > I don't think panel_bridge can be NULL here, so this check can be
> > removed.  However, even if this patch is not applied, the check is not
> > necessary.  I think it can be removed with a separate patch.
> 
> José, do you mind clearing up if this check is needed, and then
> spinning a v3 removing this snippet if it is needed?
> 
> Rob.

Hi Robert,

I think that as Liu pointed out, the "panel_bridge" variable can not
be NULL. However, as I don't have access to the required hardware to
test it, I'd prefer to keep the patch as it is, i.e., a refactor that
does not change the previous behaviour, rather than introducing an
untested change.

Jose

  reply	other threads:[~2022-03-28 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 17:58 [PATCH v2] drm/bridge: nwl-dsi: switch to devm_drm_of_get_bridge José Expósito
2022-03-17 17:58 ` José Expósito
2022-03-18  9:24 ` Liu Ying
2022-03-18  9:24   ` Liu Ying
2022-03-28 13:24   ` Robert Foss
2022-03-28 13:24     ` Robert Foss
2022-03-28 16:10     ` José Expósito [this message]
2022-03-28 16:10       ` José Expósito

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=20220328161004.GA9156@elementary \
    --to=jose.exposito89@gmail.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=robert.foss@linaro.org \
    --cc=victor.liu@oss.nxp.com \
    /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.