Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4732154ybv; Mon, 17 Feb 2020 04:57:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwR/0r2nVZjBi4grgQGwEzg5uhCP7nOdKg/uMOJWoUIwje8px4aIB2M2EdG5VHCGi+SVEA9 X-Received: by 2002:a9d:6b06:: with SMTP id g6mr12032883otp.93.1581944249864; Mon, 17 Feb 2020 04:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581944249; cv=none; d=google.com; s=arc-20160816; b=kAwEjJhLD6XF8s17oJa/UDkka/KRdzV3UIGjBvfM/ZwLlJ+bIeigeayvcupcWAIhpi oWRhuLkeuQulrQSb0MEDrt8jzJhs7oe38tfjO3s8g8YTzX4qfVrXTBfur8QT1QPhLwS5 upg7GWdO5VIMDCK8/v5Cb/gtksJnN/IcBA5uDfpVotVCJCoUkqllk155DAgljQVX6aH+ jeeeYUGP8JQDX0dA9JiUjRmWIBQDvis+nhjMKeKv1Zmz0S5i4OiVW2t1Ps9SKo2PYd5F coB5wMlgB+c3o2v0S3c2ca2FU3aKmESgOeZIOx0eEgrDNED2PSFv4eySOCWSkyLuQ0vl 1P5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=gwvD48n/zrKQkZA3LrOyQDl0wGdy39OY1AO4/Rvx8d8=; b=fomxTQrTuPqfRdxJ1kXSSre3lueyR8uwTgHpT6WdjLd10fhLS2KgI44eOKRnnWqmvn XBocxjipYLy9s+1JtRHkF+HxBpeT0APHDB9wVjd3xbbrWVF+LILSFOwC1DgNWNoVnh6Z dH38PpeTyKTWZ6aC6/bq1yeAzxeT4PegyHX6QEYOSnkpiieXHI/FR5ssVj6EgK0dNlOI Xi398dRQ7EI0ENpEOCyqlItM7yWic5B3Jb50EkTfWatcjtQMi2TxmomkAiA2Y14lSZ/I n1I9ERjSs1vVyv0/s/Kwd6eqJetY5K2X2vbMy6fxv8Ee4QMcQUNAM8HGnAaCPT5px5nc c9YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@goldelico.com header.s=strato-dkim-0002 header.b=X5l8eV95; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si144530otk.196.2020.02.17.04.57.17; Mon, 17 Feb 2020 04:57:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@goldelico.com header.s=strato-dkim-0002 header.b=X5l8eV95; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728520AbgBQMVl (ORCPT + 99 others); Mon, 17 Feb 2020 07:21:41 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.54]:35689 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726932AbgBQMVl (ORCPT ); Mon, 17 Feb 2020 07:21:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1581942098; s=strato-dkim-0002; d=goldelico.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=gwvD48n/zrKQkZA3LrOyQDl0wGdy39OY1AO4/Rvx8d8=; b=X5l8eV95gvqr/5zzpxllVlcTnZJlixLZP6Vf55wejxLne2+4u1z27WtJ6x6UZJReg/ UbjAFDIEAL6jACSh1JF7Sjl1BH8dHgdqQVnU5+PwEZGzH+3DXk8MCjQTm7f2wQgGzGtx s5Dnd1EbA5NJ8yvkSdCN24o/QHgqM3z46pX6Q0+Gz9p7pmF7qNwmp4Hb0CkPzlQxMwk8 4+2X/AJvHTT3HQ8fNfwppOyYmjSt6rK6Tdm+edUbWo3FlwemUvdUpPLtaZfL0qd7CYu+ Csuo/x4Ub/2TcqLh/bHbyqATUt/LZakjW/I7VV0lZTHUhfCe+7gOeJpbts2HicGVp6jw rGKw== X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj5Qpw97WFDVCaXA0OXQ==" X-RZG-CLASS-ID: mo00 Received: from imac.fritz.box by smtp.strato.de (RZmta 46.1.12 DYNA|AUTH) with ESMTPSA id U06217w1HCLVMmu (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Mon, 17 Feb 2020 13:21:31 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [PATCH] extcon: palmas: hide error messages if gpio returns -EPROBE_DEFER From: "H. Nikolaus Schaller" In-Reply-To: <36bac0ac-f772-9f04-fb64-1c11e9d86fa5@samsung.com> Date: Mon, 17 Feb 2020 13:21:30 +0100 Cc: MyungJoo Ham , linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com, linux-omap@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <673AFAA2-DF93-4FD7-BBCD-8F7FC58FFCEC@goldelico.com> References: <2DF972B9-EECF-44E9-93FC-74B6C3B6FFC2@goldelico.com> <36bac0ac-f772-9f04-fb64-1c11e9d86fa5@samsung.com> To: Chanwoo Choi X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > Am 17.02.2020 um 12:24 schrieb Chanwoo Choi : >=20 > Hi, >=20 > On 2/17/20 8:07 PM, H. Nikolaus Schaller wrote: >> Hi Chanwoo Choi, >>=20 >>> Am 17.02.2020 um 11:15 schrieb Chanwoo Choi : >>>=20 >>> Hi, >>>=20 >>> On 2/17/20 5:55 PM, H. Nikolaus Schaller wrote: >>>> If the gpios are probed after this driver (e.g. if they >>>> come from an i2c expander) there is no need to print an >>>> error message. >>>>=20 >>>> Signed-off-by: H. Nikolaus Schaller >>>> --- >>>> drivers/extcon/extcon-palmas.c | 6 ++++-- >>>> 1 file changed, 4 insertions(+), 2 deletions(-) >>>>=20 >>>> diff --git a/drivers/extcon/extcon-palmas.c = b/drivers/extcon/extcon-palmas.c >>>> index edc5016f46f1..9c6254c0531c 100644 >>>> --- a/drivers/extcon/extcon-palmas.c >>>> +++ b/drivers/extcon/extcon-palmas.c >>>> @@ -206,14 +206,16 @@ static int palmas_usb_probe(struct = platform_device *pdev) >>>> palmas_usb->id_gpiod =3D devm_gpiod_get_optional(&pdev->dev, = "id", >>>> GPIOD_IN); >>>> if (IS_ERR(palmas_usb->id_gpiod)) { >>>> - dev_err(&pdev->dev, "failed to get id gpio\n"); >>>> + if (PTR_ERR(palmas_usb->id_gpiod) !=3D -EPROBE_DEFER) >>>> + dev_err(&pdev->dev, "failed to get id gpio\n"); >>>> return PTR_ERR(palmas_usb->id_gpiod); >>>> } >=20 >=20 > How about editing it ? as following: > because following suggestion reduces the one checking behavior > when return value is -EPROBE_DEFER. >=20 > if (PTR_ERR(palmas_usb->id_gpiod) =3D=3D -EPROBE_DEFER) { > return -EPROBE_DEFER; > } else if (IS_ERR(palmas_usb->id_gpiod)) { > dev_err(&pdev->dev, "failed to get id gpio\n"); > return PTR_ERR(palmas_usb->id_gpiod); > } Yes, looks indeed to be valid (some discussion around is here: https://lore.kernel.org/patchwork/patch/999602/ ). So I'll send an update asap. >=20 >>>>=20 >>>> palmas_usb->vbus_gpiod =3D devm_gpiod_get_optional(&pdev->dev, = "vbus", >>>> GPIOD_IN); >>>> if (IS_ERR(palmas_usb->vbus_gpiod)) { >>>> - dev_err(&pdev->dev, "failed to get vbus gpio\n"); >>>> + if (PTR_ERR(palmas_usb->vbus_gpiod) !=3D -EPROBE_DEFER) >>>> + dev_err(&pdev->dev, "failed to get vbus = gpio\n"); >=20 > ditto. >=20 >>>> return PTR_ERR(palmas_usb->vbus_gpiod); >>>> } >>>>=20 >>>>=20 >>>=20 >>> Usually, gpio driver like pinctrl is very early probed >>> because almost device drivers should use gpio. >>> So, I have not any experience about this situation. >>> Do you meet this situation on any h/w board? >>=20 >> Yes, I have experienced that sometimes on omap5+palmas based boards. >>=20 >> It seems to be this: >>=20 >> = https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/ar= ch/arm/boot/dts/omap5-board-common.dtsi?h=3Dv5.6-rc2#n384 >>=20 >> The extcon_usb3 can potentially match this extcon-palmas driver at >> a moment where the palmas_gpio it is referring to has not yet been >> successfully probed. Then the palmas_gpio would return -EPROBE_DEFER. >>=20 >> AFAIK there is no guarantee for a specific sequence of drivers >> being probed and it is pure luck that in most cases the gpios >> are already probed. >=20 > Thanks for explaining the example. BR and thanks, Nikolaus Schaller