From patchwork Tue Dec 22 14:47:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58921 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3279609lbb; Tue, 22 Dec 2015 06:47:23 -0800 (PST) X-Received: by 10.66.232.170 with SMTP id tp10mr36335715pac.38.1450795643478; Tue, 22 Dec 2015 06:47:23 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si12413445pfi.212.2015.12.22.06.47.23; Tue, 22 Dec 2015 06:47:23 -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 S932659AbbLVOrV (ORCPT + 4 others); Tue, 22 Dec 2015 09:47:21 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:34802 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932243AbbLVOrT (ORCPT ); Tue, 22 Dec 2015 09:47:19 -0500 Received: by mail-lf0-f46.google.com with SMTP id y184so130444737lfc.1 for ; Tue, 22 Dec 2015 06:47:18 -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=enDGrfxgPx+FpvLyDYU4b/WgtLKaO5881CrkHmSpwm+Gk6CuB/fcVhrmCTAA++oKYL /Emxk8iEQ+30hzWV97zusHy8M+R31Jjnv4yBnac2KwmLpppvTt+iVQ2iFD+5yQwOto2f ajlNdYRNR6eD1szlXDc0rUzkZJ6AOCdnA59Fw= 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=RPkOO4C32sBpxy8Y3OVJwl+u81k8SNt2qnur+irhM8bLtwl2njcfzsiynj2kmPYd6L rycwhYxIk3VsqKPGkyApyl283kNyPQ8Vwskd4kbpdPlqRyhGdTKRSoISsDSAqwvxSLoy meA1oy+ReVqEuPEZVYQsvZ1ujf5kSLP5rGWhL89j7KcYJj4zbWN4COmJAM+4bSs3zja/ GRJSpsK606ZqTSsI5MWCHcOZ2t/yZKGVZhRVvcc381gVyqjECLKduybVxGc+zJyIjwj8 rdwTF8RFfKz7v8IXFMiW4+iRS2Ho66sRW3sC71Dpo9yELD9JIZ4n3zzJdvU2+lmU72bm UMWg== X-Gm-Message-State: ALoCoQlxYpKlr5pJygbEp5Ar2PnbaliVn4j1n/NW8hcoUVqB7N39dxUrLFGzQ0ysHIibM8BcJbO68Qt/GzjzlZvfUWgeTFhm4w== X-Received: by 10.25.16.104 with SMTP id f101mr5001339lfi.47.1450795637721; Tue, 22 Dec 2015 06:47:17 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j123sm5748289lfb.19.2015.12.22.06.47.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:47:16 -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:13 +0100 Message-Id: <1450795633-28167-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)