Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2163333ima; Mon, 22 Oct 2018 05:30:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV62h6FgsvLtN6F9P8dNKBuyFIOOs5kX8tPwQxffMeKj38CeaptYIoDhH8vwltac0cnZx/V3z X-Received: by 2002:a62:4ec9:: with SMTP id c192-v6mr45243994pfb.221.1540211431734; Mon, 22 Oct 2018 05:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540211431; cv=none; d=google.com; s=arc-20160816; b=tQ8fC+/omSdpFrKHjfcKRHqssdYzZpxjMg/WDdApTjK8NL5E9wvnMNEMyYIoEn4s9B 5Hlgs35T4gV3ZG61Q+45PA+ELsfJd4jbhieJ2v06r0g7GPxXhkIYfmALhj5FmydiK+cx 9ur85EKwqeiG9ZixCa1lUhZIRJmMt0y+9hWM8CFNtqT4fXYnU5e0iOjrWFLozbNmQQmP Iu9sHbISWTJWLfhnkFEKMzo7zd3XGkP6ZVIQK1gcUJdt2fNSii5UEVTPUC4L58VZdn4z kHtWnKGzpvrZmuhqf0VHBdsMdr7Cv4AdK/7PB7xqg7IrYA7SMPla3sBwBdQL7wk8yDrL a+DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3RCSYodw650g5KDTGikhMzg5U2Hs5MAyqNWdf8/qnF8=; b=I63Tps8pwvkcQZonuN9aJn4d4tjl/X8QShAW710prn7bGh8qdKwD5ki5rSlU7jebEy Klhfi/yn4c6DAae22kfdJ+HD5Lb9DQXF8cu13+AbNe47uJyS4hgMeztuE/+II6lme2dF Jtop3PCRc0KGnmtmh0MQqHHysGAF2XIXaHfwCUh4q+DGMC5vwUTRkwJ92VDRmttkVKXK xkNXiH8m/cIk5vUhx4MGU4bD5fWY2B4WCwEzvYCK03VcayWl7JaI9SKAaUfdewGqvbTX NqW3yemA7Jv3DBiM2IiAest+pGKjq1WxyhVaCGAxzXitxTYOGMxC4TpRPjkR1XTNjvcS SLng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dTdgY5jv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si34316325pgj.276.2018.10.22.05.30.15; Mon, 22 Oct 2018 05:30:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dTdgY5jv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728963AbeJVU15 (ORCPT + 99 others); Mon, 22 Oct 2018 16:27:57 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33722 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727194AbeJVU15 (ORCPT ); Mon, 22 Oct 2018 16:27:57 -0400 Received: by mail-pl1-f193.google.com with SMTP id x6-v6so2148408pln.0; Mon, 22 Oct 2018 05:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3RCSYodw650g5KDTGikhMzg5U2Hs5MAyqNWdf8/qnF8=; b=dTdgY5jvOP4W53MqbwotkYeOV1yzDsQ/iRXqTrM0tBY+JjTWF4KTyHTu8g/mSG5Klp 7lAK7jH3pwouFKIny7wd0s+6xOO4xvpIYQRrWq9KOrD+eDLKzhc3m71hXJ0s01eGCu8G KSQdgMfR8smij1bc198Kwc+qwBrB4KeWZCzEBshaAMXNEJ6algvl5IwxqfoiXa0io3Fe 7HCM3eObIG0L6DbiJ+lff0F/jHhgObMNtTSvEcZoYE30mc/n+B/sT3rNzIeZYSX9RV0k 3zK37aU+t520rwS3OiaoeriqBbqkxp9mIrr2bO/xNBbJil04WZEUlpyd8OHxL/4MNx6u Gstw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3RCSYodw650g5KDTGikhMzg5U2Hs5MAyqNWdf8/qnF8=; b=NLkBStS3zgyYE864rq9tiJrKWe7yeLcirg0BM73RjrwsHcW7Nyxm6h8xn4LfWNrxMM SLtuZm6TvMpYFDhv16a+D2xB+5nMPFkMJnYatpi06JWpmJAArSKqGZ6jtDNBIZSFNldr wxw9hrsE2N/BFF4HroV3TB6P6onZZxkw/Fp7UYAvDfisFhpBtw0MqmRnEkaom0owz5Lz bDhk6hxcHOFcM8EXowpgTa77Y9Bbarf9xGyW4OZf41b37VlVwQWXDeoLuvl+IBN46ITA DWfotJgBQo3f4g2qOGSdCqWe0YG4KyoaULuZSqvOWLLOcmedhIiDnC2jEzUp826KleWD o+KA== X-Gm-Message-State: ABuFfogZIPMM9fWDkfGFlu94gJXlckWjSXYl4t81UfD3wIy9O3GPA3o6 chseo2W8i5yRUxAaWH4+7Dc= X-Received: by 2002:a17:902:4e25:: with SMTP id f34-v6mr36420968ple.43.1540210179227; Mon, 22 Oct 2018 05:09:39 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c0a5:1904:c698:f9ce:cdd:454c]) by smtp.gmail.com with ESMTPSA id u69-v6sm61250728pfk.68.2018.10.22.05.09.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 05:09:38 -0700 (PDT) From: William Breathitt Gray To: linus.walleij@linaro.org Cc: linux@rasmusvillemoes.dk, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, William Breathitt Gray Subject: [PATCH 4/6] gpio: ws16c48: Mask read inputs for get_multiple Date: Mon, 22 Oct 2018 21:09:49 +0900 Message-Id: <304924e41af041f873abb5c3fe4701d0a870219b.1540209293.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch masks the read inputs with the word mask in order to ensure only requested input states are returned in the bits array. Suggested-by: Rasmus Villemoes Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-ws16c48.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c index c7028eb0b8e1..5cf3697bfb15 100644 --- a/drivers/gpio/gpio-ws16c48.c +++ b/drivers/gpio/gpio-ws16c48.c @@ -169,7 +169,7 @@ static int ws16c48_gpio_get_multiple(struct gpio_chip *chip, port_state = inb(ws16c48gpio->base + i); /* store acquired bits at respective bits array offset */ - bits[word_index] |= port_state << word_offset; + bits[word_index] |= (port_state << word_offset) & word_mask; } return 0; -- 2.19.1