Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp231895imm; Mon, 4 Jun 2018 16:31:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLlVels1nEvvuGUKt1pvDRA1XF5t3NWRk1eWFujvLCpuFno7QAyUrM2nq9Aj3xT/cvSH+/E X-Received: by 2002:a17:902:bd4c:: with SMTP id b12-v6mr24371225plx.242.1528155086396; Mon, 04 Jun 2018 16:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528155086; cv=none; d=google.com; s=arc-20160816; b=mM/LkAUMxbBql6bY5xNkkHblYdHQS7s50VbA5PSgT1YG+yNDVMD/ucbJPGCjGQXCwO OIHYf9ptsDYl/AcpNacQLZfiyfT5hvO9oCBWzawjCDu/nCA02XnsAY0uy6NXx5Z14xDw xxIhJfbFz46r52tNNIGuL68m+K3ack4HIrIimwYCPccJKojFSOEU+bfLUJTqkiaGVhDf KM2X5a7zaJo439tJg9VNODsHRCrx4gHPmqoBAOnVaZDhYGCGsqgFS+85QWseiNpoe0Dl ZZBaqMsjVkkGgXLQwKxA65FNQ9/MkaBxl/NQ+/iVgRUBdiCCqK1STV0tMXorXFL6s9BB YT/A== 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=T26MCYQaFKa1OpFZ0Bu7yO8QiCWWY2wsCCpqGhlnry8=; b=Xn+UfXtPGeJvMoIY6HFvFbTZH56jPevhMs17S+dJxvEnxseLrQjTZLQeBdi78sQUsx azCIwQbrAtLJviZDUA1MRmEpQnBCdJF1J0IsZ4rCKLcu7tYLKgLwQBL5tk8hEHDj32sR Q+A5akMpHdAmhMe5RLY61JvvCW+EZKKFtvTKSYklPTBgRoT5ppcQ+nHzwMMyhlEuBPj1 M8MOOcApxDoS0QruQjqHhy5ZeCSk5hXJpNi6EXfSVNkn0SqQ+ZkA3Wxa3vBiyRYSZh9D WPrYu++lI2or0H4AXWNJQCbS+mfI9+PCK6d97NjcgDhZeDtueW49i8T+xbNQaxTM4kiO A6Rw== 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 u13-v6si11479564plm.99.2018.06.04.16.31.11; Mon, 04 Jun 2018 16:31:26 -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 S1752016AbeFDXaq (ORCPT + 99 others); Mon, 4 Jun 2018 19:30:46 -0400 Received: from mail.bootlin.com ([62.4.15.54]:33566 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbeFDXap (ORCPT ); Mon, 4 Jun 2018 19:30:45 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 61FBC204AD; Tue, 5 Jun 2018 01:30:43 +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 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 F3511203B0; Tue, 5 Jun 2018 01:30:32 +0200 (CEST) Date: Tue, 5 Jun 2018 01:30:32 +0200 From: Boris Brezillon To: Janusz Krzysztofik Cc: Richard Weinberger , H Hartley Sweeten , Tony Lindgren , linux-kernel@vger.kernel.org, Marek Vasut , Krzysztof Halasa , Shreeya Patel , Arvind Yadav , Brian Norris , David Woodhouse , linux-mtd@lists.infradead.org Subject: Re: [PATCH 5/6 v2] mtd: rawnand: ams-delta: use GPIO lookup table Message-ID: <20180605013032.1b0f4de4@bbrezillon> In-Reply-To: <20180605010932.5c97b1de@bbrezillon> References: <1582841.uoaVdad1fL@z50> <20180604115543.3be75717@bbrezillon> <1716431.jBl9UCSIdH@z50> <20180605010932.5c97b1de@bbrezillon> 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 On Tue, 5 Jun 2018 01:09:32 +0200 Boris Brezillon wrote: > On Mon, 04 Jun 2018 18:48:08 +0200 > Janusz Krzysztofik wrote: > > > On Monday, June 4, 2018 11:55:43 AM CEST Boris Brezillon wrote: > > > On Wed, 30 May 2018 22:39:03 +0200 > > > > > > Janusz Krzysztofik wrote: > > > > On Wednesday, May 30, 2018 7:52:20 PM CEST Boris Brezillon wrote: > > > > > On Wed, 30 May 2018 19:43:09 +0200 > > > > > > > > > > Janusz Krzysztofik wrote: > > > > > > On Wednesday, May 30, 2018 11:05:00 AM CEST Boris Brezillon wrote: > > > > > > > Hi Janusz, > > > > > > > > > > > > Hi Boris, > > > > > > > > > > > > > On Sat, 26 May 2018 00:20:45 +0200 > > > > > > > > > > > > > > Janusz Krzysztofik wrote: > > > > > > > > ... > > > > > > > > Changes since v1: > > > > > > > > - fix handling of devm_gpiod_get_optional() return values - thanks > > > > > > > > to > > > > > > > > > > > > > > > > Andy Shevchenko. > > > > > > > > > > > > > > Can you put the changelog after the "---" separator so that it does > > > > > > > not > > > > > > > appear in the final commit message? > > > > > > > > > > > > Yes, sure, sorry for that. > > > > > > > > > > > > > > +err_gpiod: > > > > > > > > + if (err == -ENODEV || err == -ENOENT) > > > > > > > > + err = -EPROBE_DEFER; > > > > > > > > > > > > > > Hm, isn't it better to make gpiod_find() return > > > > > > > ERR_PTR(-EPROBE_DEFER) > > > > > > > here [1]? At least, ENOENT should not be turned into EPROBE_DEFER, > > > > > > > because it's returned when there's no entry matching the requested > > > > > > > gpio > > > > > > > in the lookup table, and deferring the probe won't solve this > > > > > > > problem. > > > > > > > > > > > > ENOENT is also returned when no matching lookup table is found. That > > > > > > may > > > > > > happen if consumer dev_name stored in the table differs from dev_name > > > > > > assigned to the consumer by its bus, the platform bus in this case. > > > > > > For > > > > > > that reason I think the consumer dev_name should be initialized in the > > > > > > table after the device is registered, when its actual dev_name can be > > > > > > obtained. If that device registration happens after the driver is > > > > > > already > > > > > > registered, e.g., at late_initcall, the device is probed before its > > > > > > lookup table is ready. For that reason returning EPROBE_DEFER seems > > > > > > better to me even in the ENOENT case. > > > > > > > > > > Sorry, I don't get it. Aren't GPIO lookup tables supposed to be declared > > > > > in board files, especially if the GPIO is used by a platform device? > > > > > When would you have a lookup table registered later in the init/boot > > > > > process? > > > > > > > > When e.g. I'd like to register my GPIO consumer platform device at > > > > late_initcall for some reason, and I'm not sure what exact dev_name my > > > > consomer will be registered with by the platform bus. > > > > > > You should know the name before the device is registered. > > > > What if I use PLATFORM_DEVID_AUTO? Just had a quick look at board-ams-delta.c and you don't have a single device setting pdev->id to PLATFORM_DEVID_AUTO. It's either set to PLATFORM_DEVID_NONE (-1) or assigned a specific id, so the problem does not exist, really. Just set the name .dev_id to the appropriate value at declaration time and register the lookup tables before registering the pdevs.