From patchwork Fri Apr 22 23:01:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 728611 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3MN0GIk023013 for ; Fri, 22 Apr 2011 23:00:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755280Ab1DVXAK (ORCPT ); Fri, 22 Apr 2011 19:00:10 -0400 Received: from na3sys009aog116.obsmtp.com ([74.125.149.240]:50000 "EHLO na3sys009aog116.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754333Ab1DVXAI (ORCPT ); Fri, 22 Apr 2011 19:00:08 -0400 Received: from mail-pv0-f176.google.com ([74.125.83.176]) (using TLSv1) by na3sys009aob116.postini.com ([74.125.148.12]) with SMTP ID DSNKTbIIdwuLy6Slg3vpMYs+iaaetkWlkh7I@postini.com; Fri, 22 Apr 2011 16:00:08 PDT Received: by pve37 with SMTP id 37so643365pve.7 for ; Fri, 22 Apr 2011 16:00:07 -0700 (PDT) Received: by 10.68.2.196 with SMTP id 4mr2466381pbw.314.1303513207160; Fri, 22 Apr 2011 16:00:07 -0700 (PDT) Received: from localhost (c-24-18-179-55.hsd1.wa.comcast.net [24.18.179.55]) by mx.google.com with ESMTPS id i1sm2258091pbe.52.2011.04.22.16.00.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Apr 2011 16:00:06 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: charu@ti.com Subject: [PATCH 03/15] OMAP: GPIO: move bank width into struct gpio_bank Date: Fri, 22 Apr 2011 16:01:55 -0700 Message-Id: <1303513327-14532-4-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1303513327-14532-1-git-send-email-khilman@ti.com> References: <1303513327-14532-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 (demeter1.kernel.org [140.211.167.41]); Fri, 22 Apr 2011 23:00:19 +0000 (UTC) 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 --- 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);