From patchwork Tue Dec 22 14:41:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58913 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3276584lbb; Tue, 22 Dec 2015 06:41:49 -0800 (PST) X-Received: by 10.66.160.168 with SMTP id xl8mr36612318pab.116.1450795309854; Tue, 22 Dec 2015 06:41:49 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qj4si4537557pac.33.2015.12.22.06.41.49; Tue, 22 Dec 2015 06:41:49 -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 S1752413AbbLVOlt (ORCPT + 4 others); Tue, 22 Dec 2015 09:41:49 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:35919 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751696AbbLVOls (ORCPT ); Tue, 22 Dec 2015 09:41:48 -0500 Received: by mail-lf0-f50.google.com with SMTP id z124so125704737lfa.3 for ; Tue, 22 Dec 2015 06:41:48 -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=9YCWhaEBz9Ggtr9lm9W5NgV4aciQfnNiNp6VM0b0xCE=; b=ccLC0/ZeUTUGzwlVx63yR0hIJx6lqpYo8o8xfEuOdCpUwiG+zQc2qry46WJj+moRsX b8vuXwVzQsr65Ns5/KXwe5jfhB4jDf7fsPnbLHdf2NDyQ/dlQu/av8DVKo6zqQOqrNWG eG4YDgDcPOTZ5C9aSrZlA2lX65jf97JftvCcE= 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=9YCWhaEBz9Ggtr9lm9W5NgV4aciQfnNiNp6VM0b0xCE=; b=QS2+dlVpVadvdTFB8pH+8C/1PJKw6G8EORzbyo0oBlYcOzN+jqCM2SSyfghMOZyvPU DGCLLJdE8Y5jkZM8pbVWTnW6H+ThfosMXLS8nvX1oH5VwYvO1IMS3rGvbJyq8zfTTgsI NSO9huaRRrBI8v/H8CaUkZjqwVN+3V3p38P46i8s6j8gIYiRsUlL3X6Fp+ncKOzXkUH+ r4cLeqJGvqLYw0qVcbS2dU6LYmwPa11L9v2fhXd3Gs0omlQsAbb28LKOOuvZJTDgHoDV BDIcgdUpXqom680bwkLWUst50Bn/ED1JneCmRWT0FXhjf+GS9m3gTbYP1oaHmhoUQWj3 Bf9g== X-Gm-Message-State: ALoCoQnxpX57D7SZ2A/eamdvIfeXc0QCfQ3+icfr+VldXi1iEjwGZ11ASMwKZRkVN89y2eUP8w85UlIUSNHgHbAyj4v2PJkZKQ== X-Received: by 10.25.154.146 with SMTP id c140mr7792792lfe.24.1450795307459; Tue, 22 Dec 2015 06:41:47 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h8sm5584728lbd.5.2015.12.22.06.41.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:41:46 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, linux-mips@linux-mips.org, Ralf Baechle Cc: Linus Walleij Subject: [PATCH 40/54] mips: txx9: iocled: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:41:44 +0100 Message-Id: <1450795304-27576-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: linux-mips@linux-mips.org Cc: Ralf Baechle Signed-off-by: Linus Walleij --- MIPS folks: as mentioned in 00/54: either apply this directly or ACK it and I will take it into the GPIO tree. --- arch/mips/txx9/generic/setup.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/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index 9d9962ab7d25..2fd350f31f4b 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c @@ -689,7 +689,7 @@ static int txx9_iocled_get(struct gpio_chip *chip, unsigned int offset) { struct txx9_iocled_data *data = container_of(chip, struct txx9_iocled_data, chip); - return data->cur_val & (1 << offset); + return !!(data->cur_val & (1 << offset)); } static void txx9_iocled_set(struct gpio_chip *chip, unsigned int offset,