Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5853344imm; Sat, 19 May 2018 11:01:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqsm4hCJo068DWJSn1kqS3CocSwHHFn3rtx2In+CgRwOi5oH+ohNpFuGP9ReyEg1jxtTYXh X-Received: by 2002:a65:4d0b:: with SMTP id i11-v6mr11012437pgt.51.1526752896337; Sat, 19 May 2018 11:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526752896; cv=none; d=google.com; s=arc-20160816; b=OxBwDusJdKDUC/5uBFEoLdV4AtG+8IKjZGkudvLUskNTIUj6SnFqv2O8BktSCurkTH g2piTXl50o4kQpMIrW0LzmFNuaMmtk9LM5U9xtseDIe/rcrPF+qgOd0oMCsiAi9nACyW Tow+AYMemyM+locjgqnlt090XbfJBNUsPGVRFcgQKd3GVgGVv8oQVX0C1O26F8NHQOlp 4GVCh9scYWCSz7HkePaaqw9PkgwLbhv4LSD9M+l4/XDQ4iaK/6I4Vlx5G9Ze66QZM9qm JURHIqhV6f2aFpaZE6Fwz3zf7FfR3YSG29PGB0WTHQgLm5JMtrAtq+7oMgRmEXDNPLBC ym/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=sM/3pPMwwHt9QIfJTnkUsesvfGtOYCgA5qIGLZoRKuc=; b=cW4U1/WWPII/zTb206dKBx+FdanfvxKYjpXLH3CSKdlrY2l0N9idHHTe+KQKmGe82g bdMdDB9PIWxU8UGtWXyXae8fCKVXUuwgezdbcADF0x3WnhXB6nZ2q4BiuA19Tl5pFPmP d3EWn1UIZQpcF6xuYWDbSdn3Qec8UotAM+siyl0RmjFv+bdHLaemVrWsMsi84kz3vh/s Ff7vIllQ6hxLv9+bXkSkMfn5qaiQ7i8xFZnOnhhZUEKGua1p3+OqygTWoz1WuVUIwTvs SlzNLMblUuwd/Hobl15GA5LYf5y0mrZZMHObznsReqPmwe1KGHs76at69flfzUCH/9ZI 1H7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XWvjvf55; 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 z1-v6si9845154plb.558.2018.05.19.11.00.54; Sat, 19 May 2018 11:01:36 -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=XWvjvf55; 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 S1752529AbeESSAn (ORCPT + 99 others); Sat, 19 May 2018 14:00:43 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:45036 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752414AbeESSAk (ORCPT ); Sat, 19 May 2018 14:00:40 -0400 Received: by mail-qt0-f193.google.com with SMTP id d3-v6so14311288qtp.11; Sat, 19 May 2018 11:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sM/3pPMwwHt9QIfJTnkUsesvfGtOYCgA5qIGLZoRKuc=; b=XWvjvf55fE56iehAoYTVJS+Y04UWgCF/PXlYTY3Hmmg/m/QRXpw3pQTS/Oiy7DrS/I isdSl8dZuH7GLMdpq/u9W8DTyQa4PrTnCuxv9l1EUvLjJW8TJU+n8m9om2L3hoVDrzJv SnMvDXyb3nMV8AjXqsutOf2cH/IV0Byyiscc5xj4Y+p1VQwEYfCoY8AWgLN3nu3zQJSA MGibsS8KNQCk0+vK+Ri1TcUT329mkX7Y5aHviDj012X7Hbgp5YC9C/UP5MgihxYF6Cf3 AUy0gQ9R2eCQsmDflBx5jdSmzlNNlUeRQMm4CeGEwbPD9q3lcHnPikum5FJtW5hEcvTz o6yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sM/3pPMwwHt9QIfJTnkUsesvfGtOYCgA5qIGLZoRKuc=; b=l3lPkV64GLRvwS+1EzXiI4W2ZW6bqMkJAyTI4Nrz/ZpFPWLaXz2tLaTYl1kG2IC/c3 0r32aj349ZF/oHhlhG9Utmn/EccSkQwpkLYBKgH0UWf/P8tbwaCoZ3dBTRBSDvdySF22 E4Ack4L2nKSweR9sxxJmGZPrRyDT4YLbTQCkY1Fg0iUweF6TWlxSfTTIvE49ndv5Rty/ Z+9ABgKXa6elE1r8K3/PE5zYFWZhayC20DmJVhLMcZ/bm2IrqXRKKdgm53SmAJDiKq39 toY309B2OqfA7Yn8IacOMzq8rNdeDpCeUhYimDXTNMpdt7BWDsV8NeKeABFEbEZoOL5+ ES7g== X-Gm-Message-State: ALKqPwd8a56wfn8egGfFfFf29aO+1X9hqX/OAd3WzyBjZZOHO38/4KZr JMR1WM/xdWIDxtblab5kwON059NiRRSBTsskhOo= X-Received: by 2002:ac8:3488:: with SMTP id w8-v6mr13893881qtb.278.1526752839225; Sat, 19 May 2018 11:00:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.150 with HTTP; Sat, 19 May 2018 11:00:38 -0700 (PDT) In-Reply-To: <3427199.r4OBoDP6Xz@z50> References: <20180518210954.29044-1-jmkrzyszt@gmail.com> <20180518210954.29044-5-jmkrzyszt@gmail.com> <3427199.r4OBoDP6Xz@z50> From: Andy Shevchenko Date: Sat, 19 May 2018 21:00:38 +0300 Message-ID: Subject: Re: [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table To: Janusz Krzysztofik Cc: Tony Lindgren , Dmitry Torokhov , Boris Brezillon , Tomi Valkeinen , Mark Brown , Aaro Koskinen , Richard Weinberger , Peter Ujfalusi , Jarkko Nikula , Liam Girdwood , linux-arm Mailing List , Linux OMAP Mailing List , Linux Kernel Mailing List , linux-input , "open list:MEMORY TECHNOLOGY..." , linux-fbdev@vger.kernel.org, ALSA Development Mailing List Content-Type: text/plain; charset="UTF-8" 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 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. >> > +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. -- With Best Regards, Andy Shevchenko