Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp6006908imm; Sat, 19 May 2018 14:57:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrlofTLuBuPJ/DjPMO6zamgROlHWfRaQWBy6/3Y4Np7HdMaNi8HBZ2xB3glhcjvUatoelp1 X-Received: by 2002:a17:902:7883:: with SMTP id q3-v6mr14937749pll.71.1526767043523; Sat, 19 May 2018 14:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526767043; cv=none; d=google.com; s=arc-20160816; b=ba9LgZJapW9WCrZB5IovXFCYSy1wNl+W4LKL6raWV2fECc4XQsNtDAsoODg3nQk/MH I6Lbpi7PhFzOlaAXHgRbVdDMWSgaqrihrjwkBMilTa4jhW29Yo1JAt2ZfkmFHc6STo8v V264R606YqKIDiVVVCQShIaAFe+BjQv3JeRU/s4HsVm3aW88QFSTIbfqau/oUxkSKFjv Pm7sbvXum916CtSbv0G4kdnGE+p/Mc0bDCBoVdovvgLssDk0JYGbBJmxdjGRg11EvrKK oXnaGNLg9x64lL6qFSvJrobdiFpg2COfNKkaql6KjhfP+RcwjgVfZbkHvs8hqmgoLZEf lKyA== 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=I57MqT34vSatMyTuMS0l2FTe+g9LvUmB0Lc1w7vdnaQ=; b=gh98eFYQy0yAOe2ydm/P4b2avt4n/GoW8ahRp0jRqZm/hJZsrbEFluwDldGyyrgq8C /icCc/1XYhDfEUcdF6OyT7I77fQDs8Bi8Bf7GwhStfGpHoueec7OQayoPmzNoJPcMuZV Yu+/BFUJpKWeS47nMbjXVm+cL7gMl1tPOuGV38WI2q+Y6aM5uFTMzB9SdO1swSY9mPmN kb5i+MJglmtw/ae12DXhHnmzy2cEswr0eOiDKdRhWv5bjirTJBfpLSD2yXw+hzMy0JmB gUp1NxNLKEKyA1EY0K5cKhHPzndhS3lMf07CDQZvU7z1vPw9RiscQd238uIYbx3vAxnW pwWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ggMAuaIN; 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 p1-v6si10379411pfe.158.2018.05.19.14.57.09; Sat, 19 May 2018 14:57:23 -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=ggMAuaIN; 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 S1752628AbeESVzs (ORCPT + 99 others); Sat, 19 May 2018 17:55:48 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:44979 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752553AbeESVzp (ORCPT ); Sat, 19 May 2018 17:55:45 -0400 Received: by mail-lf0-f66.google.com with SMTP id h197-v6so18795793lfg.11; Sat, 19 May 2018 14:55:44 -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=I57MqT34vSatMyTuMS0l2FTe+g9LvUmB0Lc1w7vdnaQ=; b=ggMAuaINfbmzXqLs1WPEQ1bwfaafCRoGuf/PDOIXgkkFdylZvrTSYCCS3NUuW6EhcI p/t7k80piNflhnNlIQRkllfejKB/2IDBLvCnCtlzNfbxI0SR/23v98FwIuPSgKWDdM4P fcjDLPdD7x8rMe+2hZl+RxTFXW9No7lYSc/W1nZ7seybmry8f4q4SlUyrUKjKL2Gx6Uk joCxNX8BURByaO+n+AM6+dc+39FQPUXzhi50akI1UNuvVSeEp8ooVNaqcAmTFij/LrC8 3Uz7C22OvD/PwdVBi9pWLca3OTKXweTb+qCkbMZxRFmvX+px60Qd28/T4A9apGdekrkK RxMg== 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=I57MqT34vSatMyTuMS0l2FTe+g9LvUmB0Lc1w7vdnaQ=; b=qgw+jNvdPFu516ArrZv+rWZjDZV+gd3env3orSV7If7JR2JsPLh5FdccjT0qzbxttb 1sJB+iDt5mx/v8XHznBrPkkNoX02gINMpt+kMc5UzPje7flKZ/6uGIWF2M5rCO0UOozZ V7mkAuql+T1HqM+Kk4A6orMHnNApskCH11/JnV2a2sRaUeSH+nFGrKFq/q00R73QHxM9 yO5ORyBXghKBEa0f9rpwv8zQTWLEuVRXu7jhTrsDsgesUtIpZtTxnAbDo90l888lJpky TcR69dbJuSEvsESbhwhmhfKzoMIJqDM/xme+XMJ9ARozP09/49wk0+bZVdFQkqXoAh+j 8AvQ== X-Gm-Message-State: ALKqPwcDNMQhKHRsTZcLaLO+6NpZ6xvmdmWk6BZwcN6HvGwj5nDQsPvT hsn8ImalsmVjWyMY0w3KTAE= X-Received: by 2002:a2e:9d07:: with SMTP id t7-v6mr7623076lji.7.1526766943524; Sat, 19 May 2018 14:55:43 -0700 (PDT) Received: from z50.localnet (apn-31-0-34-132.dynamic.gprs.plus.pl. [31.0.34.132]) by smtp.gmail.com with ESMTPSA id r81-v6sm1783176lja.36.2018.05.19.14.55.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 May 2018 14:55:42 -0700 (PDT) From: Janusz Krzysztofik To: Andy Shevchenko 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 Subject: Re: [PATCH 5/6] mtd: rawnand: ams-delta: use GPIO lookup table Date: Sat, 19 May 2018 23:55:51 +0200 Message-ID: <5456625.lDWjtgZygK@z50> In-Reply-To: References: <20180518210954.29044-1-jmkrzyszt@gmail.com> <3427199.r4OBoDP6Xz@z50> 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 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; } + 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