From patchwork Tue Dec 22 14:47:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58924 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3279980lbb; Tue, 22 Dec 2015 06:48:03 -0800 (PST) X-Received: by 10.66.219.194 with SMTP id pq2mr36250204pac.107.1450795681388; Tue, 22 Dec 2015 06:48:01 -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.48.01; Tue, 22 Dec 2015 06:48:01 -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 S932663AbbLVOsA (ORCPT + 4 others); Tue, 22 Dec 2015 09:48:00 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:35437 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932660AbbLVOsA (ORCPT ); Tue, 22 Dec 2015 09:48:00 -0500 Received: by mail-lb0-f179.google.com with SMTP id bc4so32337597lbc.2 for ; Tue, 22 Dec 2015 06:47:59 -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=JEKSDtxdxc7N7xhHkNgn1EZsLpK+porh6EMFv/JyeH0=; b=BzaOtGgPTp9tqbeNTjLlUoyM2J0dBVF6cCYeaCOhZUuadk+YjVgxp38atd634SThj8 TrAV5SKT85kZr0MPp07LAKN4LrmluhImijqKAyEKSwUY3pVnL9fl+7/7jeCbLvnkKFgX ++wHEPhB/EvyMMqizl1pcaC2pzUi8ri3yt1kI= 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=JEKSDtxdxc7N7xhHkNgn1EZsLpK+porh6EMFv/JyeH0=; b=Fg5JBUfMSf9LJuKa7aZFT7z0phNcBuDFmP4FCAza14Zu3pRXIMyavWh/R1Zv0JUFMQ TbE9PyoKjEdhs2yIElsXWKnOwvlW3C6NJLuNkBB5xTXzqfHcBQOX5+CIj9fZ696VlO2w LQOS1g97IQbY6B3aBn6lFzTdUsVJNLNCvzBjyjkX+T59qbkA3pqrDNGP6pAI1tj6DBnV vljYTUieH+LHQRq/EJ931O7MSov7aA2KvEcMyO0jjP4NykdeaXuDQqar5WM1b2g3uHWG gIFwjgUrzRpQuLljotI6+9rm4lN6CCabO3/OkN0jbv615si0mz2SMM4B9cyVncG0JMzg ffaA== X-Gm-Message-State: ALoCoQnZptijM/mRBNuys5QoTlB5LKYapGAItyiMM4MEsfGJmfxn6+lWP8VpkZYE1C0u8OCaknidS/M7aRPPCSYTgaF0TQoyyA== X-Received: by 10.112.54.193 with SMTP id l1mr8304874lbp.58.1450795678805; Tue, 22 Dec 2015 06:47:58 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id k64sm11327lfi.23.2015.12.22.06.47.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:47:58 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lee Jones Cc: Linus Walleij , Dmitry Baryshkov Subject: [PATCH 48/54] mfd: tc6393xb: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:47:55 +0100 Message-Id: <1450795675-28314-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: Dmitry Baryshkov 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/tc6393xb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 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/tc6393xb.c b/drivers/mfd/tc6393xb.c index 8c84a513016b..1ecbfa40d1b3 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c @@ -437,8 +437,8 @@ static int tc6393xb_gpio_get(struct gpio_chip *chip, struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); /* XXX: does dsr also represent inputs? */ - return tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) - & TC_GPIO_BIT(offset); + return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) + & TC_GPIO_BIT(offset)); } static void __tc6393xb_gpio_set(struct gpio_chip *chip,