Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2721134imm; Wed, 3 Oct 2018 08:12:16 -0700 (PDT) X-Google-Smtp-Source: ACcGV62X7gf5DyS93xE3I6YmWROeOBsAwxh36kUyNLy+b6uaGhp/JAeAmS1G1rbuDanCsxw6r9b/ X-Received: by 2002:a17:902:108a:: with SMTP id c10-v6mr2047363pla.272.1538579536906; Wed, 03 Oct 2018 08:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538579536; cv=none; d=google.com; s=arc-20160816; b=QdQM8svLnE0NBmy1IYHKu6zrQEQPxt0ZNbmsopz+E9IH9QAMnKyFopZfXHI2XYHZO0 VPuKY5iB5TSGMooJaQbgkoVAJ52TAwlF2fufPLnIzWubCrOJOdo0dkib2ZHPEXmtXmr7 e+Y8uIwTBvOEBfJW5BYUEgEnR+NZjA7qDMjvxoQosXWfhqaZ5Z+lgZsgHyC+WGGLF7+G vhKnFkWhhs+oQydlXgM7XsULE6GfDho2uvUcZjRivDlLh+JbEiNbynuflTmi+X87LAnX Esazlv1F1nvCcL2VhmxVs/7R3ZRT+28UyYHDkIyVQgqTPnINs3tflqWU/FGmQ2kTu5ti eIJQ== 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=P+vacSPDAhk0erduy/hj5Q80OYT8LV1J9XsBxk/4ZzI=; b=D9KjBbslPpxUAm83Xt++ItOPXkNyoUTVerPgTcjNwB7De/Se13EHYM97vp0sBg7I0B H3he+6IcsfKm7wwb6uVFz2jVuvYQTGOBVlTQ/LC0GAIT39UcrZkxZJKld3pNMp5tzmuN RmgqrLl4D/qnQVqWrZbx79/nRBI9yRceVzcTGDUbKo7NvShbPbCr/0NE1XcOROjU5zsY nJtrfMnqXImVVMCUDNWGrshpmtVd2NfimEcfGy5l8JY9Ki20yywgRUxDPogbbQCxm2eo crC1sL4h1UeJbLI2vbRdmfJC05aCBYeRP3LAZVaaXaP0uqNRfm0KOQ8Z6Yd5UwyjFuk0 NwAQ== 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 t19-v6si2034201pfm.152.2018.10.03.08.12.01; Wed, 03 Oct 2018 08:12:16 -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 S1727273AbeJCWAD (ORCPT + 99 others); Wed, 3 Oct 2018 18:00:03 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42176 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbeJCWAD (ORCPT ); Wed, 3 Oct 2018 18:00:03 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id EF2EC207BB; Wed, 3 Oct 2018 17:11:13 +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 (AAubervilliers-681-1-24-95.w90-88.abo.wanadoo.fr [90.88.144.95]) by mail.bootlin.com (Postfix) with ESMTPSA id B16B6206A1; Wed, 3 Oct 2018 17:11:13 +0200 (CEST) Date: Wed, 3 Oct 2018 17:11:14 +0200 From: Boris Brezillon To: Ricardo Ribalda Delgado Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Zhouyang Jia , linux-mtd@lists.infradead.org, open list Subject: Re: [PATCH v4 6/8] mtd: maps: gpio-addr-flash: Convert to gpiod Message-ID: <20181003171114.51ab47b8@bbrezillon> In-Reply-To: <20181001124351.31615-6-ricardo.ribalda@gmail.com> References: <20181001124351.31615-1-ricardo.ribalda@gmail.com> <20181001124351.31615-6-ricardo.ribalda@gmail.com> 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 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. Regards, Boris