From patchwork Tue Dec 22 14:39:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58908 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3275140lbb; Tue, 22 Dec 2015 06:39:13 -0800 (PST) X-Received: by 10.67.2.73 with SMTP id bm9mr36278425pad.94.1450795153171; Tue, 22 Dec 2015 06:39:13 -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.39.12; Tue, 22 Dec 2015 06:39:13 -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 S932378AbbLVOjM (ORCPT + 4 others); Tue, 22 Dec 2015 09:39:12 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:34075 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753977AbbLVOjM (ORCPT ); Tue, 22 Dec 2015 09:39:12 -0500 Received: by mail-lb0-f180.google.com with SMTP id pv2so46202546lbb.1 for ; Tue, 22 Dec 2015 06:39:11 -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=J+Zf1xjeVHQggWnAKdObDtBD99mzD2SiB7edcdwFLo8=; b=kuXXJ2etDvusrSDfzQ+18YCYqWiqduKwI48Fiyau4ruHquc23HmZIm2VCj0oZQ9q6X 37R8GdoHsk/d2b/MW9feWaJCHatJDMOchaJkjj0CAkHZDsDqZsmNw+xa5gzR5qQ/QNxC uNafKjDFAvCK/fjdt49TesexEkY27e9mEou88= 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=J+Zf1xjeVHQggWnAKdObDtBD99mzD2SiB7edcdwFLo8=; b=QIERdShsRAPFUBVmYvXOVU5XYNypje2HhLZXcB1iVETKzHQDPHIblCSLUF0t2/89j+ Gv8tBGNEEwfCRzlhmKDfZ2VfCqG+qaFe80/eQZJlYdx7rkllDdL0eIcV3ynIQIeZNI3G XYong+Hk5KblCjY9s6ieGDzPv7MK4kULO1X5bBXRF7R+HyrVZ49uWRU7VSmVDWkZLHOl R7EznPWi81/kOqIRrMl9wTCaoWgPpsEBfz4S9k3Fvfczj5hsD1JG8hCIhW0iiVHDXLSF 5LPLG4+4UB4953s2yKWRVk12VOVpPI7HkePxlxDaNZyYdjBNHwfBNRziT6lmYn7nCPRH 5ttA== X-Gm-Message-State: ALoCoQmwoY6hjdMwRz22MTZeMDz8kFpZ24IhIQB0P6ulgY6trglsLUw+bEAdA7CEdkqKMkX79Oiz6ohKTfK8XE0itiNXKzTeIQ== X-Received: by 10.112.133.42 with SMTP id oz10mr8334133lbb.92.1450795150251; Tue, 22 Dec 2015 06:39:10 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l81sm5863646lfb.40.2015.12.22.06.39.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:39:09 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Geert Uytterhoeven , Greg Ungerer Cc: Linus Walleij Subject: [PATCH 35/54] m68k: coldfire/gpio: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:39:05 +0100 Message-Id: <1450795145-27292-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: Geert Uytterhoeven Cc: Greg Ungerer Signed-off-by: Linus Walleij --- M68K folks: as mentioned in 00/54: either apply this directly or ACK it and I will take it into the GPIO tree. --- arch/m68k/coldfire/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/m68k/coldfire/gpio.c b/arch/m68k/coldfire/gpio.c index e7e428681ec5..37a83e27c7a6 100644 --- a/arch/m68k/coldfire/gpio.c +++ b/arch/m68k/coldfire/gpio.c @@ -121,7 +121,7 @@ static int mcfgpio_direction_input(struct gpio_chip *chip, unsigned offset) static int mcfgpio_get_value(struct gpio_chip *chip, unsigned offset) { - return __mcfgpio_get_value(offset); + return !!__mcfgpio_get_value(offset); } static int mcfgpio_direction_output(struct gpio_chip *chip, unsigned offset,