Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp795704ybt; Tue, 7 Jul 2020 00:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBhejhRFLymbiDpXnLSFGs30dYwczcHyi/1095ct+N/+0gaPS8+3NhgPy1UkhUozZl64hY X-Received: by 2002:a50:d784:: with SMTP id w4mr327521edi.34.1594105332017; Tue, 07 Jul 2020 00:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594105332; cv=none; d=google.com; s=arc-20160816; b=F+BPvD7GWDoJPOazoX3n75UAZFoIWtM31NkLztJpbeWxRDhUFsGseKgZoPv1RwsZ7S QLvjkKN4XJAdtfVUo1kO89/CIl9z9HQRUU6+MpZGs0sm77a/cOoD0GoW+uhyntQSAWTg V8i3l4XdN4Bqm1lGfUklmpA0XGvq/TkQZatglQYr/JfXlRkC6QsCXMK8+ZAkuFwNgK01 6a7h8ZYF3HfI00XVwp65DNQkg+hNqi/qKJfzQX4tP67VDOYM8WbkYkLXlfNoMl6gaGA1 x9teX71+1b+QH3zW3YSu0RHoMaozzSef0+eGv/v1ZsZDk7aqFl/6AGrhBscIVlGq9K4m HWww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qbsHVyeK2Vstzqb6QmhJv9+M3wOOHcWN7GhZMwhEauo=; b=oFPtVvo0znweecYxogDcuziwEM5psEm47R4xKwbu2NP/xgaQ9U0WFJs6Kt+ERc9lN3 cLCOcsnI0VI0hnastoj0C6yWy1mSbSOO+QSabXbLsX8El0mfER30Z/vIRCm1u9WSfqU5 zNB1q2S8eABCEtFwzlHX8PI6h9ZtHTx3vyB3PADZIx21PR3nWs9KfmtIoV8d4cu5vTk8 fWhq9/IN+uRRdTcGTtPDetD37PLIWon8HfoS4B4GgdoToV36PJBcCVFKS7K0AQiVbv0Q K2pAhhQkrRQYx9HO2YJrn5yhKGNkxgsSyvQYARzKpUasuAk2Kvfq1xwpWhKBpD2UBNKe lgng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EEyqfv3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si13854075ejq.387.2020.07.07.00.01.48; Tue, 07 Jul 2020 00:02:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EEyqfv3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728194AbgGGHBi (ORCPT + 99 others); Tue, 7 Jul 2020 03:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbgGGHBh (ORCPT ); Tue, 7 Jul 2020 03:01:37 -0400 Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D2C8C061755 for ; Tue, 7 Jul 2020 00:01:37 -0700 (PDT) Received: by mail-vs1-xe43.google.com with SMTP id v1so21956814vsb.10 for ; Tue, 07 Jul 2020 00:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qbsHVyeK2Vstzqb6QmhJv9+M3wOOHcWN7GhZMwhEauo=; b=EEyqfv3lnLwactKiE8HZ/CTLLA9oHPzdCHG+biD5AwMuhpZB+6M4SlswZoR/xFBP/T 7BVPdd4f+5VxTBjYxixYeitZbYSKWgJJKhSWFL5MxXSr7PKGu3zp/5IMUVhFpv3V/Wdt CjZU+UXTjLwhhLIQOa+VmBjJNqT/DdPK3ndHY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qbsHVyeK2Vstzqb6QmhJv9+M3wOOHcWN7GhZMwhEauo=; b=lldDc6NVZJgYAcpmpVJSpF8QsNrFQ7WwBTWjm3bVKl0CxJdIM3EBxVWW6b5SuoPFGa 8/PRgmEG9cjWwcDzANpsWuK2dA+hYJb+A34vgHnr+Mn//G1R/34wIKk6nTkO5mIs0GHx X2zjobjIlX1nBDiPy4fYPxTJ5eO84BC6C/YDreeni1xnkDaik525t4HlW17iEomUS+6Y UlExLSYijXBxjskerJx5G/YQE6mJxTT8Clui/5+MIYvN6CJLd3Qtk3CHYFycw9qMQvxn JVX6iRLpUAw3WOulkSGOl1vmPFmqBztV2grP3zTAAPUwyJ72iSbV8npsL1oxCwRZL+zc TBJQ== X-Gm-Message-State: AOAM532Pbmz3ROxj3Rgfdbc1Lnlhvp67EQDyfQDc1GraOxCgWdcSSQU4 xKKWoIfmaNVAppeKIawsuGUg6ppW1bVoI/Nv6k62oQ== X-Received: by 2002:a67:8e49:: with SMTP id q70mr3322116vsd.14.1594105296201; Tue, 07 Jul 2020 00:01:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nicolas Boichat Date: Tue, 7 Jul 2020 15:01:25 +0800 Message-ID: Subject: Re: [PATCH v13 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP To: Xin Ji Cc: devel@driverdev.osuosl.org, Laurent Pinchart , Andrzej Hajda , Nicolas Boichat , Sam Ravnborg , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Hsin-Yi Wang , David Airlie , Daniel Vetter , Dan Carpenter , lkml , dri-devel , Pi-Hsun Shih , Shawn Ku , Sheng Pan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 9, 2020 at 3:20 PM Xin Ji 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 > --- > 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). > + } > + > + 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? > + 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. > + } > + > + 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 > + return -EPROBE_DEFER; -EINVAL > + } > + > + 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) > + > + 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). > + goto free_platform; > + }