From patchwork Wed Apr 23 12:41:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 4040711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67EDB9F319 for ; Wed, 23 Apr 2014 12:44:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74207201EC for ; Wed, 23 Apr 2014 12:44:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BBB72201F7 for ; Wed, 23 Apr 2014 12:44:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcwVK-00050V-Ty; Wed, 23 Apr 2014 12:42:22 +0000 Received: from mail-we0-f175.google.com ([74.125.82.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcwVH-0004Yc-VL for linux-arm-kernel@lists.infradead.org; Wed, 23 Apr 2014 12:42:20 +0000 Received: by mail-we0-f175.google.com with SMTP id q58so795658wes.34 for ; Wed, 23 Apr 2014 05:41:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fNhAAgL+3uT32k/gnxZu3PDMY94l98mpu7dfW/MpVHg=; b=TGZAciWBTj4jGv+KpTMBGRt3SgIjMxuUaDQdDikOq56ZJ+YIVuTgdmn1PSKV7kfWhD P4hy/ao7INSY5tzVmB0eM0VJ7/CUF9jJ4CLmK/1P32taApoir4HSio/Ye4Djsv3ZINNM 3pJ0Xr7EOhpw5VHCdYaHdLQmrXJVA/wBnRKrpnHYDdYdewekmZb9GkWWdtVlLSDIWDRy iReYkdrYZgcjzESm3y3RaiiltF2gtKeaC7F07cOPPaAfWE5n+VMcHqjAakX68w/8ZFhQ b4EODPJvTkupj7drA6m7jKtAk9tZFHgDUUDa50IYZ5wk9Za8EyBs2g1yKTdAWwFn6VMw eHsg== X-Gm-Message-State: ALoCoQkzpkeBIy+SiWSHBWv3vvss7bRRlqYWkd/mZl6w14Zks3YakZ6Y34qvNwVjphxdHQatTsdW X-Received: by 10.180.187.225 with SMTP id fv1mr1748672wic.14.1398256915743; Wed, 23 Apr 2014 05:41:55 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id b2sm4042449wiz.15.2014.04.23.05.41.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Apr 2014 05:41:54 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones Subject: [PATCH 3/4 v2] gpio: tc3589x: get rid of static IRQ and GPIO bases Date: Wed, 23 Apr 2014 14:41:46 +0200 Message-Id: <1398256906-25118-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140423_054220_319224_C0064304 X-CRM114-Status: GOOD ( 18.20 ) X-Spam-Score: 1.8 (+) Cc: linux-gpio@vger.kernel.org, Linus Walleij , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, SUSPICIOUS_RECIPS,UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The static IRQ and GPIO base is not used on any platforms with this chip (only Ux500, only device tree). Get rid of the static assignments forever, and rely on dynamic IRQ and GPIO descriptor allocation. Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Be more thorough, delete all static GPIO and IRQ assignments. Lee/Sam: can you either ACK this small(ish) change so I can take it through the GPIO tree or provide an immutable TC3589x branch including any other TC3589x patches I've written or may have arrived? --- drivers/gpio/gpio-tc3589x.c | 12 ++---------- drivers/mfd/tc3589x.c | 9 +++------ include/linux/mfd/tc3589x.h | 11 ----------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c index 113e50cb1f59..fee8c73cf8c8 100644 --- a/drivers/gpio/gpio-tc3589x.c +++ b/drivers/gpio/gpio-tc3589x.c @@ -32,9 +32,6 @@ struct tc3589x_gpio { struct device *dev; struct mutex irq_lock; struct irq_domain *domain; - - int irq_base; - /* Caches of interrupt control registers for bus_lock */ u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS]; @@ -290,8 +287,6 @@ static struct irq_domain_ops tc3589x_irq_ops = { static int tc3589x_gpio_irq_init(struct tc3589x_gpio *tc3589x_gpio, struct device_node *np) { - int base = tc3589x_gpio->irq_base; - /* * If this results in a linear domain, irq_create_mapping() will * take care of allocating IRQ descriptors at runtime. When a base @@ -299,7 +294,7 @@ static int tc3589x_gpio_irq_init(struct tc3589x_gpio *tc3589x_gpio, * domain is instantiated. */ tc3589x_gpio->domain = irq_domain_add_simple(np, - tc3589x_gpio->chip.ngpio, base, &tc3589x_irq_ops, + tc3589x_gpio->chip.ngpio, 0, &tc3589x_irq_ops, tc3589x_gpio); if (!tc3589x_gpio->domain) { dev_err(tc3589x_gpio->dev, "Failed to create irqdomain\n"); @@ -342,15 +337,12 @@ static int tc3589x_gpio_probe(struct platform_device *pdev) tc3589x_gpio->chip = template_chip; tc3589x_gpio->chip.ngpio = tc3589x->num_gpio; tc3589x_gpio->chip.dev = &pdev->dev; - tc3589x_gpio->chip.base = (pdata) ? pdata->gpio_base : -1; + tc3589x_gpio->chip.base = -1; #ifdef CONFIG_OF_GPIO tc3589x_gpio->chip.of_node = np; #endif - tc3589x_gpio->irq_base = tc3589x->irq_base ? - tc3589x->irq_base + TC3589x_INT_GPIO(0) : 0; - /* Bring the GPIO module out of reset */ ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL, TC3589x_RSTCTRL_GPIRST, 0); diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index bd83accc0f6d..972b00d0220f 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -241,10 +241,8 @@ static struct irq_domain_ops tc3589x_irq_ops = { static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) { - int base = tc3589x->irq_base; - tc3589x->domain = irq_domain_add_simple( - np, TC3589x_NR_INTERNAL_IRQS, base, + np, TC3589x_NR_INTERNAL_IRQS, 0, &tc3589x_irq_ops, tc3589x); if (!tc3589x->domain) { @@ -298,7 +296,7 @@ static int tc3589x_device_init(struct tc3589x *tc3589x) if (blocks & TC3589x_BLOCK_GPIO) { ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio, ARRAY_SIZE(tc3589x_dev_gpio), NULL, - tc3589x->irq_base, tc3589x->domain); + 0, tc3589x->domain); if (ret) { dev_err(tc3589x->dev, "failed to add gpio child\n"); return ret; @@ -309,7 +307,7 @@ static int tc3589x_device_init(struct tc3589x *tc3589x) if (blocks & TC3589x_BLOCK_KEYPAD) { ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad, ARRAY_SIZE(tc3589x_dev_keypad), NULL, - tc3589x->irq_base, tc3589x->domain); + 0, tc3589x->domain); if (ret) { dev_err(tc3589x->dev, "failed to keypad child\n"); return ret; @@ -404,7 +402,6 @@ static int tc3589x_probe(struct i2c_client *i2c, tc3589x->dev = &i2c->dev; tc3589x->i2c = i2c; tc3589x->pdata = pdata; - tc3589x->irq_base = pdata->irq_base; switch (version) { case TC3589X_TC35893: diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h index 6b8e1ff4672b..c07aba9a1a2a 100644 --- a/include/linux/mfd/tc3589x.h +++ b/include/linux/mfd/tc3589x.h @@ -111,15 +111,12 @@ enum tx3589x_block { #define TC3589x_INT_PORIRQ 7 #define TC3589x_NR_INTERNAL_IRQS 8 -#define TC3589x_INT_GPIO(x) (TC3589x_NR_INTERNAL_IRQS + (x)) struct tc3589x { struct mutex lock; struct device *dev; struct i2c_client *i2c; struct irq_domain *domain; - - int irq_base; int num_gpio; struct tc3589x_platform_data *pdata; }; @@ -165,13 +162,10 @@ struct tc3589x_keypad_platform_data { /** * struct tc3589x_gpio_platform_data - TC3589x GPIO platform data - * @gpio_base: first gpio number assigned to TC3589x. A maximum of - * %TC3589x_NR_GPIOS GPIOs will be allocated. * @setup: callback for board-specific initialization * @remove: callback for board-specific teardown */ struct tc3589x_gpio_platform_data { - int gpio_base; void (*setup)(struct tc3589x *tc3589x, unsigned gpio_base); void (*remove)(struct tc3589x *tc3589x, unsigned gpio_base); }; @@ -179,18 +173,13 @@ struct tc3589x_gpio_platform_data { /** * struct tc3589x_platform_data - TC3589x platform data * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) - * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used. * @gpio: GPIO-specific platform data * @keypad: keypad-specific platform data */ struct tc3589x_platform_data { unsigned int block; - int irq_base; struct tc3589x_gpio_platform_data *gpio; const struct tc3589x_keypad_platform_data *keypad; }; -#define TC3589x_NR_GPIOS 24 -#define TC3589x_NR_IRQS TC3589x_INT_GPIO(TC3589x_NR_GPIOS) - #endif