Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4852782ybl; Mon, 9 Dec 2019 18:16:34 -0800 (PST) X-Google-Smtp-Source: APXvYqw4ep5Uq+a77Y0I1TMgoAh2VXco/ArgUsjiH3P3sEr/cOge8qa6TAOmHeOz3+Kpd9+tLU3b X-Received: by 2002:a9d:7b4e:: with SMTP id f14mr24579957oto.355.1575944194506; Mon, 09 Dec 2019 18:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575944194; cv=none; d=google.com; s=arc-20160816; b=pNstKLESsosaSzd4c+mkVK4TLbGb7UMhYGxK9jV2F5v8WQeXvFT+YmXDTczdzPpUaK X8VELeA3+uzxx8DsigdWWmc/iLwYIH9n/hj6+XlD2XZAUBSHC0oTdykSCWZFiXB/e85p bydhh8MNiZ1PJ/B5kUjSyAVvxPz7jkzL5GHyHaPxN5DnN/vDMFQHTMHf+BTfQBi6EQ+b YurMWjpGFjyUt0Edk7rtZ3PBBIHZw478Ux4ToBHLc7JD63pcYWGRXGDFpoRW9y7VONon sxvhkjoWQMnW6wxZZ3f/611kEPYKnNrZ1+Q814eu7QZlghTpDli0d9rWJMatSOrR89FO cxBw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=GQ27vds6K6xy/R1eo6hlJxEYMhnm8WZmX1KVY2NhyVo=; b=Y4BqE5QGb30/ARo4ollRLVgNl5XHawkyCOEckl5zkIM3D3SOIrDQCdR+lCkcQ9/YLD XwPZMF/og3kPbnWc1RWOLdb9lBEFQrWQXA0WxI6tEXt+tgxr1XuCNgfirifDz/czhBur l8/aOBngKiyPElPqZWKpLLfvrf7n2XpOrLpNDWDAxDlveyq8sTXwO4D3Ofvg99QF1953 3tBJa3YXiZCHumcREI5DBE1xdelN/4stgmA4pL8wxrWLTZ8jY5ESAgx18W4v/kXZxr0X yTLFwAr8abZjDC+V+u3Kza6KH55fyBbRkAhRb2//TC+joJusSuvE3eMlbMgodAdZS5L6 8z0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qCtNVB18; 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 a26si993400oto.199.2019.12.09.18.16.21; Mon, 09 Dec 2019 18:16:34 -0800 (PST) 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=qCtNVB18; 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 S1726646AbfLJCPy (ORCPT + 99 others); Mon, 9 Dec 2019 21:15:54 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44247 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbfLJCPx (ORCPT ); Mon, 9 Dec 2019 21:15:53 -0500 Received: by mail-pg1-f195.google.com with SMTP id x7so8068140pgl.11; Mon, 09 Dec 2019 18:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GQ27vds6K6xy/R1eo6hlJxEYMhnm8WZmX1KVY2NhyVo=; b=qCtNVB18l4AXH3spU0ssTTWN9LziniY+tGLO5PgmoQBm4LP2kr+u/IstmffKCZ199+ tOVBNiCcnXHk9jnv8HAozN/t8h1b59cHEZRCxBx9YzTnEZVe7f/LX1efff9NM7OG7UHR 66XR/yfafX6snheRcg+Yj6jo8rVHZ4JqzC0DdnH200Z5LbVaxzs6VAOE327E9r/9KO0d np81G6P60lGqE+BOII9bDmZVQTSCtQORPqDq43lmZzX41w1I24y6dJq5F6uc4ZUaDqV3 ZxBG/QnLQ+PBSgXEhGWRP/z/RVdWoqG+/6hwAbEHG3rxjmyXH/pgplvucJJ5hc0x2xJ5 n9yA== 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:mime-version :content-transfer-encoding; bh=GQ27vds6K6xy/R1eo6hlJxEYMhnm8WZmX1KVY2NhyVo=; b=jwAAEQD5vKJJgxfiwBxxJsKYcY6W7dVuMeKhgOdqxuLFcR1dAHU/cwVq7OzFV/ce3x v3bgcDjCMVnbt0bid5Dwb7Vah76EXAqVaaLQZgqQB+dm2eOpWIffgy5ppDbXVaOZEBRS j0Fei5GZIqYoSBMUCUhHTDH50YXP3Y+uin1ukamZ6KkZBgEsT+i32h+wjQlC3Ip4eJki ontnpdaQ12n5LXS9Zga9VeVw5rkVzKlWsbAJqNn+xtIte26X/aq6jHJa8DGTA6kgziiF uTbM5LWBP9EY2SDDwEGX2od+D4aWu3NJMU66hmHyZDh6nOxgCWH7w1vdN7U8JA6YF35B kLpw== X-Gm-Message-State: APjAAAXKFQ5kk0Hr+WwqDvLrLLfOGWDpMCAXPZU0vqYzi8eQham9F7kZ K/Zp6W8sW34LHmdxi7PjGZd4kw8F X-Received: by 2002:a62:1d55:: with SMTP id d82mr32879494pfd.165.1575944152488; Mon, 09 Dec 2019 18:15:52 -0800 (PST) Received: from sol.lan (220-235-124-2.dyn.iinet.net.au. [220.235.124.2]) by smtp.gmail.com with ESMTPSA id m13sm790391pga.70.2019.12.09.18.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 18:15:51 -0800 (PST) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org, bamv2005@gmail.com Cc: Kent Gibson Subject: [PATCH] gpio: gpio-mockup: Fix usage of new GPIO_LINE_DIRECTION Date: Tue, 10 Dec 2019 10:15:25 +0800 Message-Id: <20191210021525.13455-1-warthog618@gmail.com> X-Mailer: git-send-email 2.24.0 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 Restore the external behavior of gpio-mockup to what it was prior to the change to using GPIO_LINE_DIRECTION. Signed-off-by: Kent Gibson --- Fix a regression introduced in v5.5-rc1. The change to GPIO_LINE_DIRECTION reversed the polarity of the dir field within gpio-mockup.c, but overlooked inverting the value on initialization and when returned by gpio_mockup_get_direction. The latter is a bug. The former is a problem for tests which assume initial conditions, specifically the mockup used to initialize chips with all lines as inputs. That superficially appeared to be the case after the previous patch due to the bug in gpio_mockup_get_direction. drivers/gpio/gpio-mockup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index 56d647a30e3e..c4fdc192ea4e 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -226,7 +226,7 @@ static int gpio_mockup_get_direction(struct gpio_chip *gc, unsigned int offset) int direction; mutex_lock(&chip->lock); - direction = !chip->lines[offset].dir; + direction = chip->lines[offset].dir; mutex_unlock(&chip->lock); return direction; @@ -395,7 +395,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) struct gpio_chip *gc; struct device *dev; const char *name; - int rv, base; + int rv, base, i; u16 ngpio; dev = &pdev->dev; @@ -447,6 +447,9 @@ static int gpio_mockup_probe(struct platform_device *pdev) if (!chip->lines) return -ENOMEM; + for (i = 0; i < gc->ngpio; i++) + chip->lines[i].dir = GPIO_LINE_DIRECTION_IN; + if (device_property_read_bool(dev, "named-gpio-lines")) { rv = gpio_mockup_name_lines(dev, chip); if (rv) -- 2.24.0