Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1406658imm; Tue, 3 Jul 2018 10:32:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdQzHiERbdiQzjwXjeZ7frLoJczs7ifvojHC/jYK30y6rfd168T99Jnm+MlNBUVzYos+rRy X-Received: by 2002:a62:748:: with SMTP id b69-v6mr9390832pfd.177.1530639163778; Tue, 03 Jul 2018 10:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530639163; cv=none; d=google.com; s=arc-20160816; b=iGEJmVeHPpeIv24RGTd4mIuo9+D1JVk9vGHU+LNn4/HkyxUBKNPvNdQlFw3hjP8BtM heI/KMesWI9UDqFoGdiL0eM9fZKwenFr6Eup7RYF9pKJuVdGwk/HH2MTEZsfw2xnoOoD o9hKC2yYeJqSdYZdl3Qk7vszxapSSEL+Qvv13V2s69ftDrScrKZcchRs5cKxMnu3Aw07 1/QOqmGr3C+JrJci922fkczlzbjAfxbB21xOMKbG/J9xVZp9WD1iD7xWB3sD59XhxzRz MNbJMDyjQB2QkzM1jzNKds8mkNU6tGVlKtcAHlOYWZ0h7L8CniqrZmeGpOEEiAtgqCwp pJHw== 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:subject:cc:to:from:date :arc-authentication-results; bh=21NaQvzFvbvKzptToaXGGR2tSPlxCxDHVBI/11XON60=; b=FICq/KdEEdp0vlkm8iJuqr0dKBcp22bE4z1KkxtFhb/JPqoquVEY72UqY7Sfy4HZF+ UzmVeIu/XAbwmmcF9Qbewt6siMS8kXACJsQVvwg9kEC+Xzmjt4yVedDi3Ef+/00kY2Mq YoZ26P+Q1PD5sDYDit7qPhbhm9q1JsbebXtJCO4qe7g44H1udqh6A6L4p3sQIAik7lak w5pGnbxmNo4v8fk83g9KQ6r89cW4juXrAoX22SVau6pH7rClBV6Ds39wgxoTGWauQD1a xJjxdL7TM5btTmFN8DWh5ePfyLKWJthBqsjxD9NFDYkyGDdoGBlVZTu1YSXGsC2zsePs wqyA== ARC-Authentication-Results: i=1; mx.google.com; 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 t137-v6si1493197pgb.528.2018.07.03.10.32.28; Tue, 03 Jul 2018 10:32:43 -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; 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 S934247AbeGCRbp (ORCPT + 99 others); Tue, 3 Jul 2018 13:31:45 -0400 Received: from mail.bootlin.com ([62.4.15.54]:47219 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933569AbeGCRbn (ORCPT ); Tue, 3 Jul 2018 13:31:43 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 73F9A20737; Tue, 3 Jul 2018 19:31:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 41A852069C; Tue, 3 Jul 2018 19:31:41 +0200 (CEST) Date: Tue, 3 Jul 2018 19:31:41 +0200 From: Boris Brezillon To: Janusz Krzysztofik Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gpiolib: Defer on non-DT find_chip_by_name() failure Message-ID: <20180703193141.747fa950@bbrezillon> In-Reply-To: <20180703172635.32508-1-jmkrzyszt@gmail.com> References: <20180703172635.32508-1-jmkrzyszt@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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... Reviewed-by: Boris Brezillon Regards, Boris