From patchwork Wed Oct 26 12:52:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ahmad Fatoum X-Patchwork-Id: 11244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp256399wru; Wed, 26 Oct 2022 06:08:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lXByPJPdGrC+PhUnirgnn7c9lFMzwORTF63Y+rt6q7iGcA+EWG5tU2Ej+wDMWa4z1klFh X-Received: by 2002:a17:907:a05:b0:77b:b538:6476 with SMTP id bb5-20020a1709070a0500b0077bb5386476mr38043229ejc.324.1666789697195; Wed, 26 Oct 2022 06:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666789697; cv=none; d=google.com; s=arc-20160816; b=fkZc3lMPX7s6BKH9PEM330m9y5z8oscxcWqcJ8BukJMElI+IUFKlWg0M46WXO4G0ID tPKGUpGNl0d/SvsCND+NGJiU4OrzTk6ZQd9x5p3zq/qu/x/6Qp+VuOrTVZJnu0mBBPZO Qyl0RQn3d8e1u0pSmkupTi4T3epNNdz/rtPDFn9u2cWNetlAw1IMXwbydXC2fcFowUrp oHZJPx7cPIOHdQgebg32N4Tpt/wvX7IhzTps28ktvMiebx8INgYwUvk4tw2QxVoZqmUZ wOy5edGf7JDdmPP5yhZDBP8Bn9STIF9HCu5KQ2hnqpcZQgffT2k8ewQHPgLhhVTLXcK7 WDuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3ohfrghuKrxN5ohi07qfJGVgrNhx4jWIdP/SUuZDx2Q=; b=KBCw2mc2Qke4lCAP0wDCkeoQagThZTH1TFatohA1P8ONkIIDakapySrkiefrBeb0D0 YZeoiCKDv8AZhTH4M8lpXTW18HKV/+fF8GV9rOFGGMtRL1l5HUoORYRr7E4ELMBWhlpW MA11hhr6An4KrIikuJGK82AyRcoyoPMQ1FzbEd/6ikCwpA6azzBYifVFN3TitU4gs+29 xriFyUC56zf3x3WNRq8UyTV6eqVS42zg0VWXN4dDUConqESExkXUWaDI0dQM1Mio9Y0Q v4+ZWFPn9zhlAhV1GYSpH5lsy3DXWRn7Jibdr3cgwka//ffipY707RVQYFMDiMtR9id2 MpKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a17090658d300b0078da3cd3073si7592334ejs.628.2022.10.26.06.07.39; Wed, 26 Oct 2022 06:08:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233544AbiJZMxR (ORCPT + 99 others); Wed, 26 Oct 2022 08:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbiJZMxQ (ORCPT ); Wed, 26 Oct 2022 08:53:16 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C835F6156 for ; Wed, 26 Oct 2022 05:53:15 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onfu6-0007qw-7r; Wed, 26 Oct 2022 14:53:06 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1onfu3-000Vdm-6B; Wed, 26 Oct 2022 14:53:02 +0200 Received: from afa by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1onfu1-00DNR1-HV; Wed, 26 Oct 2022 14:53:01 +0200 From: Ahmad Fatoum To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: kernel@pengutronix.de, Laurent Pinchart , Ahmad Fatoum , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] drm: bridge: adv7511: use dev_err_probe in probe function Date: Wed, 26 Oct 2022 14:52:46 +0200 Message-Id: <20221026125246.3188260-1-a.fatoum@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: afa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747755673768388149?= X-GMAIL-MSGID: =?utf-8?q?1747755673768388149?= adv7511 probe may need to be attempted multiple times before no -EPROBE_DEFER is returned. Currently, every such probe results in an error message: [ 4.534229] adv7511 1-003d: failed to find dsi host [ 4.580288] adv7511 1-003d: failed to find dsi host This is misleading, as there is no error and probe deferral is normal behavior. Fix this by using dev_err_probe that will suppress -EPROBE_DEFER errors. While at it, we touch all dev_err in the probe path. This makes the code more concise and included the error code everywhere to aid user in debugging. Reviewed-by: Laurent Pinchart Signed-off-by: Ahmad Fatoum --- v1 -> v2: - broke overly long lines (Laurent) - Added Laurent's Reviewed-by --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 6 ++---- drivers/gpu/drm/bridge/adv7511/adv7533.c | 20 ++++++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 1c37779b434a..4148b6d6f151 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1229,10 +1229,8 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) return ret; ret = adv7511_init_regulators(adv7511); - if (ret) { - dev_err(dev, "failed to init regulators\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "failed to init regulators\n"); /* * The power down GPIO is optional. If present, toggle it from active to diff --git a/drivers/gpu/drm/bridge/adv7511/adv7533.c b/drivers/gpu/drm/bridge/adv7511/adv7533.c index ef6270806d1d..9b73a606ec57 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7533.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c @@ -148,16 +148,14 @@ int adv7533_attach_dsi(struct adv7511 *adv) }; host = of_find_mipi_dsi_host_by_node(adv->host_node); - if (!host) { - dev_err(dev, "failed to find dsi host\n"); - return -EPROBE_DEFER; - } + if (!host) + return dev_err_probe(dev, -EPROBE_DEFER, + "failed to find dsi host\n"); dsi = devm_mipi_dsi_device_register_full(dev, host, &info); - if (IS_ERR(dsi)) { - dev_err(dev, "failed to create dsi device\n"); - return PTR_ERR(dsi); - } + if (IS_ERR(dsi)) + return dev_err_probe(dev, PTR_ERR(dsi), + "failed to create dsi device\n"); adv->dsi = dsi; @@ -167,10 +165,8 @@ int adv7533_attach_dsi(struct adv7511 *adv) MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE; ret = devm_mipi_dsi_attach(dev, dsi); - if (ret < 0) { - dev_err(dev, "failed to attach dsi to host\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to attach dsi to host\n"); return 0; }