Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp6866057imm; Sun, 20 May 2018 12:27:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrfIvlFpYHARhQpUebT8ogzKwAQhBrBFWOqEb9JXW3ECbfUm+epysh+k6fj06kTEv2KJWk2 X-Received: by 2002:a17:902:4483:: with SMTP id l3-v6mr17893740pld.282.1526844455375; Sun, 20 May 2018 12:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526844455; cv=none; d=google.com; s=arc-20160816; b=jgZKtZrrsItflMV7wmLVdSVZutaD2insQG1cVRVPKGTj4l0FF9l75Bk8gm6CHRXxL+ wTGXUKA2sOmuoSbd0bZUe7kuizH69PhiT5o3T9+eaF2qcmt/cfnTXQutgjKi6NW96sL+ nt4iv1QNJ9KUU8mnRQJscgzQ9XsxypInYvhF1r8PWhXJzQArNnPjN184p8j29KA9/yCN VKad9nWw/32lmROOYCaeU62vlVUS3V7tz6oVo8/N3QtydjAEHYwg5CqXu9saxeVkx+PZ 94U09rfDMFhem+2lqMHD680v7U/zDgU4ZJneJWHid/A8KjDYh21b0e+qdhEFL0jyJPoQ 1hZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=RQ06o6MSnHzYMRLNAjjz+GSNZ9jaZGwCqUyebu1VNso=; b=HKbqP7KX/bYwcHunnkAnmb8d7luZCqyaHJ5bOvr8EQJWmoPbAGx4yIlCAJaAhxd6eh D6nIMk9K2q+kj+xQL2l7GvDIpJYLA7LIA9g6WMGZ5suKElyXSQdjHlQx2gDwDi/KGdGF aK8KG9fk8+7KxxtRwx+91WGYdUrHs9nlO0AGadPxs6sqGAyc/Oc9GNWEJWfAiWJsdCmG 5wzaglWaPnNt5zBJotSIYNju3GvDGhLHhnqy4hSlmksYjQuZx6Qk09vf/7weW02qX3PI Jfq6DChxKYW2IQsgviUfC9zED6D8hsAWUs188eomdbadU8dCjHPzDdGc16U/3T76RaBF ifAg== 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 j28-v6si12578934pfe.337.2018.05.20.12.27.19; Sun, 20 May 2018 12:27:35 -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 S1751451AbeETT1L (ORCPT + 99 others); Sun, 20 May 2018 15:27:11 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:55156 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751045AbeETT1I (ORCPT ); Sun, 20 May 2018 15:27:08 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23994673AbeETT1G1J3W5 (ORCPT + 3 others); Sun, 20 May 2018 21:27:06 +0200 Date: Sun, 20 May 2018 21:27:05 +0200 From: Ladislav Michl To: Janusz Krzysztofik Cc: Andy Shevchenko , linux-fbdev@vger.kernel.org, ALSA Development Mailing List , Aaro Koskinen , Tony Lindgren , Richard Weinberger , Mark Brown , Dmitry Torokhov , Liam Girdwood , Linux Kernel Mailing List , Peter Ujfalusi , Boris Brezillon , Tomi Valkeinen , "open list:MEMORY TECHNOLOGY..." , linux-arm Mailing List , linux-input , Linux OMAP Mailing List , Jarkko Nikula Subject: Re: [alsa-devel] [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table Message-ID: <20180520192705.GA12883@lenoch> References: <20180518210954.29044-1-jmkrzyszt@gmail.com> <3427199.r4OBoDP6Xz@z50> <5456625.lDWjtgZygK@z50> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5456625.lDWjtgZygK@z50> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 19, 2018 at 11:55:51PM +0200, Janusz Krzysztofik wrote: > On Saturday, May 19, 2018 8:00:38 PM CEST Andy Shevchenko wrote: > > On Sat, May 19, 2018 at 2:15 AM, Janusz Krzysztofik > wrote: > > > On Friday, May 18, 2018 11:21:14 PM CEST Andy Shevchenko wrote: > > >> On Sat, May 19, 2018 at 12:09 AM, Janusz Krzysztofik > > >> > > >> wrote: > > >> > + gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", > > >> > GPIOD_IN); > > >> > + if (!IS_ERR_OR_NULL(gpiod_rdy)) { > > >> > > >> So, is it optional or not at the end? > > >> If it is, why do we check for NULL? > > > > > > As far as I can understand, nand_chip->dev_ready() callback is optional. > > > That's why I decided to use the _optional variant of devm_gpiod_get(). In > > > case of ams-delta, the dev_ready() callback depends on availability of > > > the 'rdy' GPIO pin. As a consequence, I'm checking for both NULL and ERR > > > in order to decide if dev_ready() will be supported. > > > > > > I can pretty well replace it with the standard form and check for ERR only > > > if the purpose of the _optional form is different. > > > > NULL check in practice discards the _optional part of gpiod_get(). So, > > either you use non-optional variant and decide how to handle an > > errors, or user _optional w/o NULL check. > > OK, I'm going to use something like the below while submitting v2: > > - gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", GPIOD_IN); > - if (!IS_ERR_OR_NULL(gpiod_rdy)) { > - this->dev_ready = ams_delta_nand_ready; > - } else { > - this->dev_ready = NULL; > - pr_notice("Couldn't request gpio for Delta NAND ready.\n"); > + priv->gpiod_rdy = devm_gpiod_get_optional(&pdev->dev, "rdy", > + GPIOD_IN); > + if (IS_ERR(priv->gpiod_rdy)) { > + err = PTR_ERR(priv->gpiod_nwp); ??? --------------------------------^^^^^^^^^ > + dev_warn(&pdev->dev, "RDY GPIO request failed (%d)\n", err); > + goto err_gpiod; Driver will just use worst case delay instead of RDY signal, so this is perhaps too strict. I will work with degraded performance. ladis > } > > + if (priv->gpiod_rdy) > + this->dev_ready = ams_delta_nand_ready; > > > > > >> > +err_gpiod: > > >> > + if (err == -ENODEV || err == -ENOENT) > > >> > + err = -EPROBE_DEFER; > > >> > > >> Hmm... > > > > > > Amstrad Delta uses gpio-mmio driver. Unfortunatelty that driver is not > > > availble before device init phase, unlike other crucial GPIO drivers which > > > are initialized earlier, e.g. during the postcore or at latetst the > > > subsys phase. Hence, devices which depend on GPIO pins provided by > > > gpio-mmio must either be declared late or fail softly so they get another > > > chance of being probed succesfully. > > > > > > I thought of replacing the gpio-mmio platform driver with bgpio functions > > > it exports but for now I haven't implemented it, not even shared the > > > idea. > > > > > > Does it really hurt to return -EPROBE_DEFER if a GPIO pin can't be > > > obtained? > > I'm only concerned if it would be an infinite defer in the case when > > driver will never appear. > > But I don't remember the details. > > Deferred probes are handled effectively during late_initcall, no risk of > infinite defer, see drivers/base/dd.c for details. > > Thanks, > Janusz > > > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel