From patchwork Tue Dec 22 14:29:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58898 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3269553lbb; Tue, 22 Dec 2015 06:29:26 -0800 (PST) X-Received: by 10.66.102.97 with SMTP id fn1mr36406375pab.131.1450794565916; Tue, 22 Dec 2015 06:29:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ez9si4868056pab.20.2015.12.22.06.29.25; Tue, 22 Dec 2015 06:29:25 -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 S932294AbbLVO3Z (ORCPT + 4 others); Tue, 22 Dec 2015 09:29:25 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:33910 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932466AbbLVO3Y (ORCPT ); Tue, 22 Dec 2015 09:29:24 -0500 Received: by mail-lf0-f44.google.com with SMTP id y184so130131967lfc.1 for ; Tue, 22 Dec 2015 06:29:24 -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=hmWf52EPgFeuNPZmprC9YqXzv+HZOAx5EwlIlrkInnQ=; b=fo8XHN1/uKr6PfwJKtKYLOOt6QTnF/QQ/x5uZ1+j6LhW6NNuy3E7Eizirf4KBtMWDS z2Sh5qf4i7XzdR8swvyYucchgPXlPsYl1d+ZM+W2e0h5RMN1jtfLgkO7k/JpmUby/XJ5 jJDs7STWPXA7tW+fks+pave4lbRwXmmtrT9bs= 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=hmWf52EPgFeuNPZmprC9YqXzv+HZOAx5EwlIlrkInnQ=; b=kUVx6ON8AH2JJFbU0Z1dZ+qM5sQ+YjyonPXtKX6DUp/JG9eyrKeU9mrewPOHwSKRrX mS7QwfCcvl7wxHfQiTTyOUcs/Fw9Kve5GCwFvT66y1SZJY29CoVUDBMaMGTB+jrTNxSY Nn2RVSm3zyJpTGoz9n4wgpZlI0RAj7YQ2zI84X1WWFG13MMAIn7WHAY7u0WPysV3pNq3 hrm2iutCOCkFOONmmhvhxpavRI+qIUYtLWwcjBcO6tRFqELVUWVRK7RAF+/Xn5c1qLWP wQvCXJ0cWbgbivwY65BA4yQ1H9z0UQoPwAgo3b3uCmWh7sZJlSJ5zvOArooWo0ilgaqq Y+qg== X-Gm-Message-State: ALoCoQkJUt1npL3QxSGqrO+I7QmY8Wa8cjl0O5wpMOBEOyhdW1MLuKSxNjBUplNQQCrreJiKup2l3JdEzuDd25hgJXSuk7ButQ== X-Received: by 10.25.212.209 with SMTP id l200mr8680378lfg.41.1450794563325; Tue, 22 Dec 2015 06:29:23 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e9sm5734687lbs.13.2015.12.22.06.29.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:29:22 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 25/54] pinctrl: coh901: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:29:20 +0100 Message-Id: <1450794560-23709-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 As we want gpio_chip .get() calls to be able to return negative error codes and propagate to drivers, we need to go over all drivers and make sure their return values are clamped to [0,1]. We do this by using the ret = !!(val) design pattern. Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-coh901.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index e1cbf56df4b2..ca0fa79a286c 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c @@ -221,7 +221,7 @@ static int u300_gpio_get(struct gpio_chip *chip, unsigned offset) { struct u300_gpio *gpio = to_u300_gpio(chip); - return readl(U300_PIN_REG(offset, dir)) & U300_PIN_BIT(offset); + return !!(readl(U300_PIN_REG(offset, dir)) & U300_PIN_BIT(offset)); } static void u300_gpio_set(struct gpio_chip *chip, unsigned offset, int value)