From: Kevin Hilman <khilman@ti.com>
To: linux-omap@vger.kernel.org,
Grant Likely <grant.likely@secretlab.ca>,
Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-arm-kernel@lists.infradead.org, Charulatha V <charu@ti.com>
Subject: [PATCH 06/14] GPIO: OMAP: remove get_gpio_bank()
Date: Fri, 20 May 2011 17:14:49 +0200 [thread overview]
Message-ID: <1305904497-26013-7-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1305904497-26013-1-git-send-email-khilman@ti.com>
From: Charulatha V <charu@ti.com>
use chip info to get the pointer to the struct gpio_bank for a
given GPIO bank and remove get_gpio_bank().
Signed-off-by: Charulatha V <charu@ti.com>
---
drivers/gpio/gpio_omap.c | 29 ++---------------------------
1 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/drivers/gpio/gpio_omap.c b/drivers/gpio/gpio_omap.c
index a7767a4..0fdfb84 100644
--- a/drivers/gpio/gpio_omap.c
+++ b/drivers/gpio/gpio_omap.c
@@ -86,31 +86,6 @@ int gpio_bank_count;
#define GPIO_INDEX(bank, gpio) (gpio % bank->width)
#define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
-static inline struct gpio_bank *get_gpio_bank(int gpio)
-{
- if (cpu_is_omap15xx()) {
- if (OMAP_GPIO_IS_MPUIO(gpio))
- return &gpio_bank[0];
- return &gpio_bank[1];
- }
- if (cpu_is_omap16xx()) {
- if (OMAP_GPIO_IS_MPUIO(gpio))
- return &gpio_bank[0];
- return &gpio_bank[1 + (gpio >> 4)];
- }
- if (cpu_is_omap7xx()) {
- if (OMAP_GPIO_IS_MPUIO(gpio))
- return &gpio_bank[0];
- return &gpio_bank[1 + (gpio >> 5)];
- }
- if (cpu_is_omap24xx())
- return &gpio_bank[gpio >> 5];
- if (cpu_is_omap34xx() || cpu_is_omap44xx())
- return &gpio_bank[gpio >> 5];
- BUG();
- return NULL;
-}
-
static inline int gpio_valid(int gpio)
{
if (gpio < 0)
@@ -1266,7 +1241,7 @@ static struct platform_device omap_mpuio_device = {
static inline void mpuio_init(void)
{
- struct gpio_bank *bank = get_gpio_bank(OMAP_MPUIO(0));
+ struct gpio_bank *bank = &gpio_bank[0];
platform_set_drvdata(&omap_mpuio_device, bank);
if (platform_driver_register(&omap_mpuio_driver) == 0)
@@ -1342,7 +1317,7 @@ static int gpio_get(struct gpio_chip *chip, unsigned offset)
u32 mask;
gpio = chip->base + offset;
- bank = get_gpio_bank(gpio);
+ bank = container_of(chip, struct gpio_bank, chip);
reg = bank->base;
mask = GPIO_BIT(bank, gpio);
--
1.7.3.4
next prev parent reply other threads:[~2011-05-20 15:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-20 15:14 [PATCH 00/14] GPIO: OMAP: first round of cleanup Kevin Hilman
2011-05-20 15:14 ` [PATCH 01/14] GPIO: OMAP: _clear_gpio_irqbank: fix flushing of posted write Kevin Hilman
2011-05-20 15:14 ` [PATCH 02/14] GPIO: OMAP: remove MPUIO handling from _clear_gpio_irqbank() Kevin Hilman
2011-05-20 15:14 ` [PATCH 03/14] GPIO: OMAP: move bank width into struct gpio_bank Kevin Hilman
2011-05-20 15:14 ` [PATCH 04/14] GPIO: OMAP: _get_gpio_irqbank_mask: replace hard-coded mask with bank->width Kevin Hilman
2011-05-20 15:14 ` [PATCH 05/14] GPIO: OMAP: replace get_gpio_index() by using bank width Kevin Hilman
2011-05-20 15:14 ` Kevin Hilman [this message]
2011-05-20 15:14 ` [PATCH 07/14] GPIO: OMAP: consolidate direction, input, output, remove #ifdefs Kevin Hilman
2011-05-20 15:14 ` [PATCH 08/14] GPIO: OMAP: consolidate IRQ status handling, " Kevin Hilman
2011-05-20 15:14 ` [PATCH 09/14] GPIO: OMAP: conslidate enable/disable of GPIO IRQs, remove ifdefs Kevin Hilman
2011-05-20 15:14 ` [PATCH 10/14] GPIO: OMAP: convert MPUIO IRQ over to generic irq_chip Kevin Hilman
2011-05-20 15:14 ` [PATCH 11/14] GPIO: OMAP: remove useless gpio_valid() & check_gpio() checks Kevin Hilman
2011-05-20 15:14 ` [PATCH 12/14] GPIO: OMAP: cleanup _set_gpio_wakeup(), remove ifdefs Kevin Hilman
2011-05-20 15:14 ` [PATCH 13/14] GPIO: OMAP: debounce remove SoC specific registers, use pdata Kevin Hilman
2011-05-20 15:14 ` [PATCH 14/14] GPIO: OMAP: cleanup show revision, remove cpu_is checks, display only once Kevin Hilman
2011-05-22 6:28 ` [PATCH 00/14] GPIO: OMAP: first round of cleanup Jean-Christophe PLAGNIOL-VILLARD
2011-05-27 3:24 ` Grant Likely
2011-05-27 15:49 ` Kevin Hilman
2011-06-16 16:07 ` Kevin Hilman
2011-06-16 16:26 ` Grant Likely
2011-06-16 18:16 ` Kevin Hilman
2011-06-16 19:32 ` Grant Likely
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=1305904497-26013-7-git-send-email-khilman@ti.com \
--to=khilman@ti.com \
--cc=charu@ti.com \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.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