From patchwork Tue Dec 22 14:47:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58922 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3279737lbb; Tue, 22 Dec 2015 06:47:38 -0800 (PST) X-Received: by 10.98.8.73 with SMTP id c70mr36072717pfd.41.1450795657905; Tue, 22 Dec 2015 06:47:37 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si12582333pfl.182.2015.12.22.06.47.37; Tue, 22 Dec 2015 06:47:37 -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 S932662AbbLVOrh (ORCPT + 4 others); Tue, 22 Dec 2015 09:47:37 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:33918 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932243AbbLVOrg (ORCPT ); Tue, 22 Dec 2015 09:47:36 -0500 Received: by mail-lf0-f54.google.com with SMTP id y184so130449573lfc.1 for ; Tue, 22 Dec 2015 06:47:35 -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=bQLd2Kk36Q0vtmdhq89lnmKowDsapyzQCDPXgK94+1s8OXX0IX1x/uMGPix7x8JEt+ ZhQMAYCkL+lwc6dgFmNHZtRbOxo5MmH+8OT6JLzmukMJCPo7/kd1mtiacdTa5SBIpib9 XWgdvmzPJ6oKPDPD2RN8GFzbjJXi88N+kERvM= 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=TKwg/zgci2qaAf4P24IYtYSw8m1Lc7kgnIHFkIS/danQJ7+t1cg4XqrppIdIB1+LEh wIa7ZQw5fBJZGDDW4riQ+MAQNTcMJu+/xWh2ola0tsHZIF5pfY6gWmhZbQcLAXY+LBYH BQdH96EDY/7SVQ57DfUYaS4QnJ8RcztV2DFM4J7D4BrP4IZDHqYdvo36mEda4l3KsE53 MCJGMjkc1Zmh89F5G+PqmojG/Xc1LsgTn86FHCOqlrXFlre65GpwgmyhJQPCnxNwRjvO qvuLpEZyWzGaBNqDTw6iKUD9BlLl9nd+ZKmWo8cu2aQSyLmJkidEQIn3kJZJhTBLU2NG t+5w== X-Gm-Message-State: ALoCoQl4clAjOQDIXODs4b2gijUXCFWR3MK21Y3VGqve8HuvWcgNABUupOn/MYB2Mn/xi+f0Hpr3nhZmgjzOnMnx0b0z5UXisA== X-Received: by 10.25.39.19 with SMTP id n19mr6762639lfn.156.1450795655201; Tue, 22 Dec 2015 06:47:35 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id qb3sm5663580lbb.39.2015.12.22.06.47.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:47:34 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lee Jones Cc: Linus Walleij Subject: [PATCH 46/54] mfd: dm355evm_mps: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:47:31 +0100 Message-Id: <1450795651-28215-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)