public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xin Ji <xji@analogixsemi.com>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: devel@driverdev.osuosl.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Pi-Hsun Shih <pihsun@chromium.org>,
	Sheng Pan <span@analogixsemi.com>
Subject: Re: [PATCH v13 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
Date: Wed, 8 Jul 2020 17:00:55 +0800	[thread overview]
Message-ID: <20200708090055.GA21256@xin-VirtualBox> (raw)
In-Reply-To: <CANMq1KDnoLSUxxYr82o=1eGBR7E3PxoYUr8h1sEVTyqYyHCC-Q@mail.gmail.com>

On Tue, Jul 07, 2020 at 03:01:25PM +0800, Nicolas Boichat wrote:

Hi Nicolas, thanks for the replay.

> On Tue, Jun 9, 2020 at 3:20 PM Xin Ji <xji@analogixsemi.com> wrote:
> >
> > The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed
> > for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K.
> >
> > Signed-off-by: Xin Ji <xji@analogixsemi.com>
> > ---
> >  drivers/gpu/drm/bridge/analogix/Kconfig   |    9 +
> >  drivers/gpu/drm/bridge/analogix/Makefile  |    1 +
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 1999 +++++++++++++++++++++++++++++
> >  drivers/gpu/drm/bridge/analogix/anx7625.h |  397 ++++++
> >  4 files changed, 2406 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h
> >
> > [snip]
> > +static int anx7625_parse_dt(struct device *dev,
> > +                           struct anx7625_platform_data *pdata)
> > +{
> > +       struct device_node *np = dev->of_node;
> > +       struct device_node *panel_node, *out_ep;
> > +
> > +       pdata->node.mipi_dsi_host_node = of_graph_get_remote_node(np, 0, 0);
> > +       if (!pdata->node.mipi_dsi_host_node) {
> > +               DRM_DEV_ERROR(dev, "fail to get internal panel.\n");
> > +               return -EPROBE_DEFER;
> 
> This does not look correct. I don't think of_graph_get_remote_node
> will ever return NULL if the device tree is configured properly, and
> it's useless to retry later (EPROBE_DEFER). You should just fail (e.g.
> return EINVAL).
OK
> 
> > +       }
> > +
> > +       of_node_put(pdata->node.mipi_dsi_host_node);
> 
> You are using pdata->node.mipi_dsi_host_node in other places in the
> code, so I don't think it's ok to call of_node_put?
I'll move the related code to here.
> 
> > +       DRM_DEV_DEBUG_DRIVER(dev, "found dsi host node.\n");
> > +
> > +       pdata->node.panel_node = of_graph_get_port_by_id(np, 1);
> > +       if (!pdata->node.panel_node) {
> > +               DRM_DEV_ERROR(dev, "fail to get panel node.\n");
> > +               return -EPROBE_DEFER;
> 
> -EINVAL.
OK
> 
> > +       }
> > +
> > +       of_node_put(pdata->node.panel_node);
> > +       out_ep = of_get_child_by_name(pdata->node.panel_node,
> > +                                     "endpoint");
> > +       if (!out_ep) {
> > +               DRM_DEV_DEBUG_DRIVER(dev, "cannot get endpoint.\n");
> 
> DRM_DEV_ERROR seems more appropriate
OK, also I'll remove drm_panel based on Sam comment.
> 
> > +               return -EPROBE_DEFER;
> 
> -EINVAL
OK
> 
> > +       }
> > +
> > +       panel_node = of_graph_get_remote_port_parent(out_ep);
> > +       of_node_put(out_ep);
> > +       pdata->panel = of_drm_find_panel(panel_node);
> > +       DRM_DEV_DEBUG_DRIVER(dev, "get panel node.\n");
> > +
> > +       of_node_put(panel_node);
> > +       if (IS_ERR_OR_NULL(pdata->panel))
> > +               return -EPROBE_DEFER;
> 
> of_drm_find_panel cannot return NULL, so, do this instead:
> 
> if (IS_ERR(pdata->panel))
>    return PTR_ERR(pdata->panel);
> 
> (which actually _may_ return EPROBE_DEFER)
I'll remove drm_panel, use panel_bridge.
> 
> > +
> > +       return 0;
> > +}
> > [snip]
> > +static int anx7625_i2c_probe(struct i2c_client *client,
> > +                            const struct i2c_device_id *id)
> > +{
> > +       struct anx7625_data *platform;
> > +       struct anx7625_platform_data *pdata;
> > +       int ret = 0;
> > +       struct device *dev = &client->dev;
> > +
> > +       if (!i2c_check_functionality(client->adapter,
> > +                                    I2C_FUNC_SMBUS_I2C_BLOCK)) {
> > +               DRM_DEV_ERROR(dev, "anx7625's i2c bus doesn't support\n");
> > +               return -ENODEV;
> > +       }
> > +
> > +       platform = kzalloc(sizeof(*platform), GFP_KERNEL);
> > +       if (!platform) {
> > +               DRM_DEV_ERROR(dev, "fail to allocate driver data\n");
> > +               return -ENOMEM;
> > +       }
> > +
> > +       pdata = &platform->pdata;
> > +
> > +       ret = anx7625_parse_dt(dev, pdata);
> > +       if (ret) {
> > +               DRM_DEV_ERROR(dev, "fail to parse devicetree.\n");
> 
> Please do not print this error (or at least not if err == -EPROBE_DEFER).
OK
> 
> > +               goto free_platform;
> > +       }

      reply	other threads:[~2020-07-08  9:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09  7:15 [PATCH v13 0/2] Add initial support for slimport anx7625 Xin Ji
2020-06-09  7:17 ` [PATCH v13 1/2] dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema Xin Ji
2020-06-09  7:19 ` [PATCH v13 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP Xin Ji
2020-06-21  8:09   ` Sam Ravnborg
2020-06-22 10:32     ` Xin Ji
2020-07-07  7:01   ` Nicolas Boichat
2020-07-08  9:00     ` Xin Ji [this message]

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=20200708090055.GA21256@xin-VirtualBox \
    --to=xji@analogixsemi.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=drinkcat@chromium.org \
    --cc=hsinyi@chromium.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=pihsun@chromium.org \
    --cc=span@analogixsemi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox