All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergio Paracuellos <sergio.paracuellos@gmail.com>
To: gregkh@linuxfoundation.org
Cc: neil@brown.name, driverdev-devel@linuxdriverproject.org
Subject: [PATCH 1/7] staging: mt7621-gpio: rename MTK_MAX_BANK into MTK_BANK_CNT
Date: Fri, 25 May 2018 18:54:47 +0200	[thread overview]
Message-ID: <1527267293-1862-2-git-send-email-sergio.paracuellos@gmail.com> (raw)
In-Reply-To: <1527267293-1862-1-git-send-email-sergio.paracuellos@gmail.com>

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 <sergio.paracuellos@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
---
 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 <linux/interrupt.h>
 #include <linux/platform_device.h>
 
-#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

  reply	other threads:[~2018-05-25 16:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 16:54 [PATCH 0/7] staging: mt7621-gpio: cleanups to move this driver out of staging Sergio Paracuellos
2018-05-25 16:54 ` Sergio Paracuellos [this message]
2018-05-25 16:54 ` [PATCH 2/7] staging: mt7621-gpio: use module_platform_driver() instead subsys initcall Sergio Paracuellos
2018-05-25 16:54 ` [PATCH 3/7] staging: mt7621-gpio: fix masks for gpio pin Sergio Paracuellos
2018-05-25 16:54 ` [PATCH 4/7] staging: mt7621-gpio: avoid locking in mediatek_gpio_get_direction Sergio Paracuellos
2018-05-25 16:54 ` [PATCH 5/7] staging: mt7621-gpio: change lock place in irq mask and unmask functions Sergio Paracuellos
2018-05-25 16:54 ` [PATCH 6/7] staging: mt7621-dts: add missing properties to gpio node Sergio Paracuellos
2018-05-25 16:54 ` [PATCH 7/7] staging: mt7621-gpio: dt-bindings: complete documentation for the gpio Sergio Paracuellos
2018-05-27 23:09 ` [PATCH 0/7] staging: mt7621-gpio: cleanups to move this driver out of staging NeilBrown
2018-05-28  4:55   ` Sergio Paracuellos
2018-05-29  4:58   ` [PATCH 0/6] staging: mt7621-gpio: last cleanups Sergio Paracuellos
2018-05-29  4:58     ` [PATCH 1/6] staging: mt7621-dts: fix property #interrupt-cells for the gpio node Sergio Paracuellos
2018-05-29 23:34       ` NeilBrown
2018-05-30  4:50         ` [PATCH v2] staging: mt7621-gpio: update " Sergio Paracuellos
2018-05-31  5:27           ` NeilBrown
2018-05-31 12:20             ` Sergio Paracuellos
2018-06-01  9:18               ` Greg KH
2018-06-01  9:30                 ` [RESEND PATCH 1/6] " Sergio Paracuellos
2018-06-01  9:30                   ` [RESEND PATCH 2/6] staging: mt7621-gpio: dt-bindings: update documentation for #interrupt-cells property Sergio Paracuellos
2018-06-01  9:30                   ` [RESEND PATCH 3/6] staging: mt7621-gpio: change 'to_mediatek_gpio' to make just a one line return Sergio Paracuellos
2018-06-01  9:30                   ` [RESEND PATCH 4/6] staging: mt7621-gpio: use GPIOF_DIR_OUT and GPIOF_DIR_IN macros instead of custom values Sergio Paracuellos
2018-06-01  9:30                   ` [RESEND PATCH 5/6] staging: mt7621-gpio: change gc_map to don't use pointers Sergio Paracuellos
2018-06-01  9:30                   ` [RESEND PATCH 6/6] staging: mt7621-gpio: reorder includes alphabetically Sergio Paracuellos
2018-06-01  9:36                 ` [PATCH v2] staging: mt7621-gpio: update #interrupt-cells for the gpio node Sergio Paracuellos
2018-05-30  4:54         ` [PATCH 1/6] staging: mt7621-dts: fix property " Sergio Paracuellos
2018-05-29  4:58     ` [PATCH 2/6] staging: mt7621-gpio: dt-bindings: update documentation for #interrupt-cells property Sergio Paracuellos
2018-05-29  4:58     ` [PATCH 3/6] staging: mt7621-gpio: change 'to_mediatek_gpio' to make just a one line return Sergio Paracuellos
2018-05-29  4:58     ` [PATCH 4/6] staging: mt7621-gpio: use GPIOF_DIR_OUT and GPIOF_DIR_IN macros instead of custom values Sergio Paracuellos
2018-05-29  4:58     ` [PATCH 5/6] staging: mt7621-gpio: change gc_map to don't use pointers Sergio Paracuellos
2018-05-29  4:58     ` [PATCH 6/6] staging: mt7621-gpio: reorder includes alphabetically Sergio Paracuellos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1527267293-1862-2-git-send-email-sergio.paracuellos@gmail.com \
    --to=sergio.paracuellos@gmail.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=neil@brown.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.