From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/15] OMAP: GPIO: move bank width into struct gpio_bank
Date: Fri, 22 Apr 2011 16:01:55 -0700	[thread overview]
Message-ID: <1303513327-14532-4-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1303513327-14532-1-git-send-email-khilman@ti.com>
Rather than having a file-global bank_width variable, move it into
struct gpio_bank so it can be bank-specific.   Note the bank width
is already passed per-bank via platform_data, so current code would
be incorrect if any banks had different width.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/plat-omap/gpio.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 8b5ca6e..443fb9a 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -159,6 +159,7 @@ struct gpio_bank {
 	struct device *dev;
 	bool dbck_flag;
 	int stride;
+	u32 width;
 };
 
 #ifdef CONFIG_ARCH_OMAP3
@@ -184,8 +185,6 @@ static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
  */
 static struct gpio_bank *gpio_bank;
 
-static int bank_width;
-
 /* TODO: Analyze removing gpio_bank_count usage from driver code */
 int gpio_bank_count;
 
@@ -983,7 +982,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
 		if (bank->non_wakeup_gpios & (1 << gpio)) {
 			printk(KERN_ERR "Unable to modify wakeup on "
 					"non-wakeup GPIO%d\n",
-					(bank - gpio_bank) * 32 + gpio);
+			       (bank - gpio_bank) * bank->width + gpio);
 			return -EINVAL;
 		}
 		spin_lock_irqsave(&bank->lock, flags);
@@ -1650,14 +1649,14 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
 	} else {
 		bank->chip.label = "gpio";
 		bank->chip.base = gpio;
-		gpio += bank_width;
+		gpio += bank->width;
 	}
-	bank->chip.ngpio = bank_width;
+	bank->chip.ngpio = bank->width;
 
 	gpiochip_add(&bank->chip);
 
 	for (j = bank->virtual_irq_start;
-		     j < bank->virtual_irq_start + bank_width; j++) {
+		     j < bank->virtual_irq_start + bank->width; j++) {
 		irq_set_lockdep_class(j, &gpio_lock_class);
 		irq_set_chip_data(j, bank);
 		if (bank_is_mpuio(bank))
@@ -1707,7 +1706,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 	bank->dev = &pdev->dev;
 	bank->dbck_flag = pdata->dbck_flag;
 	bank->stride = pdata->bank_stride;
-	bank_width = pdata->bank_width;
+	bank->width = pdata->bank_width;
 
 	spin_lock_init(&bank->lock);
 
-- 
1.7.4
next prev parent reply	other threads:[~2011-04-22 23:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 23:01 [PATCH 00/15] OMAP: GPIO: clean up: pass register offsets via pdata Kevin Hilman
2011-04-22 23:01 ` [PATCH 01/15] OMAP: GPIO: _clear_gpio_irqbank: fix flushing of posted write Kevin Hilman
2011-04-22 23:01 ` [PATCH 02/15] OMAP: GPIO: remove MPUIO handling from _clear_gpio_irqbank() Kevin Hilman
2011-04-25 13:48   ` Varadarajan, Charulatha
2011-05-03 16:27     ` Kevin Hilman
2011-04-22 23:01 ` Kevin Hilman [this message]
2011-04-22 23:01 ` [PATCH 04/15] OMAP: GPIO: _get_gpio_irqbank_mask: replace hard-coded mask with bank->width Kevin Hilman
2011-04-22 23:01 ` [PATCH 05/15] OMAP: GPIO: replace get_gpio_index() by using bank width Kevin Hilman
2011-04-22 23:01 ` [PATCH 06/15] OMAP: GPIO: remove get_gpio_bank() Kevin Hilman
2011-04-22 23:01 ` [PATCH 07/15] OMAP: GPIO: move register offset defines into gpio.h Kevin Hilman
2011-04-22 23:02 ` [PATCH 08/15] OMAP: GPIO: consolidate direction, input, output, remove #ifdefs Kevin Hilman
2011-04-22 23:02 ` [PATCH 09/15] OMAP: GPIO: consolidate IRQ status handling, " Kevin Hilman
2011-04-26 12:43   ` Varadarajan, Charulatha
2011-04-22 23:02 ` [PATCH 10/15] OMAP: GPIO: conslidate enable/disable of GPIO IRQs, remove ifdefs Kevin Hilman
2011-04-26 12:33   ` Varadarajan, Charulatha
2011-04-22 23:02 ` [PATCH 11/15] OMAP: GPIO: convert MPUIO IRQ over to generic irq_chip Kevin Hilman
2011-04-26 12:02   ` Varadarajan, Charulatha
2011-04-22 23:02 ` [PATCH 12/15] OMAP: GPIO: remove useless gpio_valid() & check_gpio() checks Kevin Hilman
2011-04-22 23:02 ` [PATCH 13/15] OMAP: GPIO: cleanup _set_gpio_wakeup(), remove ifdefs Kevin Hilman
2011-04-26 14:44   ` Varadarajan, Charulatha
2011-05-03 16:35     ` Kevin Hilman
2011-04-22 23:02 ` [PATCH 14/15] OMAP: GPIO: debounce remove SoC specific registers, use pdata Kevin Hilman
2011-04-22 23:02 ` [PATCH 15/15] OMAP: GPIO: cleanup show revision, remove cpu_is checks, display only once Kevin Hilman
2011-04-26 11:48   ` Varadarajan, Charulatha
2011-05-03 16:38     ` Kevin Hilman
2011-05-03 23:59       ` Kevin Hilman
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=1303513327-14532-4-git-send-email-khilman@ti.com \
    --to=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).