From patchwork Thu Feb 25 20:08:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 62912 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp349945lbc; Thu, 25 Feb 2016 12:08:16 -0800 (PST) X-Received: by 10.66.251.194 with SMTP id zm2mr66510113pac.131.1456430896780; Thu, 25 Feb 2016 12:08:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p70si14397718pfj.241.2016.02.25.12.08.16; Thu, 25 Feb 2016 12:08:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933628AbcBYUIP (ORCPT + 4 others); Thu, 25 Feb 2016 15:08:15 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:36674 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933286AbcBYUIP (ORCPT ); Thu, 25 Feb 2016 15:08:15 -0500 Received: by mail-lf0-f49.google.com with SMTP id 78so40402724lfy.3 for ; Thu, 25 Feb 2016 12:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=4RYVFp8bskKwD4s80/ow5rYYCR3I4mNxK3dkptbSR/A=; b=e/97z3/URGz/K9ImP64Opq5ddb6dTXIDiV8HnIimUFIabGS+y/j27n9BWRHsBV4d+C AX5THfzarzkOp3qyaXfKFWYdE6DVi1UCzvNIraO04FNur//L3WeL2tacSBs39ooo2vR3 M0K0YtySl7D6bB0wln1ZiLWnqNMPj5vPXEbko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4RYVFp8bskKwD4s80/ow5rYYCR3I4mNxK3dkptbSR/A=; b=eOijruUykuAwFdCqWqUgzcQF/TCldvGpy6PLQ4nZLNDXjD/l+cf9/AS2eWSjeVSWlf +2Mi5WIiXBDOK6omRVfo6cRm+Gw7cCIntil8D7Ar8wy6K/oPbLj72q2kHm70i1i815wy lyVAMWGaO+5oCAiHMdWrubkOzIq3Oeti/1Om86Lv158L2uPwPHO+YuB6W3Qg47vpNS1l nRm737uHuHKNLq4crlv88zM0b/TmqQZg0va02QmLbmSQcap3j1jjW3JMRlZ5vnRjYIGj 1L5sRpXswnLCzA7BsTzFn+wSOvj4pMF3TqeG68mIZDtGJIHUjyN87skL5HDUAqJslklq mFOg== X-Gm-Message-State: AG10YOSo1fAHHfcQ/zrzY5SS5+9GhEzocJfyIDfVYJbG55r8m2MPOJG7mQjAFGakXHczcJbw X-Received: by 10.25.212.197 with SMTP id l188mr17469258lfg.118.1456430893375; Thu, 25 Feb 2016 12:08:13 -0800 (PST) Received: from localhost.localdomain.localdomain (c-3d95db54.01-192-6c756e10.cust.bredbandsbolaget.se. [84.219.149.61]) by smtp.gmail.com with ESMTPSA id bf5sm1302375lbc.49.2016.02.25.12.08.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2016 12:08:12 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij Subject: [PATCH] gpio: present the consumer of a line to userspace Date: Thu, 25 Feb 2016 21:08:10 +0100 Message-Id: <1456430890-7828-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org I named the field representing the current user of GPIO line as "label" but this is too vague and ambiguous. Before anyone gets confused, rename it to "consumer" and indicate clearly in the documentation that this is a string set by the user of the line. Also clean up leftovers in the documentation. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 8 ++++---- include/uapi/linux/gpio.h | 22 ++++++++++++---------- tools/gpio/lsgpio.c | 6 +++--- 3 files changed, 19 insertions(+), 17 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 872774a404f1..bc788b958c7e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -368,11 +368,11 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) lineinfo.name[0] = '\0'; } if (desc->label) { - strncpy(lineinfo.label, desc->label, - sizeof(lineinfo.label)); - lineinfo.label[sizeof(lineinfo.label)-1] = '\0'; + strncpy(lineinfo.consumer, desc->label, + sizeof(lineinfo.consumer)); + lineinfo.consumer[sizeof(lineinfo.consumer)-1] = '\0'; } else { - lineinfo.label[0] = '\0'; + lineinfo.consumer[0] = '\0'; } /* diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index 416ce47f2291..dfe8ade2742d 100644 --- a/include/uapi/linux/gpio.h +++ b/include/uapi/linux/gpio.h @@ -15,8 +15,9 @@ /** * struct gpiochip_info - Information about a certain GPIO chip - * @name: the name of this GPIO chip - * @label: a functional name for this GPIO chip + * @name: the Linux kernel name of this GPIO chip + * @label: a functional name for this GPIO chip, such as a product + * number, may be NULL * @lines: number of GPIO lines on this chip */ struct gpiochip_info { @@ -34,20 +35,21 @@ struct gpiochip_info { /** * struct gpioline_info - Information about a certain GPIO line - * @line_offset: the local offset on this GPIO device, fill in when - * requesting information from the kernel + * @line_offset: the local offset on this GPIO device, fill this in when + * requesting the line information from the kernel * @flags: various flags for this line - * @name: the name of this GPIO line - * @label: a functional name for this GPIO line - * @kernel: this GPIO is in use by the kernel - * @out: this GPIO is an output line (false means it is an input) - * @active_low: this GPIO is active low + * @name: the name of this GPIO line, such as the output pin of the line on the + * chip, a rail or a pin header name on a board, as specified by the gpio + * chip, may be NULL + * @consumer: a functional name for the consumer of this GPIO line as set by + * whatever is using it, will be NULL if there is no current user but may + * also be NULL if the consumer doesn't set this up */ struct gpioline_info { __u32 line_offset; __u32 flags; char name[32]; - char label[32]; + char consumer[32]; }; #define GPIO_GET_CHIPINFO_IOCTL _IOR('o', 0x01, struct gpiochip_info) diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index 6af118cc7efb..1124da375942 100644 --- a/tools/gpio/lsgpio.c +++ b/tools/gpio/lsgpio.c @@ -116,10 +116,10 @@ int list_device(const char *device_name) fprintf(stdout, " \"%s\"", linfo.name); else fprintf(stdout, " unnamed"); - if (linfo.label[0]) - fprintf(stdout, " \"%s\"", linfo.label); + if (linfo.consumer[0]) + fprintf(stdout, " \"%s\"", linfo.consumer); else - fprintf(stdout, " unlabeled"); + fprintf(stdout, " unused"); if (linfo.flags) { fprintf(stdout, " ["); print_flags(linfo.flags);