From patchwork Tue Dec 22 14:35:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58905 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3273342lbb; Tue, 22 Dec 2015 06:35:56 -0800 (PST) X-Received: by 10.98.16.22 with SMTP id y22mr35741601pfi.27.1450794956087; Tue, 22 Dec 2015 06:35:56 -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.35.55; Tue, 22 Dec 2015 06:35:56 -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 S1753852AbbLVOfz (ORCPT + 4 others); Tue, 22 Dec 2015 09:35:55 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:36209 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753683AbbLVOfy (ORCPT ); Tue, 22 Dec 2015 09:35:54 -0500 Received: by mail-lb0-f182.google.com with SMTP id oh2so32094856lbb.3 for ; Tue, 22 Dec 2015 06:35:54 -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=PJD87+eTrVDHb9s190mbMwVbmdqp36xuoy9eBLdwkaE=; b=NRE0oUA61YLNoInma2NsxsBygZr2CMgOAj5J/TdgTw5ettgnPUSc46cfEWNdnXg7Wr WmB9j6uzVWjxsfFJFsF9or2+zA3VSVCOGLOb4ndTmUv6boyULkwwXboKnAw9qkNSHuQ7 tK2gOQISrWsJJHK1o8Xp83nLpXBPFoJdOwcF8= 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=PJD87+eTrVDHb9s190mbMwVbmdqp36xuoy9eBLdwkaE=; b=YlWBRT72Y/TO9lifMLOXzJOzmZ0Lz0U1FVUU3HZoyisXaaFS4DYiga+vsxxQ2HfnSj 2QAqUHLsMa68VdJVL+mLj3vMRzmZrVSdoO6b4/yE4yTxMAkVrBvn/59nXDprSBnltbNr 5yjaX3RQF3aEF8sXKP1qK90eaTAjqf9r6QugrsvL7NMm1MN+pOqeRJdzsOlA7loo46ZV i4m/vR3XYC3qUsLU5JvHYw/UDxASMlFieJO3HAqKYknUixKe/e2twuB79Z26C8r6XDY7 Dh72Jw11/kLvUUWuaOmGEbNyFIElguHlXP9IdpxV56qJGnZFvnLEC/AfGYW7bkm7oYGs Pfgg== X-Gm-Message-State: ALoCoQl7T/2PDzewvBhygJxI5f6qf2KmxtyhwFiGRFxQ/A2Zp+sTr4UbjDktbtNI0w9rQbiSrSpz5UoGGa61tsOmIKpQlNr+CA== X-Received: by 10.112.199.105 with SMTP id jj9mr8194306lbc.131.1450794953198; Tue, 22 Dec 2015 06:35:53 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id ji3sm649976lbc.37.2015.12.22.06.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:35:52 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, arm@kernel.org Cc: Richard Purdie , Linus Walleij Subject: [PATCH 32/54] ARM: scoop: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:35:47 +0100 Message-Id: <1450794947-27040-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: arm@kernel.org Cc: Richard Purdie Signed-off-by: Linus Walleij --- ARM SoC folks: as mentioned in 00/54: either apply this directly or ACK it and I will take it into the GPIO tree. --- arch/arm/common/scoop.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/arm/common/scoop.c b/arch/arm/common/scoop.c index 45f4c21e393c..e0df333202b8 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c @@ -84,7 +84,7 @@ static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset) struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); /* XXX: I'm unsure, but it seems so */ - return ioread16(sdev->base + SCOOP_GPRR) & (1 << (offset + 1)); + return !!(ioread16(sdev->base + SCOOP_GPRR) & (1 << (offset + 1))); } static int scoop_gpio_direction_input(struct gpio_chip *chip,