From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id BD8711C01CA for ; Fri, 25 May 2018 16:54:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BA80E87567 for ; Fri, 25 May 2018 16:54:59 +0000 (UTC) Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0MfAT8pDGVka for ; Fri, 25 May 2018 16:54:59 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E1F8D8768B for ; Fri, 25 May 2018 16:54:58 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id f6-v6so16105980wmc.4 for ; Fri, 25 May 2018 09:54:58 -0700 (PDT) From: Sergio Paracuellos Subject: [PATCH 1/7] staging: mt7621-gpio: rename MTK_MAX_BANK into MTK_BANK_CNT Date: Fri, 25 May 2018 18:54:47 +0200 Message-Id: <1527267293-1862-2-git-send-email-sergio.paracuellos@gmail.com> In-Reply-To: <1527267293-1862-1-git-send-email-sergio.paracuellos@gmail.com> References: <1527267293-1862-1-git-send-email-sergio.paracuellos@gmail.com> List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: gregkh@linuxfoundation.org Cc: neil@brown.name, driverdev-devel@linuxdriverproject.org There are 3 banks of gpios numbered '0' and '1' and '2'. So the maximum bank number is "2". "3" is the count of banks. In order to make the code looks and be correct on checking max allowed gpio's id it makes sense to change the name of this definition. Also there is another definitions which start with the same prefix MKK_BANK_ of the new name so having those with the same prefix makes all preprocessor structure to be the same. This improves readability. Signed-off-by: Sergio Paracuellos Reviewed-by: NeilBrown --- drivers/staging/mt7621-gpio/gpio-mt7621.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c index 5d923a7..6416936 100644 --- a/drivers/staging/mt7621-gpio/gpio-mt7621.c +++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c @@ -14,7 +14,7 @@ #include #include -#define MTK_MAX_BANK 3 +#define MTK_BANK_CNT 3 #define MTK_BANK_WIDTH 32 enum mediatek_gpio_reg { @@ -43,7 +43,7 @@ struct mtk_data { void __iomem *gpio_membase; int gpio_irq; struct irq_domain *gpio_irq_domain; - struct mtk_gc *gc_map[MTK_MAX_BANK]; + struct mtk_gc *gc_map[MTK_BANK_CNT]; }; static inline struct mtk_gc @@ -156,7 +156,7 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node *bank) struct mtk_gc *rg; int ret; - if (!id || be32_to_cpu(*id) >= MTK_MAX_BANK) + if (!id || be32_to_cpu(*id) >= MTK_BANK_CNT) return -EINVAL; rg = devm_kzalloc(&pdev->dev, sizeof(struct mtk_gc), GFP_KERNEL); @@ -202,7 +202,7 @@ mediatek_gpio_irq_handler(struct irq_desc *desc) struct mtk_data *gpio_data = irq_desc_get_handler_data(desc); int i; - for (i = 0; i < MTK_MAX_BANK; i++) { + for (i = 0; i < MTK_BANK_CNT; i++) { struct mtk_gc *rg = gpio_data->gc_map[i]; unsigned long pending; int bit; @@ -345,7 +345,7 @@ mediatek_gpio_probe(struct platform_device *pdev) gpio_data->gpio_irq = irq_of_parse_and_map(np, 0); if (gpio_data->gpio_irq) { gpio_data->gpio_irq_domain = irq_domain_add_linear(np, - MTK_MAX_BANK * MTK_BANK_WIDTH, + MTK_BANK_CNT * MTK_BANK_WIDTH, &irq_domain_ops, gpio_data); if (!gpio_data->gpio_irq_domain) dev_err(&pdev->dev, "irq_domain_add_linear failed\n"); -- 2.7.4 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel