Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3485102imu; Sun, 11 Nov 2018 16:09:53 -0800 (PST) X-Google-Smtp-Source: AJdET5cEgD7HFC/LGDm1tMx5Bp0boNzsqBe/bWenXiR+YUd4FmbxhIvnBlzBy2MHZH5u4TlfUInN X-Received: by 2002:a17:902:481:: with SMTP id e1-v6mr14393896ple.132.1541981393539; Sun, 11 Nov 2018 16:09:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981393; cv=none; d=google.com; s=arc-20160816; b=Fh2xA+Bqdg6GUnHfL4bqdiIXsFY2wkr2uJzsbr/SlDyMUlybu5s/2DhCFgna1cVCHn sEGb0jf90d3eDM/ns7RdmAMb+WhusnBiSGqb7FZZidjs7SS5EKI/y+IuDoNDLKOPzTrG eNNURa2awWE4/bKrJQvPzfaNo5hSzay18Xw9dG7B0qBST8ewktCdjYs0UWeCIF87oI6x VhdYZU5xMpU035ZM/SFEyd8EpnTswxaHo0mIM0f02028QDZAF89RmO4gMAI5927RuJSX T/t6MilJZ9GKPlfZFKNDsc1eauIV7vneBFKtS0tz7Z+r3hcZvw2WqDVC57ziT8Eu7E+M Jilg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3URnoaXkks1cQscfaVPDnFxCwiaKAUHfMQG+MzZm+pw=; b=oLu62KJJfEzPhwMk9O98z9ckBDu1mwAS3qAojszfYGIhKlsmiOyl2OOObFZTtGQ5Uc 5nonXRVI7vhxn2sEhKiFkE7GF7rhV4JUyilwmLaX/Rk2W0nYBVUQct4wLJfl4Kt/rqsg N1/SfCoNjcueFuB0heltQ5zISeUrvLN9JRIqYf2D/xAPwwGE95POBvoFVIBF35b0ZEjo PvwIdiqDiiXorvPDMKHvBretsGf1XNxqp4bdJZ5zz7gveCrKsf27nl2coH0H8Mg018h2 nCfw3SgPxZqp1PXXDGYThUkGUt/KM+UqIQajwXJzeoycRvVr/GtXTRcNl5qgDZj5m4jf i1Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E+Qh+wX2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si16799771plt.225.2018.11.11.16.09.38; Sun, 11 Nov 2018 16:09:53 -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=@kernel.org header.s=default header.b=E+Qh+wX2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731834AbeKLJ7l (ORCPT + 99 others); Mon, 12 Nov 2018 04:59:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:59904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731045AbeKLIR3 (ORCPT ); Mon, 12 Nov 2018 03:17:29 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 907A321582; Sun, 11 Nov 2018 22:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975253; bh=578Z6RbMXI6sklKQ9z7CoqgiTA0rMh3q3txK22R632A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E+Qh+wX2mEXeQr0QLm+PaiPbeDvmUicBH1AiRzKxChecLznng8JPXxZzbqmlEe/fX nda8HsxgGrpb3vpc8leJ4VKqiEeFAVZ0NTlFZd4zDxBFHEWQr6KDd/KdaUdPTdqsYy RBXoafXKJbMaIvLvPA8Ei6SLKJbuC2hwNodhyEjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Chen , Florian Fainelli , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 122/361] gpio: brcmstb: allow 0 width GPIO banks Date: Sun, 11 Nov 2018 14:17:49 -0800 Message-Id: <20181111221637.158937985@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Justin Chen [ Upstream commit bfba223dcc4548632d8f3bfd15690a86d4c68504 ] Sometimes we have empty banks within the GPIO block. This commit allows proper handling of 0 width GPIO banks. We handle 0 width GPIO banks by incrementing the bank and number of GPIOs, but not initializing them. This will mean a call into the non-existent GPIOs will return an error. Also remove "GPIO registered" dev print. This information is misleading since the incremented banks and gpio_base do not reflect the actual GPIOs that get initialized. We leave this information out since it is already printed with dev_dbg. Signed-off-by: Justin Chen Acked-by: Florian Fainelli Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-brcmstb.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c @@ -664,6 +664,18 @@ static int brcmstb_gpio_probe(struct pla struct brcmstb_gpio_bank *bank; struct gpio_chip *gc; + /* + * If bank_width is 0, then there is an empty bank in the + * register block. Special handling for this case. + */ + if (bank_width == 0) { + dev_dbg(dev, "Width 0 found: Empty bank @ %d\n", + num_banks); + num_banks++; + gpio_base += MAX_GPIO_PER_BANK; + continue; + } + bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL); if (!bank) { err = -ENOMEM; @@ -740,9 +752,6 @@ static int brcmstb_gpio_probe(struct pla goto fail; } - dev_info(dev, "Registered %d banks (GPIO(s): %d-%d)\n", - num_banks, priv->gpio_base, gpio_base - 1); - if (priv->parent_wake_irq && need_wakeup_event) pm_wakeup_event(dev, 0);