Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1984705pxj; Sun, 13 Jun 2021 05:07:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGw37mTkPuSU+MTtUdDdtNcslvrKnNvsPPH/aIvsg9OVtJID+dKT4+OqFAujTEp3mINSxI X-Received: by 2002:a17:906:869a:: with SMTP id g26mr11052823ejx.94.1623586052699; Sun, 13 Jun 2021 05:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623586052; cv=none; d=google.com; s=arc-20160816; b=Miq551t+7Hxi5o49ADxjUWsDIR67qzm3iWm5+NCR2zcZq5IPKMiKFqU8fUyqn8Lis4 2QQE9Y55IUwu6R8m1PbT9SPkt8WWsMM7AWLY6zq9guJmVOPbyBgklxhzYLqZJHgMKOnZ AQ9Nq72oV16fJZQkjG4aXBw/BxnHvhqzpRml0sJynEjeCUjn1KwBHN804z1icdcApXZR /z32K4rKQWC7Y/2ZsEWgiFqLA4jWKt5ZVlxfbe/sAls1j3NKzjakBpkWu72Ot7v8J0PB WdbuzgBkl1ouMrA+eTjfCiTBSqX/+6evHcLQ8wXAyM88/BU5HBSa+IQFsYkwyQUZ7ckK EiCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=T7y9KdWzDZlAQvmm1WOntjeheGoGZeVdrROZJ+7WE2o=; b=Xr9Y3r8mThw4BbXm6ie99RK0jeU3LSycDkHZrrKpT3lWFco7APtbtznTjyTCOBjAku FQRc1j22KCoDVYamirECfqci8bJPkZznCc6OAtQ0cS5wN3QfJ5sJCOdBP0AErh5+S+Ol V/Xa9iYtc63t1OAb5glJySUYL4pzOGP3QsKIo7oMYjqKfXTp8vhc8l4sTYX1YYgWxvQ2 Q0MSjMxdV5/zzVGIOTm/oXoGEWTrZMR6V57QbZFgMauTZmzNzI9fcHwD7cdQyF8XjnEW mo1B+oLWnzeZIDIGuD3XvOGdzrCfzIQZsykydGU0KoAv1dWREkskg0dgXzXH7/MUaWdq XzIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si9130686eji.282.2021.06.13.05.07.09; Sun, 13 Jun 2021 05:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbhFMMIU (ORCPT + 99 others); Sun, 13 Jun 2021 08:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbhFMMIU (ORCPT ); Sun, 13 Jun 2021 08:08:20 -0400 Received: from mxout013.mail.hostpoint.ch (mxout013.mail.hostpoint.ch [IPv6:2a00:d70:0:e::313]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E2FAC061574 for ; Sun, 13 Jun 2021 05:06:17 -0700 (PDT) Received: from [10.0.2.44] (helo=asmtp014.mail.hostpoint.ch) by mxout013.mail.hostpoint.ch with esmtp (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1lsOsZ-000NTd-TG; Sun, 13 Jun 2021 14:06:15 +0200 Received: from [2a02:168:6182:1:d747:8127:5b7a:4266] (helo=eleanor.home.reto-schneider.ch) by asmtp014.mail.hostpoint.ch with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1lsOsZ-000AA3-RV; Sun, 13 Jun 2021 14:06:15 +0200 X-Authenticated-Sender-Id: reto-schneider@reto-schneider.ch From: Reto Schneider To: linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org Cc: Stefan Roese , Reto Schneider , Bartosz Golaszewski , Linus Walleij , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] gpio: mt7621: Assign base field in gpio_chip Date: Sun, 13 Jun 2021 14:06:08 +0200 Message-Id: <20210613120608.1527394-1-code@reto-schneider.ch> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Reto Schneider This is needed for gpiochip_sysfs_register() to properly export /sys/class/gpio/gpiochip{0,32,64}. Without this fix, the field base in gpio_device remains at its initialization value, which is -1. This causes gpiochip_add_data_with_key() to call gpiochip_find_base(), which in turn dynamically determines the base to be at ARCH_NR_GPIOS - 32/64/96, resulting in gpiochip{480,448,416}. Detected/fixed/tested on a MediaTek MT7688 based GARDENA smart gateway. Signed-off-by: Reto Schneider --- drivers/gpio/gpio-mt7621.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c index 82fb20dca53a..403d64cd65a6 100644 --- a/drivers/gpio/gpio-mt7621.c +++ b/drivers/gpio/gpio-mt7621.c @@ -234,6 +234,7 @@ mediatek_gpio_bank_probe(struct device *dev, return ret; } + rg->chip.base = rg->bank * MTK_BANK_WIDTH; rg->chip.of_gpio_n_cells = 2; rg->chip.of_xlate = mediatek_gpio_xlate; rg->chip.label = devm_kasprintf(dev, GFP_KERNEL, "%s-bank%d", -- 2.30.2