Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1529390imm; Wed, 15 Aug 2018 20:35:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyC8LPrIFvpxGeo1aljRjAFVYmeEfok6qkykMaydodAwe7nzu3g8kFdAeY6WiUnQGcCFha6 X-Received: by 2002:a63:e056:: with SMTP id n22-v6mr27774328pgj.205.1534390515632; Wed, 15 Aug 2018 20:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534390515; cv=none; d=google.com; s=arc-20160816; b=UBfhMK7PjrVMhxPRi7NhIoY5SbiSTaSCXgBT29e/BgAGdRl6JPb5nAAKrw4ZlaUONs gfgxW7Wf6HQgOO8TxUdmKC0MxxOa3JNyn5oCboqnyLzlP+eY8ZkFVOY1JazdDmPZo2q5 va6jznVmc+dsT+CDL769C0+trG3rbaTiESEeWv3meGjBEjsYV1bOzZWJKa+96PPkO0XR 8eAJkVTcK9xUp0V41NetaLyjoqmvyqDuoMWASwzSDSzqypWa0bfo8j3IV66+5hatxYhc MXB4QQq0VSeIzjI16Pm5Q6mywKdZJdHPYJVfahVKcCGmrhlC1mYvdPLYhxgrxEtz+Odx NIaA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=HgM14SYS88sNN8JlnQh8L3WOJvqLHLkL0+Z+QL6CT/k=; b=MbL4EEXQLuzxK2FgKJZXiKhPJM1kuhgWuDLiVB45mqsA0/kp94pbAo30AcyOkiMIUr X1bM6FkeYBd4K2qcUhOQ2i2I7vJx2donpfqsdObkXIEnwpXGFu2iiWlYPwfWdf/Qp0nh 32fHM3FS8uZ9Bc7j3c2VoA5S04lY5O3tl4WqQE1mfs6OwDIQQKj29FxWufNidOkrBsyb FrhIroVLHlH1nFG5VNhqockERZli83or7avoAkGKjk3O4dWvHzO8tXmnTra8au35OGj8 06iuQha4oHf83Dzbbr/4UFNx5HHz0PoTB0aOOrd6os2PXLh4fK76O+cpDmqXQKuqgRJA sN/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P1Xnfh3Q; 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 o12-v6si27495508pfd.142.2018.08.15.20.35.00; Wed, 15 Aug 2018 20:35:15 -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=P1Xnfh3Q; 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 S1731453AbeHPDIq (ORCPT + 99 others); Wed, 15 Aug 2018 23:08:46 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:38307 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbeHPDIq (ORCPT ); Wed, 15 Aug 2018 23:08:46 -0400 Received: by mail-pl0-f66.google.com with SMTP id u11-v6so1173901plq.5; Wed, 15 Aug 2018 17:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HgM14SYS88sNN8JlnQh8L3WOJvqLHLkL0+Z+QL6CT/k=; b=P1Xnfh3QeVytKZwQvL7lsTVSi0lbCfHkrYagrfN9KPCQaU5V2YkzqZATzrkTLXIg0u tScE2m6pR61KaMux5dtJ704udBKO3s6mxWn7fGqbiXqD60YZLN0NDgHXELACtORXhNnK 6YCbk82MqLlFTTHUPiPBq0S94hKLMyPM/X3nFDyzIKvdr7OEiLNbGNPRRcQVK8zQ8QNv MB1yjzn+fuKfHBbU8Ux3rzv9uibcUyoc0/rGOcclkk9A0+2Cs4lBMjfrRUSTOaXspdCZ N9d3u7OsBB90N+GGqPjgNFXSDWVws02+x+PFRdG32q9FCB8szH5QFhps5qXMMnDkJ7lC yISQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HgM14SYS88sNN8JlnQh8L3WOJvqLHLkL0+Z+QL6CT/k=; b=ZVSC5kbsaHHul0RyMuyk53B0iisukUuNQGulelCrbg8fznksxkmHXcOYz9kY17aFeq zNNzxVrRlWCm+FNXRGEceFfhzzRN5IGv5vP1Df/4KP+NSnVye13qVqn/WxH1r0W9M7tJ Rv/faJLgF1xBwVwmCFui4Bj/L3bhSdFPhsskulRPFWRm8ndIs5D2JSf2pM6U+nhgRHyS QqsqmfIE9r3FWUwq0E7lQ2HKOKYtnuuf/y4+XXTa/ymp9en0FqSQLi3a2du8SY0UnUOn 4+KxlxWC1X+esDSLlIZfe3pdYpSIxrlMPBYfQ72e3INZwnSk1xkWYwdo2EkalsBP74Wx iHNw== X-Gm-Message-State: AOUpUlGtcO5Xt//nloScCD0t+zjJP17dIELGr+k1/Dfmux8Dq+g9dMXy iqRX3W+NlLvCq//U2Ggyf0s= X-Received: by 2002:a17:902:680d:: with SMTP id h13-v6mr20726524plk.146.1534378448797; Wed, 15 Aug 2018 17:14:08 -0700 (PDT) Received: from [10.69.41.93] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id t21-v6sm40169123pfi.73.2018.08.15.17.14.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Aug 2018 17:14:07 -0700 (PDT) Subject: Re: [PATCH] gpio: brcmstb: allow 0 width GPIO banks To: justinpopo6@gmail.com, linux-gpio@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, f.fainelli@gmail.com, computersforpeace@gmail.com, linus.walleij@linaro.org, gregory.0xf0@gmail.com References: <1534289517-1805-1-git-send-email-justinpopo6@gmail.com> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80nRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaU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4P WU11Nr9i/qoV8QCo12MQEo244RRA6VMud06y/E449rWZFSTwGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: Date: Wed, 15 Aug 2018 17:14:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1534289517-1805-1-git-send-email-justinpopo6@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/14/2018 04:31 PM, justinpopo6@gmail.com wrote: > From: Justin Chen > > 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 banks and GPIO information from the dev_info print. This > information is misleading since the incremented banks and gpio_base do > not reflect the actual GPIOs that got initialized. We leave this > information out since it is already printed with dev_dbg. > > Signed-off-by: Justin Chen > --- > drivers/gpio/gpio-brcmstb.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c > index 16c7f9f..8658910 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); Stylistic nit: you would want the second line to be aligned at the start of the opening parenthesis > + num_banks++; > + gpio_base += MAX_GPIO_PER_BANK; > + continue; > + } > + > bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL); > if (!bank) { > err = -ENOMEM; > @@ -740,8 +752,7 @@ 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); > + dev_info(dev, "Brcmstb GPIO registered\n"); Not sure if there much value in preserving that message anymore, if the controller is not there, nothing will show up in /sys/class/gpio, so you would pretty quickly find out that something went wrong? > > if (priv->parent_wake_irq && need_wakeup_event) > pm_wakeup_event(dev, 0); > -- Florian