From patchwork Tue Dec 22 14:28:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58897 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3269273lbb; Tue, 22 Dec 2015 06:28:54 -0800 (PST) X-Received: by 10.66.55.72 with SMTP id q8mr36028467pap.136.1450794534792; Tue, 22 Dec 2015 06:28:54 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ez9si4868056pab.20.2015.12.22.06.28.54; Tue, 22 Dec 2015 06:28:54 -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 S932799AbbLVO2y (ORCPT + 4 others); Tue, 22 Dec 2015 09:28:54 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:33623 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932797AbbLVO2x (ORCPT ); Tue, 22 Dec 2015 09:28:53 -0500 Received: by mail-lf0-f42.google.com with SMTP id p203so131714305lfa.0 for ; Tue, 22 Dec 2015 06:28:53 -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=2Ab3ns7SpbD9d4davK6rOZXUVlZiGnGFltBikusVKS4=; b=D14lMFh7ySLyEX/jcFYRHdRTKvTBRka5SQAkt7drygbDuLF92rXT8JMgqke/V7IOII WS7zFK7e4MPzde/RzUJ0DeqrpTp/sxipEARdhcRxz2Q+jSz2aBgbezZhSkvR3hfpQcrr DN3pHeAqq6vNZg7b027Qms6pqT6HDUByOf6dE= 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=2Ab3ns7SpbD9d4davK6rOZXUVlZiGnGFltBikusVKS4=; b=BwNIkIhjSmV91PluecxwPHbelLNPkvMrRJ9m5ZQh3gnYSN9pKled4JYcjMkmP5KZXK BpBTKTTpwgux6LukiYXRYC+nJb6ckACyPVNQ8JgBe2T7QSWUolz7buUEJHQifj9mkz7E /AD7vM7I/CY0fJSYQwDXwSUB04pWAfLFFgX0GyKc0/gpCgEzCt9Ev0FK86PuhCFEKKL+ 9v00I8P2rJnq5u6DVAEOSjbIpDjxl9rZWY/yzqMK+dYSHextbViCqW6ZNzKd/sguxZEC XEMbeVNyzG9TSePJYrtS/q2UoMBV7GHIK37zTgBriUUVTFmso/msBzLExOvD1A7OLLCf UmLw== X-Gm-Message-State: ALoCoQmohrdnQOg81zhaAxBcTZ7JcWR3iO3hBfh95AE4Fj3t/b3NJAKJDwaUdowMPlabAYFcI6cwPqWDPkXY5yeXGRWi8c2L5w== X-Received: by 10.25.41.18 with SMTP id p18mr9323264lfp.75.1450794532206; Tue, 22 Dec 2015 06:28:52 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j123sm5736694lfb.19.2015.12.22.06.28.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:28:51 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Mika Westerberg , Heikki Krogerus Cc: Linus Walleij Subject: [PATCH 24/54] pinctrl: baytrail: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:28:48 +0100 Message-Id: <1450794528-23650-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: Mika Westerberg Cc: Heikki Krogerus Signed-off-by: Linus Walleij --- drivers/pinctrl/intel/pinctrl-baytrail.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/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index bb92f8ae6b33..1fe9c1989353 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -281,7 +281,7 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned offset) val = readl(reg); raw_spin_unlock_irqrestore(&vg->lock, flags); - return val & BYT_LEVEL; + return !!(val & BYT_LEVEL); } static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value)