From patchwork Tue Dec 22 14:29:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58899 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3269944lbb; Tue, 22 Dec 2015 06:30:06 -0800 (PST) X-Received: by 10.98.12.67 with SMTP id u64mr36121960pfi.31.1450794606664; Tue, 22 Dec 2015 06:30:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dc17si4497352pac.86.2015.12.22.06.30.06; Tue, 22 Dec 2015 06:30:06 -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 S932241AbbLVOaF (ORCPT + 4 others); Tue, 22 Dec 2015 09:30:05 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:35728 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932139AbbLVOaE (ORCPT ); Tue, 22 Dec 2015 09:30:04 -0500 Received: by mail-lb0-f172.google.com with SMTP id bc4so32066021lbc.2 for ; Tue, 22 Dec 2015 06:30:03 -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=rrXTOFlCdCiucdgobOWoJrW+qeeHXss9QF0wDrgaexs=; b=D7z20wJamUAXiz7OxolyQW5KXxJJZsjaWqlG0tmS77UsAaEG2swKlIAAK54qaINFKA IDsDI5wnj2MzBsJ3v6fBSq1/sq97sPBxzQZUQ6CNcPlZAeoHYLYvw75ZYiddau3b65PE QMqNviu/bigt1nNBNVww6XToLsQyBVVAC14l4= 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=rrXTOFlCdCiucdgobOWoJrW+qeeHXss9QF0wDrgaexs=; b=CYRSlVPYTbvGi+aIFqhNWg2nuj2g1IkKcycDp0y0jpYcEWWSFOHrQ3fvc1HXS1IV4+ Xpg/nde67PQ0zBP2GzpXJ2amzFmoU+WIIH/5sZUcYA8FFkDFL8EK/rODCehy1oE6u7Rv 0levDE6QtYezZimSXl293EJqd/imck0Qy2vuN+TyUiYk8j8ITB5tpQ6Gr8i4gfmPS9E3 gjZFapLvlJ8SDcNbrSh76LkBJYBfshmQdbThP8kPYHA9on6/3vbKrt8djHxZ6xYu0pdD hM9LfRW9sF1x9T0oE1s4g5veRUwkN9MHd5Ucy7cWQyI23NCsXwOl5ntZc9r9EtlIKtAb 3o6Q== X-Gm-Message-State: ALoCoQkuLee/5WO9jiuBvwbnimTGnWYTuoScjz5Zs8+/pPhC2+gGzTUVuMn7sbaHFiEUXv0rc12o+H5tpWUCUeP+QEefYHcoXQ== X-Received: by 10.112.13.5 with SMTP id d5mr8490851lbc.7.1450794602616; Tue, 22 Dec 2015 06:30:02 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id q8sm105503lbf.24.2015.12.22.06.30.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:30:01 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Pramod Gurav Cc: John Crispin , Linus Walleij Subject: [PATCH 26/54] pinctrl: xway: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:29:58 +0100 Message-Id: <1450794598-23771-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. Cc: Pramod Gurav Cc: John Crispin Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-xway.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-xway.c b/drivers/pinctrl/pinctrl-xway.c index e56222eac96c..ebd867f50700 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c @@ -660,7 +660,7 @@ static int xway_gpio_get(struct gpio_chip *chip, unsigned int pin) { struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent); - return gpio_getbit(info->membase[0], GPIO_IN(pin), PORT_PIN(pin)); + return !!gpio_getbit(info->membase[0], GPIO_IN(pin), PORT_PIN(pin)); } static int xway_gpio_dir_in(struct gpio_chip *chip, unsigned int pin)