Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp173536imd; Wed, 31 Oct 2018 16:48:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5cllZnOFaIFQljOW+B2eN2p+BjKTEtF6ygsna1Idj963aTNdFzEPn6t+bzLcNclACmquAh1 X-Received: by 2002:a62:43cd:: with SMTP id l74-v6mr5544018pfi.240.1541029690617; Wed, 31 Oct 2018 16:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029690; cv=none; d=google.com; s=arc-20160816; b=UUhpq1vh1hOVydGC9z5uVsuxvV39toeoqNyfJDeMSk8D50t49dPodAbOD0fd07gx9x XmUzBZmS3i+Kk/B2Shbnl5V6YQm98SE30VrazmNPSxFOdbAb2q9S3UHXxjiskJ59Gh7o MMNKiG2kAXvTLku9COZ2Xmn5zyQ0lOvwgtBZDCB6XOo4Vkp2xcmB+BrSvFPz25CWgju9 7EkbKp1j7kZQvtIP2XtrDIG6BglZKtyajSa7genFbVDP9Yak2+7VqMCOI11YrNfh2k0d fmKrY+41IssuC3ISFORqWFgC8Un0UMF2iMgNqfS9IioRC2kHucQjBdQgIzXb9fTjTn4/ TIRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=f9fRvufsfDgeiNcuSTnlIvFukPwao8s/e6SfH7v4/R0=; b=OfCHfe3qsA8EEoOiaRWZ+E7q7BWQtwcZRVgidk60x9Jen6NYmbe+3Sl1t1PGbjjoyD Zpe4NuwD15TMpyXW+PeoxmPGrOaQqoDn0/vVsaGCMZUaauuMRJpQCMhYcTSQOV7LNHje IFU4agCEYwYZ0T5UtxukidGNoG0u2k59DYqMOPH8NvdBU2swmEByPSB+elnwmy2PjS0/ v0dk62iM6MXC52JV8Q9ioTRXsU+PNu38461D4QQ/2cMFy2JIiNyqt3THGlY/jA+uGk9Y PtahDnw85Sn+zGnFJAQsff4zxVxCfkrmWtiYWxcHe66+qvzwhqQXGLl2QOJJus++f5PV D7kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TOSYC3dR; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si13096790ply.423.2018.10.31.16.47.56; Wed, 31 Oct 2018 16:48:10 -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=@kernel.org header.s=default header.b=TOSYC3dR; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728954AbeKAIr5 (ORCPT + 99 others); Thu, 1 Nov 2018 04:47:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:54490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728512AbeKAIHD (ORCPT ); Thu, 1 Nov 2018 04:07:03 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 988982081B; Wed, 31 Oct 2018 23:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027213; bh=xXl0T0UaSbTCJv8rNceggG65O/Iizv3+FBKTy9tKiOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOSYC3dRDD/izoEO/ziuEZtaRRr61YraAHmSylRSF4uvS/q/HBsX4F2mSDBWvgd3F i4P8cO7tetZE/Oq2dwHxZsnbxkK/od4PrAT2+UKZtbfAp7X1QT4x0h3v/IvYAqP1L9 OVId4QMdJk/Vv0XsdQViRYuVtDsZJqTEFmbGHxl4= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Justin Chen , Linus Walleij , Sasha Levin Subject: [PATCH AUTOSEL 4.19 077/146] gpio: brcmstb: allow 0 width GPIO banks Date: Wed, 31 Oct 2018 19:04:32 -0400 Message-Id: <20181031230541.28822-77-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpio/gpio-brcmstb.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index 16c7f9f49416..af936dcca659 100644 --- a/drivers/gpio/gpio-brcmstb.c +++ b/drivers/gpio/gpio-brcmstb.c @@ -664,6 +664,18 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) 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 platform_device *pdev) 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); -- 2.17.1