From patchwork Tue Dec 22 14:45: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: 58919 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3278790lbb; Tue, 22 Dec 2015 06:45:53 -0800 (PST) X-Received: by 10.98.80.144 with SMTP id g16mr35965034pfj.68.1450795553847; Tue, 22 Dec 2015 06:45:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si19043393pfj.114.2015.12.22.06.45.53; Tue, 22 Dec 2015 06:45:53 -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 S1754040AbbLVOpx (ORCPT + 4 others); Tue, 22 Dec 2015 09:45:53 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:35547 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753958AbbLVOpw (ORCPT ); Tue, 22 Dec 2015 09:45:52 -0500 Received: by mail-lb0-f178.google.com with SMTP id bc4so32305900lbc.2 for ; Tue, 22 Dec 2015 06:45:52 -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=ZnvVZPN6+PLtHOzJDRPnTX8BTt5+JZZUaGEtuiE5iRI=; b=IHQNKKxN6ttjDT1vH7fTtMnPsyvT3/NXpAV2ffLjWdtn00BIWOnfZ6fkMx11vFYGWq 9zgwsi0/9l9HmZknktea/uQGR5OrHOJ2oGS7ui70K1HcmC+SHLnnskABwu9HAWahmwpR ZJvHQgwVgdnnN3NY7sy/UVko+XzgkTYb6lEMc= 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=ZnvVZPN6+PLtHOzJDRPnTX8BTt5+JZZUaGEtuiE5iRI=; b=aLIuywEnm7cyVFJ6v3pqygBVfKhgzZjtA9/Uek+Pd8F2/GHAaNYaw0j7z0BV2vol4D ZneMq0cWT28F91Gl3D/y6YQP9p3wQ2ch5tHz+rBJ46nw6tXvWJYLb3AuMEx8In1cYBEO 2lwQDE6vRW/GuEn8OcacG5mLQsjlMYT9S5ABM/VtIyHhTY+HA4ELPjGWpTV2AGlLVIYE DM6Q0LaFxFp6JxkhukGTD0f8+eZmrBRGki81DsdYTepLgDLRh0CWEgEnJpLD+P15tv0G 6hSQ/+6ciSQ6TDK28gXsV3/StkRKl9JEuu37hTJiUmBBC8+9wYQs6iM6eJRNXBlNMb08 YQkQ== X-Gm-Message-State: ALoCoQksH0zBSAOj7XnwGcyLDawsGOKzJSDMj7cZyWrgeOpcNRV1EC8TwDoiKjjl+x+gXfbCaYf9GwIt3X3dvNpFYIiIZukMnA== X-Received: by 10.112.161.33 with SMTP id xp1mr8438926lbb.141.1450795551200; Tue, 22 Dec 2015 06:45:51 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o67sm5780002lfb.0.2015.12.22.06.45.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:45:50 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Guan Xuetao Cc: Linus Walleij , Lee Jones Subject: [PATCH 46/54] mfd: dm355evm_mps: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:45:47 +0100 Message-Id: <1450795547-28000-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: Lee Jones Signed-off-by: Linus Walleij --- Lee: as mentioned in 00/54: either apply this directly or ACK it and I will take it into the GPIO tree. --- drivers/mfd/dm355evm_msp.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/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c index bc90efe01b59..ec4438ed2faf 100644 --- a/drivers/mfd/dm355evm_msp.c +++ b/drivers/mfd/dm355evm_msp.c @@ -147,7 +147,7 @@ static int msp_gpio_get(struct gpio_chip *chip, unsigned offset) return status; if (reg == DM355EVM_MSP_LED) msp_led_cache = status; - return status & MSP_GPIO_MASK(offset); + return !!(status & MSP_GPIO_MASK(offset)); } static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value)