From patchwork Tue Dec 22 14:41:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58912 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3276373lbb; Tue, 22 Dec 2015 06:41:25 -0800 (PST) X-Received: by 10.66.193.73 with SMTP id hm9mr36138058pac.117.1450795285765; Tue, 22 Dec 2015 06:41:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qj4si4537557pac.33.2015.12.22.06.41.25; Tue, 22 Dec 2015 06:41: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 S1752786AbbLVOlZ (ORCPT + 4 others); Tue, 22 Dec 2015 09:41:25 -0500 Received: from mail-lb0-f181.google.com ([209.85.217.181]:34001 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751696AbbLVOlY (ORCPT ); Tue, 22 Dec 2015 09:41:24 -0500 Received: by mail-lb0-f181.google.com with SMTP id pv2so46235550lbb.1 for ; Tue, 22 Dec 2015 06:41: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=M+32zIeBIXpZubZrwlVDsxGr1hUkVrXDwtryZ3GHAeA=; b=VTZYK07CC1xODfSOHPJ9hQBJAjbgaJxR2DzMCG8FpueaK1i8ET2BEgAfl5QJwqXr36 nWzCgGw0A769OQK7Z9wLtGGPX8ZOeooW/I2OGQUa7HqpcS0Ii5Xol/zzPbYjEPd/72Fh FoPamzDa9MlL4RNVwpb2H1ZPIiGcQhYXL1B6c= 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=M+32zIeBIXpZubZrwlVDsxGr1hUkVrXDwtryZ3GHAeA=; b=DrsrvB+M5jNCMxwAOGPTJ2hdmvgHaWf07FokSRov6JXhwdAHyBK5kUim91GIWUi4aJ WQOt0R2oOjGr8aIo4E69KTPVIrinf2ScC1JVeWxO+Q/IIp4bOPTzgVdmrFtRuDSoMObr Nu0jH7R4EReMDljl1/YZdNpZAj1eGzrjhxpk0YBzYGYJfLlTLjtYbmG1atGSFjAOWxbS teOpTQuo/EnkaL6fgviTdT90y+RP+uwULX14wnp8s7+2yQosGS/5S9ivdjbvqh6u/ClP tBYPdlHagCNA1HtwRrmKShpi517iLleuIzPBUQI9F/CSawjJ/JfCwJDYzl0shEOhnizx I4yQ== X-Gm-Message-State: ALoCoQn6SlnU30jrkTUBzEwSCxapgkM8kBCjE+AKc9pFxHhqcRBmBIUOTOg5D/0dKEHKG9F+VMxMEDD6mq87dC/huV1Mcb53CQ== X-Received: by 10.112.126.42 with SMTP id mv10mr8632857lbb.98.1450795283416; Tue, 22 Dec 2015 06:41:23 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id xo4sm984943lbb.27.2015.12.22.06.41.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:41:22 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, linux-mips@linux-mips.org, Ralf Baechle Cc: Linus Walleij Subject: [PATCH 39/54] mips: rb532: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:41:19 +0100 Message-Id: <1450795279-27515-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: linux-mips@linux-mips.org Cc: Ralf Baechle Signed-off-by: Linus Walleij --- MIPS folks: as mentioned in 00/54: either apply this directly or ACK it and I will take it into the GPIO tree. --- arch/mips/rb532/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/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c index 650d5d39f34d..fd1108543a71 100644 --- a/arch/mips/rb532/gpio.c +++ b/arch/mips/rb532/gpio.c @@ -89,7 +89,7 @@ static int rb532_gpio_get(struct gpio_chip *chip, unsigned offset) struct rb532_gpio_chip *gpch; gpch = container_of(chip, struct rb532_gpio_chip, chip); - return rb532_get_bit(offset, gpch->regbase + GPIOD); + return !!rb532_get_bit(offset, gpch->regbase + GPIOD); } /*