Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp2381773pja; Thu, 26 Mar 2020 14:19:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtYfr3ydCxg5LLnvily3M8Q97ae8928qppwif2A0g2LCH8Y/d/NUEKCDgfdBRGrLL3kcTly X-Received: by 2002:aca:210c:: with SMTP id 12mr1735292oiz.0.1585257579302; Thu, 26 Mar 2020 14:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585257579; cv=none; d=google.com; s=arc-20160816; b=vPSNvxOv/mL+xo4ok1exZMhuooWvrqeHE1GUKI4BFLCyKKyuaiAfzFLHRa0grlsO54 PahWtfxpPbrYyFBKlpzHEdbrWUzpcMs45Fpy+XWqVxJc6zysXMMSzdSH9DfQFDt91J3Z lP3mC5pwk3fDBDvO+Da0ECzHitB37BlGw7QHtXJN+KZi0RL+ak/LXysRU931ElZkVt+x lFtFr9M0PT+oxk7DQV8S/D2k0yyTWIftZxogTLp1IUCSZtWQklSGKmZSp5L8bE5FbclP 2VTSuRz1aONe2ZqkXZn9E4/g2bvE63jlX904pi30TH6n97JQUzmQ+nuBXkfDm0TP97Hf EXgg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=BtDnHTuIZQJxreSGmLJQQ8ku1fLzEZvZgsl/IqNsN8A=; b=P8NlFqJFEYluo/9xOfncdy7fhyvhgj2gXlk+aalfuUOKOBdIQxaWvhnK+u0Fjq25Xs aqtFJcSvNIikkL8ZlG8i09N0eggPf0xrMxGZ8OpylDkpqRJE0bwE06WlMw+G0fuv2k1R HHviX3HgxlqFiqTEqwo+AosjtH9A5NJGnIhssk/m85N8UkBgQNwnjy7FLnM4r2cN16FI BqOiO1QPhfUsqZQgu8cBP1jbsuDHX2Th6lWbDJixXuF49pwtwmXznK51Y1qE0QQVO/hp EcphYLGe92h/GpCJGmRgBLGTarFVxzISAytCsGCUg/XUokOEFSmwX46I7jcnmgFbrdGD tLsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IXxu/b/Z"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si1390297ooh.53.2020.03.26.14.19.26; Thu, 26 Mar 2020 14:19:39 -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=@linaro.org header.s=google header.b="IXxu/b/Z"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727666AbgCZVSw (ORCPT + 99 others); Thu, 26 Mar 2020 17:18:52 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33110 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgCZVSw (ORCPT ); Thu, 26 Mar 2020 17:18:52 -0400 Received: by mail-lj1-f195.google.com with SMTP id f20so8073259ljm.0 for ; Thu, 26 Mar 2020 14:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BtDnHTuIZQJxreSGmLJQQ8ku1fLzEZvZgsl/IqNsN8A=; b=IXxu/b/ZFJBTcuTRbJKkO3+OaHo+Jz796SjBmFajhclIBm/BsLYWIAcx9DtKHieiLy tC1vll/WVvRZQ+7qJ8T1OabM2kIqVG9KEwn/gO1uzvwHIs/v6r5PUIM8K2kmGH3MMNXx nmCCfjAEtu37RGo2HNzvtF+VDyr/FKocXnWXD6OBMy57AI/ZJMu+S2hSLH5zbmyjmr7E sxTlRVJ5vW38t9Cg+zhSbse1W+BZkWRDzYx/Yu4yn+IZzHSViZT5elZgxloQRh/hC7i3 +w1dTkhKoFmmSYtRXjpmPsSyzvY/Q7+9WKp1e8RMSShyoiYZ9ziRyI4HZbJENIUJqUqy 2vwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BtDnHTuIZQJxreSGmLJQQ8ku1fLzEZvZgsl/IqNsN8A=; b=OAG1oJg5bnW0TrkMcO+vE3iLLsEWpirLb8l1vE3syuV5X43JGfxN5Ogt6bJ9hzECum VYiIy1KKinX2uTv2IQR17to9VZ33mECHoR2BRvTQo6NYDuVuvA64aEPiaS6+LQT3URma sIUvRf+IftbrEoPZmcczH/xe7UWkUaQ454jYnyeNkq/1/DNd1r3GUzq6l6uFpB1AgSnt cXCU9fNugh29zeq/rM3c6fQZ5eO1pJDQiaKRoKox6ks2rqay3BhK3Whk9fz999rGDwde sxFG4NO8rwiizI4sc4h4bfb+lrk9P2CcuuOxj3yQb+K7Erc6yleLuv0SS0l1skV1baf8 xS6Q== X-Gm-Message-State: AGi0PuaA/m2iPJxnvxd/Ad9j4oNsVUGTiknHNV5m6G7/A2hISzSSjl4y xpCAwnO2fWWM8O7vhdLrCAn8t5GRjOTY1LoyIyiJ2A== X-Received: by 2002:a2e:5048:: with SMTP id v8mr5946209ljd.99.1585257530291; Thu, 26 Mar 2020 14:18:50 -0700 (PDT) MIME-Version: 1.0 References: <20200324135328.5796-1-geert+renesas@glider.be> <20200324135653.6676-1-geert+renesas@glider.be> <20200324135653.6676-4-geert+renesas@glider.be> In-Reply-To: <20200324135653.6676-4-geert+renesas@glider.be> From: Linus Walleij Date: Thu, 26 Mar 2020 22:18:39 +0100 Message-ID: Subject: Re: [PATCH v6 4/8] gpiolib: Add support for GPIO lookup by line name To: Geert Uytterhoeven Cc: Bartosz Golaszewski , Jonathan Corbet , Harish Jenny K N , Eugeniu Rosca , Alexander Graf , Peter Maydell , Paolo Bonzini , Phil Reid , Marc Zyngier , Christoffer Dall , Magnus Damm , Rob Herring , Mark Rutland , "open list:GPIO SUBSYSTEM" , Linux Doc Mailing List , Linux-Renesas , "linux-kernel@vger.kernel.org" , QEMU Developers 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 Tue, Mar 24, 2020 at 2:57 PM Geert Uytterhoeven wrote: > Currently a GPIO lookup table can only refer to a specific GPIO by a > tuple, consisting of a GPIO controller label and a GPIO offset inside > the controller. > > However, a GPIO may also carry a line name, defined by DT or ACPI. > If present, the line name is the most use-centric way to refer to a > GPIO. Hence add support for looking up GPIOs by line name. > > Implement this by reusing the existing gpiod_lookup infrastructure. > Rename gpiod_lookup.chip_label to gpiod_lookup.key, to make it clear > that this field can have two meanings, and update the kerneldoc and > GPIO_LOOKUP*() macros. > > Signed-off-by: Geert Uytterhoeven > Reviewed-by: Ulrich Hecht > Reviewed-by: Eugeniu Rosca > Tested-by: Eugeniu Rosca I kind of like this approach, however there are things here that need to be considered: the line name is in no way globally unique, and I think there are already quite a few GPIO chips that have the same line names assigned for every instance of that chip. gpiochip_set_desc_names() only warns if there is a line with the same name on the same gpio_chip. I suppose we need to document that the line name look-up will be on a first-come-first-served basis: whatever line we find first with this name is what you will get a reference to, no matter what chip it is on, and it is possible albeit not recommended that some other chip has a line with the same name. Yours, Linus Walleij