Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1132398imm; Wed, 4 Jul 2018 12:15:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFEXumUGSrsp4VOlTOfCVhJRP46nwzgQDPgl8bescK+bvVr4m78bdWdFvYagblGyestaXQ X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr3326156plt.162.1530731730838; Wed, 04 Jul 2018 12:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530731730; cv=none; d=google.com; s=arc-20160816; b=vEFWB/cO/CnGL8JKySM+3Z+pw9U/uMEUWAiwC26T022d7TW4sR6LretzbLJS9orcFN oz68NY5ZWb0ibsXdqcg4nFLGDLMr8iWCx/KumHCudRrbiM23PYN5MF1U4w6xSML9s8BP UAsXCXKjTxUU0bDk7rOhZz2hKg59UMpYw9ObSQexeszJmX9QTwceQ5jE+95fsl2Byfzw zPA8jtUvU1orNLmBD3DtCxsIL4+uYBt9yc84060Ma3MT5yOxDb/Ckq4isRS0XPOrr5G0 Lsb478QEMsiD+S7nPpcKHRQeHlpC5pCwLEt6ipbgZNYQCu2+DpVfobL8tla+6PWiSFPI 0XZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=LoEXi07qEj1DXsbklMFeG5ogGA8DiHcsoC4Yw2C008g=; b=FhdlSucl2JyuaHhPRZy71dmd4XmoBCygyKhzusSuL7ByreikEHyO1HWP8QVbblR0te ivSLwX4xrCcpymFFUxSHfS8s+31pzs6nlI5xsq4zxuoVBGA4Mz3GvxUnu8ZIFiv1YPoq +qVPoQl1tO5azS24Xonc1/YS4v0g2AslSZ+g1bruwT74N53f5RDUMcklm0sl5QfhD6vU sztcXWH+BZr+jRcQIn+K9SNTJOwXU9ss1C+lYp4PBKIyLmOzxeq39767bAvJOqCIidjJ zpWjcFjeSXM/lYWwUWNLJkNaLrGIhNYWAOAfqhQWoQMIXgmpduLnBFFdNVJW3ei3YPUu G8YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GioVhdqm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si4068360pff.269.2018.07.04.12.15.14; Wed, 04 Jul 2018 12:15:30 -0700 (PDT) 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=pass header.i=@gmail.com header.s=20161025 header.b=GioVhdqm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752801AbeGDTOe (ORCPT + 99 others); Wed, 4 Jul 2018 15:14:34 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37872 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752571AbeGDTNK (ORCPT ); Wed, 4 Jul 2018 15:13:10 -0400 Received: by mail-lj1-f193.google.com with SMTP id c11-v6so4979824lja.4; Wed, 04 Jul 2018 12:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LoEXi07qEj1DXsbklMFeG5ogGA8DiHcsoC4Yw2C008g=; b=GioVhdqmMrzFsTSx+Ek6X1fysNk+ua1vCnnyPeUGHAxCa98WHDC03nAE28KYtzXCws MoRgd6gd0FnPVtvuyK9xVF/Ja88p9zDqbhTmY3TOVc/3URyKyBYR9j0eJ339bGZIVpIG /AZXeInE9ccm9JfVADg2PazCDATKMEyaNVO2PidoJPgjEzJfoQIOz1ChK/2bEEoabTNr 4m/B8elcx1NlpEwZwHwwZ4XgcWilx635vcCClgnqlImYVyDyHiFRCDfREXniAAr4NEkT 5Ccfzx+/SmUD+umq0yVtyHzkQOIxeZiKgDsEbNcbR5gUJt1lLeHrs6DHTVyVmGj353jk 87Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LoEXi07qEj1DXsbklMFeG5ogGA8DiHcsoC4Yw2C008g=; b=DOkuwzi/eMHk3A0QZioLfRm0d9NX6jnSQFWjHvH7ji2W1fASXEf/XIW5qajJGfeWCR YUqZBYaa5YknwDhbjUqgruwNftxbldZY2AXj6rQ73+hZ/R+l/gG8X9g1LMH/T5F5pbX8 YuFzQhJx1IfQgo8luSTbmsYZpE592wk0g3PRqCl1wacggxM1IoAEysmYoBBG3sIoMb5w QStyC7ZeI0hZjrQRSzbu9WZ7MjB1hAkAmmi6blsaQs9OEd21Xo05I/o4OhN+WVUIATj0 YiJZ2FHeF5w3aCqTMYMY/qUbcKIvxrwiiNpIHFrIxENSpxnnOTqytKKD0AMUoZHRl2YQ hWeQ== X-Gm-Message-State: APt69E3HKwYjHVu0L737SC38CircZ6vgENHNXin9Ptjf4Bc5HK7pETgI 53bbtFqZ4MTQIaOGgNK1g+Y= X-Received: by 2002:a2e:7c12:: with SMTP id x18-v6mr2161163ljc.71.1530731588357; Wed, 04 Jul 2018 12:13:08 -0700 (PDT) Received: from z50.localnet (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id h20-v6sm939400lfl.77.2018.07.04.12.13.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 12:13:07 -0700 (PDT) From: Janusz Krzysztofik To: Boris Brezillon Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , Wolfram Sang , Uwe =?ISO-8859-1?Q?Kleine=2DK=F6nig?= , Fabio Estevam , Phil Reid , Lucas Stach , Clemens Gruber , Peter Rosin , patches@opensource.cirrus.com, linux-i2c@vger.kernel.org, Janusz Krzysztofik Subject: Re: [PATCH] gpiolib: Defer on non-DT find_chip_by_name() failure Date: Wed, 04 Jul 2018 21:13:42 +0200 Message-ID: <7058252.SGNltMTCCa@z50> In-Reply-To: <20180703193141.747fa950@bbrezillon> References: <20180703172635.32508-1-jmkrzyszt@gmail.com> <20180703193141.747fa950@bbrezillon> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, July 3, 2018 7:31:41 PM CEST Boris Brezillon wrote: > Hi Janusz, > > On Tue, 3 Jul 2018 19:26:35 +0200 > > Janusz Krzysztofik wrote: > > Avoid replication of error code conversion in non-DT GPIO consumers' > > code by returning -EPROBE_DEFER from gpiod_find() in case a chip > > identified by its label in a registered lookup table is not ready. > > > > See https://lkml.org/lkml/2018/5/30/176 for example case. > > > > Signed-off-by: Janusz Krzysztofik > > --- > > If accepted, please add > > > > Suggested-by: Boris Brezillon > > > > if Boris doesn't mind. > > > > Thanks, > > Janusz > > > > drivers/gpio/gpiolib.c | 13 ++++++++++--- > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > > index e11a3bb03820..15dc77c80328 100644 > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -3639,9 +3639,16 @@ static struct gpio_desc *gpiod_find(struct device > > *dev, const char *con_id,> > > chip = find_chip_by_name(p->chip_label); > > > > if (!chip) { > > > > - dev_err(dev, "cannot find GPIO chip %s\n", > > - p->chip_label); > > - return ERR_PTR(-ENODEV); > > + /* > > + * As the lookup table indicates a chip with > > + * p->chip_label should exist, assume it may > > + * still appear latar and let the interested > > ^ later > > > + * consumer be probed again or let the Deferred > > + * Probe infrastructure handle the error. > > + */ > > + dev_warn(dev, "cannot find GPIO chip %s, deferring\n", > > + p->chip_label); > > + return ERR_PTR(-EPROBE_DEFER); > > > > } > > > > if (chip->ngpio <= p->chip_hwnum) { > > Looks good otherwise. Let's hope we're not breaking implementations > testing for -ENODEV... I've reviewed them all and found two which I think may be affected: - drivers/mfd/arizona-core.c, - drivers/i2c/busses/i2c-imx.c. As far as I can understand the code, both depend on error != -EPROBE_DEFER in order to continue in degraded mode. I'm adding their maintainers to the loop. Thanks, Janusz