Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1747875ybk; Mon, 11 May 2020 03:21:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGyd8stDqo8J6yNV0M6x4+GI6Hzk3TjKFOr6ZRwxecqs+XbbyNJCfJNJ9xRBskw6vpvd9I X-Received: by 2002:a17:906:f103:: with SMTP id gv3mr1614542ejb.226.1589192471434; Mon, 11 May 2020 03:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589192471; cv=none; d=google.com; s=arc-20160816; b=pSkPiilhn1OtXOBoQElXpeenIl2ZZ+OLVtR6exmJW/OW3CPdpOYhMMto2UpReaiv0j /ZToE/Do7HubwDjioLVekaDpKKyazT1rtS7XMsBHpUIomB01ZkTto/3olj9826kOaOJC WwJEh8VdkKzqJQpVg17VDZpnjJj5OTSmGck9XPuRggQTH6L/tcsl8NXJ7BQtjsgbFFHN K6/ZzvoDiiIl/J6HycRstDZxcIwEeBuCR+75E2+r4hdpaGrW0zXIPoewBRYs/UwgZaaw 8W6WqkZTs8R1/7ci5lfwS9G4wYXvBSDV4f+2LJgU9RG7km6l0LgjIskw2DqeXOj6xnGd IajQ== 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; bh=dhHEh+pNrtrDrMKnU82n0ghqaec/6dzj+ojpD1sC6tU=; b=vES63vQlvimnok/h8gevSAA8LonvWIDrVgjdxplkwVNvgPWLAVGsrhb3oTGrLfAJQI vDCjC/Sm4wzdShX/cOJCdER3gpJMvXWsZOcxZo2X5d29MzpDGFm6cOCGEnky1AsNP2Wy iGCCjW8CcgRYTa5+1Rcb61NdmQTyzITchNT1O1qHPaCrVY+pU+/gTc9c2Aki1R/RCBCH Tu/p8RJvudcc3DaIh/B7qS8uzcU/F1P86oPAg5y6ryvBKpozTSB5MOg9X6jPgF44YyM+ fGmmxC+wWLRdWcTGWzVF7p+cwNttQ3Pu8yihJH0R9llmItWU5lTMYKJUpE9Pn25bXWpH L89A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si4152342ejs.38.2020.05.11.03.20.48; Mon, 11 May 2020 03:21:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729392AbgEKKSk (ORCPT + 99 others); Mon, 11 May 2020 06:18:40 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:41077 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729294AbgEKKSf (ORCPT ); Mon, 11 May 2020 06:18:35 -0400 Received: by mail-oi1-f193.google.com with SMTP id 19so14615110oiy.8; Mon, 11 May 2020 03:18:34 -0700 (PDT) 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=dhHEh+pNrtrDrMKnU82n0ghqaec/6dzj+ojpD1sC6tU=; b=un/cVaLel2W3SxT+qj0wyFwQaFU2JAXahi2YRif47BWsQx0bZ5ArA8gTAbv7/oBil2 v1UfMY/4kmadVoy6sxrt6aP8Ke0rrALV+44qXqdf0Zki8kNsNcT2+lxmX3YWRPXmcuQR BbjOpXkghxF5BGXgJ8eYTyh3OkF6gXD58PeFaqfeaG0s3WQ25+ZRK1q8jPuiSNggzEB3 LGVzFHxNSSX1yaVsnphUiwGP7+c7hjJlko6A1P0teryGZs7Gj0+CyMfn11yGb51O5c9F IkOnlSM7nJpbnoAleIaC7/fFre+NnZzsZlrNHcB7rn1IgmYqS5dUNYWcz7U/V/t8iDiE V30g== X-Gm-Message-State: AGi0PuZzEGSVXZswo2XR8GgvRyEetPbFC2O2M2PcNWkZ+0W/6piuD4GL ZvqDgs5aczx+AUvKeWIiu1N3sxOs+xDWArX15LY= X-Received: by 2002:aca:f541:: with SMTP id t62mr18420359oih.148.1589192313970; Mon, 11 May 2020 03:18:33 -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: From: Geert Uytterhoeven Date: Mon, 11 May 2020 12:18:22 +0200 Message-ID: Subject: Re: [PATCH v6 4/8] gpiolib: Add support for GPIO lookup by line name To: Linus Walleij 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 Hi Linus, On Thu, Mar 26, 2020 at 10:18 PM Linus Walleij wrote: > 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. on a _different_ 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. Agreed. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds