From patchwork Thu Feb 25 20:08:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 62913 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp350044lbc; Thu, 25 Feb 2016 12:08:30 -0800 (PST) X-Received: by 10.98.75.79 with SMTP id y76mr56908684pfa.147.1456430910679; Thu, 25 Feb 2016 12:08:30 -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.30; Thu, 25 Feb 2016 12:08:30 -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 S933662AbcBYUIa (ORCPT + 4 others); Thu, 25 Feb 2016 15:08:30 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:34444 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933286AbcBYUI3 (ORCPT ); Thu, 25 Feb 2016 15:08:29 -0500 Received: by mail-lf0-f43.google.com with SMTP id j78so40423176lfb.1 for ; Thu, 25 Feb 2016 12:08:28 -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=hnver3MihIqyitERVSTx7pfbGoyQQQ2diGIQeSzRUZLUfrI6NsT3kdrKpqZ4pNDN38 Ty6F9jHBazOBTJ2cqHG8jSJFXGKsLsaWp+s3ETB+iy61XmP6UucwQua7NvV/ATaB6Awu Dq1F/9ycDf3uyKGpudzMta2FKLiPMxiyOMkdQ= 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=HSBF9gaGs1lFBiHda1po/cD4avL6gdfT0M8svH3/Z7jlnFGf3h1vflVIDvkM03wFhF 0lFV6LOvf/s4Kro7Df4CpcVXWJ8YNAou1VwXdMAFwdUtnpnK5PODjbQLeOw6RmkA+D8q 4WIHdeTtV8synibSNDJ4N1sq2Rm86VDRVEJLrLnOzNuZmuy5p+02bv4T2Y/2d9GspKks PjfpJIThM58CtpLnmBqS634TvliuF4ikmmflUQzC2/4AY++3xpVJTo5anz8httDYhrjj QpVC8dgb5Cf/miueFf2YOZM+JWSF1ABHTNkkck6bwiz3SHJeDbJKEaazdhb9nt7tGlDk tp6w== X-Gm-Message-State: AG10YOTAcDsKg5ZAUmnni9kHVIkEQTGE3GAVJKy1JaDgLx3/IfQvTK8p2whSFwWsnM6OGtLg X-Received: by 10.25.5.7 with SMTP id 7mr17572882lff.143.1456430907725; Thu, 25 Feb 2016 12:08:27 -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 s75sm1359585lfs.21.2016.02.25.12.08.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2016 12:08:26 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot , Johan Hovold , Michael Welling , Markus Pargmann Cc: Bamvor Jian Zhang , Grant Likely , Linus Walleij Subject: [PATCH] gpio: present the consumer of a line to userspace Date: Thu, 25 Feb 2016 21:08:23 +0100 Message-Id: <1456430903-7891-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);