Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp6648633imm; Sun, 20 May 2018 07:45:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrLVA6j5Q1jHDuseBUt/p0tuo4VUYwcalbj4AGeBRPQ7LH01E2X8d/udeoZ6fo41JWIzHun X-Received: by 2002:a17:902:205:: with SMTP id 5-v6mr13320025plc.301.1526827504011; Sun, 20 May 2018 07:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526827503; cv=none; d=google.com; s=arc-20160816; b=Ihw7wD6+tJ1i290OsLnLyAVp773isJdKOhz5fTCXCKpfx3FsgHqifqie5G2ZV2tapy 2Wugs9KjqjSsFWFScKWn3zxIrkgtNkcvYjv8e2iPTD7cN/MSoq96aiCyun/HQkIgrwJ7 kt4U8GtmpqtagnCY7lE8K1OJ6SAlCI1ZU2gGfrTZxEfeVtzt054gcQpKss5VQc/vfAuJ aV0B4yVj2cQq/3Cf23no6YrGqEZOIWYhMn2V8qIwF6OYZr+ZO/5krM283zGcMuzLWUCu 0VxORRLGc+wTQFEGvA7KzQ1XadghKR18tePfv0UQ+aXIXmSlxJ/89ggWI+yLlBG0M/Pf 5NuQ== 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=cgzYlsEU874lJlgFxfvwQdDYKlNPvoUXlhVzWfectAU=; b=qZOakuMLQIUzrtKVLY9KWfGOvVE2pSf4KVHSXgElijP9fUshV0HYGrai2gD++LFEtz CaqjSmvj0qkVVSBhnTleykx10Fp/Nlxb/SVBYmqBfTAJ2fsLa63qz5BOSjmtc11SRxyU Tl+SepGLjF1crE4rAQV02kGaMB2ToSTXklWPD2wlBeq5IqD+LGOyTu/UfIDpPQQ3ObEh JIqvw9rTXtEjg4lYEGsYCouNdZICk5H78oZArgOLrfO4GRgVXDCHtHzE9cZ1owndVSwc 1MHqLg/a6R8qv2HQEb2RXQR8n7tYxuH6dXR1V2pHa/jTR5lE96wKCe56cs8jUidXWqDI TC+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t9pexWaW; 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 t1-v6si9563326pgr.681.2018.05.20.07.44.49; Sun, 20 May 2018 07:45:03 -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=t9pexWaW; 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 S1751862AbeETOog (ORCPT + 99 others); Sun, 20 May 2018 10:44:36 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:36720 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751555AbeETOod (ORCPT ); Sun, 20 May 2018 10:44:33 -0400 Received: by mail-qk0-f193.google.com with SMTP id l17-v6so725792qke.3; Sun, 20 May 2018 07:44:32 -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=cgzYlsEU874lJlgFxfvwQdDYKlNPvoUXlhVzWfectAU=; b=t9pexWaWdK5pPkEMubeZBYzaiSIxP/wQBe/DnYgiJRemPk4XEydAj+ezoM1OhNkrAP 2DVUjrvo/4UDkR9twGKgKDWBrNil+Ghxd6oA5izXL3e8TjG892MDSu14+bIhGF+0DHxr A3y0iTMkkDlwJkogwxwlxQdZWWmwHv32R4gFq+nNEGPKG18ZsMXsUHSOJ9fxE3BfPVQl fEiqxxOgzWZXOUSxdIWIprWxPx8HOGoeYgm2aqdGboHd0dWleK0HG4xVJRBHcO0/4qyL TTTUAZEJdqT6uJiSx2psKiHEc7ab8Q2eQk68g0olIbMCo4ypyMhl8D1HU6VY157utjBp JG/g== 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=cgzYlsEU874lJlgFxfvwQdDYKlNPvoUXlhVzWfectAU=; b=OO6R7ssj6350cjolKmzRYj/ADnLKYTVk4jtSWzfNaAIFU3HADGR12k3rWkLGcvUcvm Js2tziUdp65nBOUjfil3DH2fTYZi2VVcwsVcdPdVHf8oPDDSq4kjJNnDnWCndfF2i6hS ebeeWnwLLI1kfiqd0AuW88/juv+4r7Qstixe6Hwzq7tLzVvkaE8ZaR2+u9+Xk+JgASB0 zsL6uJgoGx/Q7gqyANC5yZdtSx7lkwcDCUyIKev20oNQKC84p44e1Ot2d3TIzggnWm8+ POdA2/YueKWDXsIGapqgDNwRdTO8kF7m17E+K58/RgrGaeSokGQNYCVrAREsH2Po7j9I 5r+w== X-Gm-Message-State: ALKqPwerH0h4mQIxpHCdZNir/slbyWXSeS7Fos9Yb0bbWlJ6K+j5d1Vd WAsj2vFt1Qb6a0SOKfD/FA7VPDv+69OpTa+wK9s= X-Received: by 2002:a37:83c4:: with SMTP id f187-v6mr13974152qkd.97.1526827472390; Sun, 20 May 2018 07:44:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.150 with HTTP; Sun, 20 May 2018 07:44:31 -0700 (PDT) In-Reply-To: <5456625.lDWjtgZygK@z50> References: <20180518210954.29044-1-jmkrzyszt@gmail.com> <3427199.r4OBoDP6Xz@z50> <5456625.lDWjtgZygK@z50> From: Andy Shevchenko Date: Sun, 20 May 2018 17:44:31 +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 Sun, May 20, 2018 at 12:55 AM, 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: >> 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; > } > > + if (priv->gpiod_rdy) > + this->dev_ready = ams_delta_nand_ready; This makes sense. Though, I completely dislike "rdy" name of GPIO. Where is it documented? >> >> > +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. Yes, but the code you provided in patch looks somehow suspicious. OK, I let Linus decide whtat to do with that. -- With Best Regards, Andy Shevchenko