From patchwork Mon Feb 22 12:47: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: 62561 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1212107lbl; Mon, 22 Feb 2016 04:47:17 -0800 (PST) X-Received: by 10.66.141.11 with SMTP id rk11mr38262086pab.75.1456145236993; Mon, 22 Feb 2016 04:47:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yo8si39625236pac.27.2016.02.22.04.47.16; Mon, 22 Feb 2016 04:47: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 S1754011AbcBVMrQ (ORCPT + 4 others); Mon, 22 Feb 2016 07:47:16 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:34710 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753955AbcBVMrP (ORCPT ); Mon, 22 Feb 2016 07:47:15 -0500 Received: by mail-lb0-f171.google.com with SMTP id of3so81128555lbc.1 for ; Mon, 22 Feb 2016 04:47: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=bpxaEOcs3gKISRsefLrDqqCCxzwRCmscwWNyrcq+DBI=; b=Dox14Sc9ab+XpCxq5AB/vlVfsrtzYv+o2/UO2fRM+7tTvkGuVMe8wnHamAHrJfi5nG 6e0x/qowpIJM2Lqokh7EGjFo10wIsVBh9E8rEphpoBd2tyRdymRcBLnC39LkfRQ6nLvs 8zrNXrl5qQhc47EuY/EhwyrkfVY+KslO8YZgo= 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=bpxaEOcs3gKISRsefLrDqqCCxzwRCmscwWNyrcq+DBI=; b=baiNYhZJK8mWwK7tOfzuxV/WXWwT5+l9HqXsRTaM4QWItyW1sJSiRy0IBVgCxTyqIh pUUzpAKgcjYR8XDF6Y/cktO7y0HOR3pqh+XdhJYyIY8RwCaeQe612HzCpjmMJyYVCRnd qemLurCCBJ3Xhh9ly51irKfYLaRj/9s1JuyqfNtRRzSqXgbVVcq6SBjNBWXP5DL9gy0o gzYOUkUBAZs1gDPmHhjLWJjixy6ReI4Vxb8UW3rCJ3xv+OcdyC0UnQql06jyqxfgXX8M bLGuWesNANfrzDlO4K2e6OLXpVNmp4eR5m2GeJWkpS4Fy5iCsc0fba/vzPOPZHUJ9i69 7HKg== X-Gm-Message-State: AG10YOSQmUxlAB/p9/bReUvuGDVoKG5ONfmTPcubXUv75c/M4LQwE0wLjrMbv61StSHos5QO X-Received: by 10.112.167.162 with SMTP id zp2mr10084954lbb.3.1456145234331; Mon, 22 Feb 2016 04:47:14 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id pm9sm3173375lbb.25.2016.02.22.04.47.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 04:47:13 -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: fixup line flags for userspace ABI Date: Mon, 22 Feb 2016 13:47:10 +0100 Message-Id: <1456145230-7702-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 This fixes the wrongly indicated lines in the userspace ABI: test for the right BITS, do not treat bit numbers as bitmasks. Reported-by: Markus Pargmann Signed-off-by: Linus Walleij --- Ooops I had already merged the patch it seems. OK I have to do a fixup instead. --- drivers/gpio/gpiolib.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 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 b81646982375..872774a404f1 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -380,17 +380,19 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) * this GPIO so it can't use it. */ lineinfo.flags = 0; - if (desc->flags & (FLAG_REQUESTED | FLAG_IS_HOGGED | - FLAG_USED_AS_IRQ | FLAG_EXPORT | - FLAG_SYSFS)) + if (test_bit(FLAG_REQUESTED, &desc->flags) || + test_bit(FLAG_IS_HOGGED, &desc->flags) || + test_bit(FLAG_USED_AS_IRQ, &desc->flags) || + test_bit(FLAG_EXPORT, &desc->flags) || + test_bit(FLAG_SYSFS, &desc->flags)) lineinfo.flags |= GPIOLINE_FLAG_KERNEL; - if (desc->flags & FLAG_IS_OUT) + if (test_bit(FLAG_IS_OUT, &desc->flags)) lineinfo.flags |= GPIOLINE_FLAG_IS_OUT; - if (desc->flags & FLAG_ACTIVE_LOW) + if (test_bit(FLAG_ACTIVE_LOW, &desc->flags)) lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW; - if (desc->flags & FLAG_OPEN_DRAIN) + if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) lineinfo.flags |= GPIOLINE_FLAG_OPEN_DRAIN; - if (desc->flags & FLAG_OPEN_SOURCE) + if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) lineinfo.flags |= GPIOLINE_FLAG_OPEN_SOURCE; if (copy_to_user(ip, &lineinfo, sizeof(lineinfo)))