Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2728916imm; Wed, 3 Oct 2018 08:18:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV61fFE+TagDw035e1nsUAlEcW2mftcBppSDgbDH1RHmetW8X4S7mtV5bed1LgnGWRA7LWCQD X-Received: by 2002:a62:4e09:: with SMTP id c9-v6mr2101295pfb.105.1538579910672; Wed, 03 Oct 2018 08:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538579910; cv=none; d=google.com; s=arc-20160816; b=gy2l/I0U6p7XO5UG1YiME1EWEEdRc6UkvvIYKiZeUOnThUq/qAw1hI4TP+bUkn37Pl 9vYGtYesuXs8CioTGe9Xtzmtv0tstlKRqN8lZ9s2uqOtcyHoaPvvmjpxhrv3BIf17V2R impd7e39wMOhg651DsGG2hnnX+PO8WfdxPfM9ELAK3+iLdPWBT3Mrn7wj9tunJ4E6sgv iJwGsu+9IL+TNITOLjo5h7vNaWKkmHloRnxv/E/S7EBgm7qZVkPfrMsPBpNQ9lTdUHCB za/o2fOTcvOrLpFgkzDwvlT5SzE7fn+3XwQMq1/5JpBt3gAYDtFVjX7TolGrB64LYa8y 5c4g== 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; bh=iD29vuCTIqibq+vkE42eflA2dtGEpii/hvCs32BGw88=; b=nuSrQYnXBQ3U/bvrxYMl9To89MnDRCrmhIvwMTomaKF6lpR8Y4VbnBxypwtcVXeVxr Z90WxdzvIL2CjD0wfK/yBkM9YA8qbVTQ67TUjWjF0BapsXh/0f2gCcd85CjvuGpDZDGq aG+OdkqThWAQfRXJ5sOSbg77K5gVnrceirV72kH5Z23WdRTkfVAmGvEk8brcZBO8t4gB YilZmFG65XAH6Hevx2bnQUb9cV5hXbDyQU/d7fkyvV/qiKaRKQ8Q02YMNOpMGGgJjOAw J7EuR+TKtx3SXgCt6mM9aqUcxgfwMEJ3Z1hs4oodocqsgZrWyulqTnLs/mvA9K78s8D1 lKCA== 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 8-v6si1812040pgx.37.2018.10.03.08.18.14; Wed, 03 Oct 2018 08:18:30 -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 S1727183AbeJCWGS (ORCPT + 99 others); Wed, 3 Oct 2018 18:06:18 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42510 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726797AbeJCWGS (ORCPT ); Wed, 3 Oct 2018 18:06:18 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 1BC2C207BB; Wed, 3 Oct 2018 17:17:27 +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, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-24-95.w90-88.abo.wanadoo.fr [90.88.144.95]) by mail.bootlin.com (Postfix) with ESMTPSA id CF1D2206A1; Wed, 3 Oct 2018 17:17:26 +0200 (CEST) Date: Wed, 3 Oct 2018 17:17:27 +0200 From: Boris Brezillon To: Ricardo Ribalda Delgado Cc: Zhouyang Jia , open list , Marek Vasut , linux-mtd@lists.infradead.org, Richard Weinberger , Brian Norris , David Woodhouse Subject: Re: [PATCH v4 6/8] mtd: maps: gpio-addr-flash: Convert to gpiod Message-ID: <20181003171727.145e7e41@bbrezillon> In-Reply-To: <20181003171114.51ab47b8@bbrezillon> References: <20181001124351.31615-1-ricardo.ribalda@gmail.com> <20181001124351.31615-6-ricardo.ribalda@gmail.com> <20181003171114.51ab47b8@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 Wed, 3 Oct 2018 17:11:14 +0200 Boris Brezillon wrote: > Hi Ricardo, > > On Mon, 1 Oct 2018 14:43:49 +0200 > Ricardo Ribalda Delgado wrote: > > > @@ -248,14 +252,19 @@ static int gpio_flash_probe(struct platform_device *pdev) > > > > i = 0; > > do { > > - if (devm_gpio_request(&pdev->dev, state->gpio_addrs[i], > > - DRIVER_NAME)) { > > + unsigned int *gpio_id = (unsigned int *)gpios->start; > > + > > + if (devm_gpio_request_one(&pdev->dev, gpio_id[i], GPIOD_OUT_LOW, > > + DRIVER_NAME)) { > > dev_err(&pdev->dev, "failed to request gpio %d\n", > > - state->gpio_addrs[i]); > > + gpio_id[i]); > > return -EBUSY; > > } > > - gpio_direction_output(state->gpio_addrs[i], 0); > > - } while (++i < state->gpio_count); > > + > > + state->gpios->desc[i] = gpio_to_desc(gpio_id[i]); > > + if (!state->gpios->desc[i]) > > + return -EINVAL; > > + } while (++i < state->gpios->ndescs); > > Actually, I was thinking about using devm_gpiod_get_array() here and > defining a gpio lookup table in the board file registering the device. > This way, adding support for DT based parsing is transparent. It's actually easier than I thought since no one is registering such a device, so all you have to do is call devm_gpiod_get_array() and have a struct gpio_descs pointer in struct async_state.