From patchwork Tue Dec 22 14:38:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58907 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3274617lbb; Tue, 22 Dec 2015 06:38:14 -0800 (PST) X-Received: by 10.98.15.199 with SMTP id 68mr36361466pfp.60.1450795094134; Tue, 22 Dec 2015 06:38:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si11984531pfa.78.2015.12.22.06.38.13; Tue, 22 Dec 2015 06:38:14 -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 S932368AbbLVOiN (ORCPT + 4 others); Tue, 22 Dec 2015 09:38:13 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:36244 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753770AbbLVOiN (ORCPT ); Tue, 22 Dec 2015 09:38:13 -0500 Received: by mail-lb0-f171.google.com with SMTP id oh2so32130514lbb.3 for ; Tue, 22 Dec 2015 06:38:12 -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=AydoBdA4nlLIjw/Vk41HqxQ/Tkqr1PDrjgTjRvovyFo=; b=QG+8HwIrxBSdu9foON7o3PxhHIKaldzqufDzXOrigaUA3rCcxEb2pYbQQttTFH+x0n 3QlmIhDppN4X0i52xMfNQsiBLApeyc3aTPRiubL6P9pExWZdIRp8kY0U/JPX2W9ZJSpJ 4LAV0G3k3fdQ4pieqDpXoFnvtEsq03E06aAqE= 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=AydoBdA4nlLIjw/Vk41HqxQ/Tkqr1PDrjgTjRvovyFo=; b=Pqwaf6NHlUl2t0DEGbIooBtC7+gmEzW4WL6g4/gv44Yy0wbIMOuQlP8uemC0WPWU52 z4Kb7jsdqnNGtNfNnCHPS0No33trr6sNXzKY5gCyYhE276/ep2OtEoKiy/6oKjNfpMZy 32HY9+xsciUDwKf02e1wYJIAJocA1IGr8U+ctPyXFxWivzvEr2fU3UVjG6BQ9KAK9FwQ COPA3TvStmkE3y4r7KPae6zwuriq7YnwepssCERNpLF2BKP2cyC5rhlVjV7Xdy5pBS/j +qqgxahiVfXByKaLhrMTkkkN6lVGNDs0Em9wYvFS2cSgaa6SsN9SYywgNEuuSCnKxCfk PjsA== X-Gm-Message-State: ALoCoQn8xTc9ZA7CxmmpbcWAMDjVwhWle3oiscDjIpE8uaL2s13uWpWYBlJZTncW+TCszwzn7VeE0puX+1t+hjnxv7bWql30mw== X-Received: by 10.112.151.102 with SMTP id up6mr8592542lbb.44.1450795091366; Tue, 22 Dec 2015 06:38:11 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l128sm5671719lfd.10.2015.12.22.06.38.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:38:10 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Sonic Zhang , Steven Miao Cc: adi-buildroot-devel@lists.sourceforge.net, Linus Walleij Subject: [PATCH 34/54] blackfin: gpio: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:38:06 +0100 Message-Id: <1450795086-27238-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: Sonic Zhang Cc: Steven Miao Cc: adi-buildroot-devel@lists.sourceforge.net Signed-off-by: Linus Walleij --- Blackfin folks: as mentioned in 00/54: either apply this directly or ACK it and I will take it into the GPIO tree. --- arch/blackfin/kernel/bfin_gpio.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/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index a017359c1826..84baa6217c03 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c @@ -1159,7 +1159,7 @@ static int bfin_gpiolib_direction_output(struct gpio_chip *chip, unsigned gpio, static int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio) { - return bfin_gpio_get_value(gpio); + return !!bfin_gpio_get_value(gpio); } static void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value)