diff options
author | Kevin Hilman <khilman@ti.com> | 2011-04-21 12:23:00 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-06-16 14:13:13 -0400 |
commit | d5f46247e77a63bc3bb4b3f979281e5c700c218e (patch) | |
tree | 9d940ac3f9ea7d25ef85b7981836326b91b58ce1 /drivers/gpio/gpio-omap.c | |
parent | bdba15db4d81940776ab96ea9f558b7388b0f7fe (diff) |
gpio/omap: move bank width into struct gpio_bank
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>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 7135810a77bc..3f436c033611 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -54,6 +54,7 @@ struct gpio_bank { | |||
54 | struct device *dev; | 54 | struct device *dev; |
55 | bool dbck_flag; | 55 | bool dbck_flag; |
56 | int stride; | 56 | int stride; |
57 | u32 width; | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | #ifdef CONFIG_ARCH_OMAP3 | 60 | #ifdef CONFIG_ARCH_OMAP3 |
@@ -79,8 +80,6 @@ static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS]; | |||
79 | */ | 80 | */ |
80 | static struct gpio_bank *gpio_bank; | 81 | static struct gpio_bank *gpio_bank; |
81 | 82 | ||
82 | static int bank_width; | ||
83 | |||
84 | /* TODO: Analyze removing gpio_bank_count usage from driver code */ | 83 | /* TODO: Analyze removing gpio_bank_count usage from driver code */ |
85 | int gpio_bank_count; | 84 | int gpio_bank_count; |
86 | 85 | ||
@@ -870,7 +869,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) | |||
870 | if (bank->non_wakeup_gpios & (1 << gpio)) { | 869 | if (bank->non_wakeup_gpios & (1 << gpio)) { |
871 | printk(KERN_ERR "Unable to modify wakeup on " | 870 | printk(KERN_ERR "Unable to modify wakeup on " |
872 | "non-wakeup GPIO%d\n", | 871 | "non-wakeup GPIO%d\n", |
873 | (bank - gpio_bank) * 32 + gpio); | 872 | (bank - gpio_bank) * bank->width + gpio); |
874 | return -EINVAL; | 873 | return -EINVAL; |
875 | } | 874 | } |
876 | spin_lock_irqsave(&bank->lock, flags); | 875 | spin_lock_irqsave(&bank->lock, flags); |
@@ -1545,14 +1544,14 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank) | |||
1545 | } else { | 1544 | } else { |
1546 | bank->chip.label = "gpio"; | 1545 | bank->chip.label = "gpio"; |
1547 | bank->chip.base = gpio; | 1546 | bank->chip.base = gpio; |
1548 | gpio += bank_width; | 1547 | gpio += bank->width; |
1549 | } | 1548 | } |
1550 | bank->chip.ngpio = bank_width; | 1549 | bank->chip.ngpio = bank->width; |
1551 | 1550 | ||
1552 | gpiochip_add(&bank->chip); | 1551 | gpiochip_add(&bank->chip); |
1553 | 1552 | ||
1554 | for (j = bank->virtual_irq_start; | 1553 | for (j = bank->virtual_irq_start; |
1555 | j < bank->virtual_irq_start + bank_width; j++) { | 1554 | j < bank->virtual_irq_start + bank->width; j++) { |
1556 | irq_set_lockdep_class(j, &gpio_lock_class); | 1555 | irq_set_lockdep_class(j, &gpio_lock_class); |
1557 | irq_set_chip_data(j, bank); | 1556 | irq_set_chip_data(j, bank); |
1558 | if (bank_is_mpuio(bank)) | 1557 | if (bank_is_mpuio(bank)) |
@@ -1602,7 +1601,7 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1602 | bank->dev = &pdev->dev; | 1601 | bank->dev = &pdev->dev; |
1603 | bank->dbck_flag = pdata->dbck_flag; | 1602 | bank->dbck_flag = pdata->dbck_flag; |
1604 | bank->stride = pdata->bank_stride; | 1603 | bank->stride = pdata->bank_stride; |
1605 | bank_width = pdata->bank_width; | 1604 | bank->width = pdata->bank_width; |
1606 | 1605 | ||
1607 | spin_lock_init(&bank->lock); | 1606 | spin_lock_init(&bank->lock); |
1608 | 1607 | ||