From patchwork Fri May 20 15:14:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 803962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4KFFQkA009826 for ; Fri, 20 May 2011 15:15:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933606Ab1ETPPX (ORCPT ); Fri, 20 May 2011 11:15:23 -0400 Received: from na3sys009aog111.obsmtp.com ([74.125.149.205]:55557 "EHLO na3sys009aog111.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933413Ab1ETPPV (ORCPT ); Fri, 20 May 2011 11:15:21 -0400 Received: from mail-ww0-f51.google.com ([74.125.82.51]) (using TLSv1) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKTdaFiLTZPWsTIBXfjeY/dpjdhzinWGc2@postini.com; Fri, 20 May 2011 08:15:21 PDT Received: by mail-ww0-f51.google.com with SMTP id 26so3226600wwf.20 for ; Fri, 20 May 2011 08:15:20 -0700 (PDT) Received: by 10.216.237.136 with SMTP id y8mr700355weq.76.1305904520595; Fri, 20 May 2011 08:15:20 -0700 (PDT) Received: from localhost ([192.91.60.233]) by mx.google.com with ESMTPS id y29sm2351712wbd.55.2011.05.20.08.15.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 May 2011 08:15:19 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org, Grant Likely , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, Charulatha V Subject: [PATCH 06/14] GPIO: OMAP: remove get_gpio_bank() Date: Fri, 20 May 2011 17:14:49 +0200 Message-Id: <1305904497-26013-7-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1305904497-26013-1-git-send-email-khilman@ti.com> References: <1305904497-26013-1-git-send-email-khilman@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 20 May 2011 15:15:26 +0000 (UTC) From: Charulatha V 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 --- 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);