From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512404; cv=none; d=zohomail.com; s=zohoarc; b=nqGfXS7tSbbqBrb/pVF1HiCutuQy0PygdBM1h80kUWne7fasQnryV+Gf8YU2G7CUotmJO4wcHnsk4K9ohpNa2lSqcpSevBRe0Ax8r3553SCXguiFG3Q39wT4brIrt6u1tcds16n/Epb72UNGMLLVM7rpJzAio7+dztll+Vp6ejk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512404; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=MeAaehzU5jX+Y31M8ISgyWDTvBZM7hVZBTAtcfUrJDw=; b=MT6PkUseTceQX9rK7GbVuZJGKBjwLWHcmYcazsZ/+3wMEqvTxMFp0bakV+vbJJEMtXWAxMwqxZjhOTB3p1le6UCe4Advwjd99LGJncNba1mnIHooQOpATJfAqiKIjGrqQG/dxPXVWze/W1j//SfV6O+QPrtUK/IciyH4Crj6XSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512404019353.47621719221024; Fri, 5 Feb 2021 00:06:44 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbhBEIG0 (ORCPT ); Fri, 5 Feb 2021 03:06:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbhBEIGA (ORCPT ); Fri, 5 Feb 2021 03:06:00 -0500 Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 408BFC061786; Fri, 5 Feb 2021 00:05:19 -0800 (PST) Received: from forward101q.mail.yandex.net (forward101q.mail.yandex.net [IPv6:2a02:6b8:c0e:4b:0:640:4012:bb98]) by forward100p.mail.yandex.net (Yandex) with ESMTP id D6D235982E0B; Fri, 5 Feb 2021 11:05:15 +0300 (MSK) Received: from vla1-ce2e345b2df9.qloud-c.yandex.net (vla1-ce2e345b2df9.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:3609:0:640:ce2e:345b]) by forward101q.mail.yandex.net (Yandex) with ESMTP id D235ACF40007; Fri, 5 Feb 2021 11:05:15 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-ce2e345b2df9.qloud-c.yandex.net (mxback/Yandex) with ESMTP id jUZApgPp6V-5FI0VE0S; Fri, 05 Feb 2021 11:05:15 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5En8GQxu; Fri, 05 Feb 2021 11:05:15 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512315; bh=MeAaehzU5jX+Y31M8ISgyWDTvBZM7hVZBTAtcfUrJDw=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=Ij9QbLnmeCc7Dl8b0jENRfKXCPyzTj0GgSemhrKZvGWv9D2vxmq5c1ApQVAkcrdgQ wPAzNYFZYP6GsOZkoElQFO1sGhTwC9/FcIWqUU26iKhV6d5u9oMgZhfN5kR+aGjGs6 YE031dfpEw+kN6K5pCKeh0B9buBHxI7OOHczkidk= Authentication-Results: vla1-ce2e345b2df9.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/7] gpio: gpio-ep93xx: fix BUG_ON port F usage Date: Fri, 5 Feb 2021 11:05:01 +0300 Message-Id: <20210205080507.16007-2-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Two index spaces and ep93xx_gpio_port conversion are confusing. Instead add a separate struct to store necessary data and remove ep93xx_gpio_port. - add struct to store IRQ related data for each IRQ capable chip - replace offset array with defined offsets - add IRQ registers offset for each IRQ capable chip into ep93xx_gpio_banks ------------[ cut here ]------------ kernel BUG at drivers/gpio/gpio-ep93xx.c:64! ---[ end trace 3f6544e133e9f5ae ]--- Fixes: fd935fc421e74 ("gpio: ep93xx: Do not pingpong irq numbers") Signed-off-by: Nikita Shubin --- v3->v4: - drop ep93xx_gpio_port - embed IRQ data into struct ep93xx_gpio_irq_chip,=20 which also contains offset of specific IRQ - allocate ep93xx_gpio_irq_chip for IRQ capable gpiochips - drop offset arrays - add IRQ register offsets defines - add IRQ chip offset to ep93xx_gpio_banks --- drivers/gpio/gpio-ep93xx.c | 186 ++++++++++++++++++++----------------- 1 file changed, 99 insertions(+), 87 deletions(-) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 226da8df6f10..e3b5e2c37259 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -25,6 +25,9 @@ /* Maximum value for gpio line identifiers */ #define EP93XX_GPIO_LINE_MAX 63 =20 +/* Number of GPIO chips in EP93XX */ +#define EP93XX_GPIO_CHIP_NUM 8 + /* Maximum value for irq capable line identifiers */ #define EP93XX_GPIO_LINE_MAX_IRQ 23 =20 @@ -34,74 +37,74 @@ */ #define EP93XX_GPIO_F_IRQ_BASE 80 =20 -struct ep93xx_gpio { - void __iomem *base; - struct gpio_chip gc[8]; +struct ep93xx_gpio_irq_chip { + u8 irq_offset; + u8 int_unmasked; + u8 int_enabled; + u8 int_type1; + u8 int_type2; + u8 int_debounce; }; =20 -/************************************************************************* - * Interrupt handling for EP93xx on-chip GPIOs - *************************************************************************/ -static unsigned char gpio_int_unmasked[3]; -static unsigned char gpio_int_enabled[3]; -static unsigned char gpio_int_type1[3]; -static unsigned char gpio_int_type2[3]; -static unsigned char gpio_int_debounce[3]; - -/* Port ordering is: A B F */ -static const u8 int_type1_register_offset[3] =3D { 0x90, 0xac, 0x4c }; -static const u8 int_type2_register_offset[3] =3D { 0x94, 0xb0, 0x50 }; -static const u8 eoi_register_offset[3] =3D { 0x98, 0xb4, 0x54 }; -static const u8 int_en_register_offset[3] =3D { 0x9c, 0xb8, 0x58 }; -static const u8 int_debounce_register_offset[3] =3D { 0xa8, 0xc4, 0x64 }; - -static void ep93xx_gpio_update_int_params(struct ep93xx_gpio *epg, unsigne= d port) -{ - BUG_ON(port > 2); +struct ep93xx_gpio_chip { + struct gpio_chip gc; + struct ep93xx_gpio_irq_chip *eic; +}; =20 - writeb_relaxed(0, epg->base + int_en_register_offset[port]); +struct ep93xx_gpio { + void __iomem *base; + struct ep93xx_gpio_chip gc[EP93XX_GPIO_CHIP_NUM]; +}; =20 - writeb_relaxed(gpio_int_type2[port], - epg->base + int_type2_register_offset[port]); +#define to_ep93xx_gpio_chip(x) container_of(x, struct ep93xx_gpio_chip, gc) =20 - writeb_relaxed(gpio_int_type1[port], - epg->base + int_type1_register_offset[port]); +struct ep93xx_gpio_irq_chip *to_ep93xx_gpio_irq_chip(struct gpio_chip *gc) +{ + struct ep93xx_gpio_chip *egc =3D to_ep93xx_gpio_chip(gc); =20 - writeb(gpio_int_unmasked[port] & gpio_int_enabled[port], - epg->base + int_en_register_offset[port]); + return egc->eic; } =20 -static int ep93xx_gpio_port(struct gpio_chip *gc) +/************************************************************************* + * Interrupt handling for EP93xx on-chip GPIOs + *************************************************************************/ +#define EP93XX_INT_TYPE1_OFFSET 0x00 +#define EP93XX_INT_TYPE2_OFFSET 0x04 +#define EP93XX_INT_EOI_OFFSET 0x08 +#define EP93XX_INT_EN_OFFSET 0x0c +#define EP93XX_INT_STATUS_OFFSET 0x10 +#define EP93XX_INT_RAW_STATUS_OFFSET 0x14 +#define EP93XX_INT_DEBOUNCE_OFFSET 0x18 + +static void ep93xx_gpio_update_int_params(struct ep93xx_gpio *epg, + struct ep93xx_gpio_irq_chip *eic) { - struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D 0; + writeb_relaxed(0, epg->base + eic->irq_offset + EP93XX_INT_EN_OFFSET); =20 - while (port < ARRAY_SIZE(epg->gc) && gc !=3D &epg->gc[port]) - port++; + writeb_relaxed(eic->int_type2, + epg->base + eic->irq_offset + EP93XX_INT_TYPE2_OFFSET); =20 - /* This should not happen but is there as a last safeguard */ - if (port =3D=3D ARRAY_SIZE(epg->gc)) { - pr_crit("can't find the GPIO port\n"); - return 0; - } + writeb_relaxed(eic->int_type1, + epg->base + eic->irq_offset + EP93XX_INT_TYPE1_OFFSET); =20 - return port; + writeb_relaxed(eic->int_unmasked & eic->int_enabled, + epg->base + eic->irq_offset + EP93XX_INT_EN_OFFSET); } =20 static void ep93xx_gpio_int_debounce(struct gpio_chip *gc, unsigned int offset, bool enable) { struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D ep93xx_gpio_port(gc); + struct ep93xx_gpio_irq_chip *eic =3D to_ep93xx_gpio_irq_chip(gc); int port_mask =3D BIT(offset); =20 if (enable) - gpio_int_debounce[port] |=3D port_mask; + eic->int_debounce |=3D port_mask; else - gpio_int_debounce[port] &=3D ~port_mask; + eic->int_debounce &=3D ~port_mask; =20 - writeb(gpio_int_debounce[port], - epg->base + int_debounce_register_offset[port]); + writeb(eic->int_debounce, + epg->base + eic->irq_offset + EP93XX_INT_DEBOUNCE_OFFSET); } =20 static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc) @@ -122,12 +125,12 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_des= c *desc) */ stat =3D readb(epg->base + EP93XX_GPIO_A_INT_STATUS); for_each_set_bit(offset, &stat, 8) - generic_handle_irq(irq_find_mapping(epg->gc[0].irq.domain, + generic_handle_irq(irq_find_mapping(epg->gc[0].gc.irq.domain, offset)); =20 stat =3D readb(epg->base + EP93XX_GPIO_B_INT_STATUS); for_each_set_bit(offset, &stat, 8) - generic_handle_irq(irq_find_mapping(epg->gc[1].irq.domain, + generic_handle_irq(irq_find_mapping(epg->gc[1].gc.irq.domain, offset)); =20 chained_irq_exit(irqchip, desc); @@ -153,52 +156,52 @@ static void ep93xx_gpio_f_irq_handler(struct irq_desc= *desc) static void ep93xx_gpio_irq_ack(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + struct ep93xx_gpio_irq_chip *eic =3D to_ep93xx_gpio_irq_chip(gc); struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D ep93xx_gpio_port(gc); int port_mask =3D BIT(d->irq & 7); =20 if (irqd_get_trigger_type(d) =3D=3D IRQ_TYPE_EDGE_BOTH) { - gpio_int_type2[port] ^=3D port_mask; /* switch edge direction */ - ep93xx_gpio_update_int_params(epg, port); + eic->int_type2 ^=3D port_mask; /* switch edge direction */ + ep93xx_gpio_update_int_params(epg, eic); } =20 - writeb(port_mask, epg->base + eoi_register_offset[port]); + writeb(port_mask, epg->base + eic->irq_offset + EP93XX_INT_EOI_OFFSET); } =20 static void ep93xx_gpio_irq_mask_ack(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + struct ep93xx_gpio_irq_chip *eic =3D to_ep93xx_gpio_irq_chip(gc); struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D ep93xx_gpio_port(gc); int port_mask =3D BIT(d->irq & 7); =20 if (irqd_get_trigger_type(d) =3D=3D IRQ_TYPE_EDGE_BOTH) - gpio_int_type2[port] ^=3D port_mask; /* switch edge direction */ + eic->int_type2 ^=3D port_mask; /* switch edge direction */ =20 - gpio_int_unmasked[port] &=3D ~port_mask; - ep93xx_gpio_update_int_params(epg, port); + eic->int_unmasked &=3D ~port_mask; + ep93xx_gpio_update_int_params(epg, eic); =20 - writeb(port_mask, epg->base + eoi_register_offset[port]); + writeb(port_mask, epg->base + eic->irq_offset + EP93XX_INT_EOI_OFFSET); } =20 static void ep93xx_gpio_irq_mask(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + struct ep93xx_gpio_irq_chip *eic =3D to_ep93xx_gpio_irq_chip(gc); struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D ep93xx_gpio_port(gc); =20 - gpio_int_unmasked[port] &=3D ~BIT(d->irq & 7); - ep93xx_gpio_update_int_params(epg, port); + eic->int_unmasked &=3D ~BIT(d->irq & 7); + ep93xx_gpio_update_int_params(epg, eic); } =20 static void ep93xx_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + struct ep93xx_gpio_irq_chip *eic =3D to_ep93xx_gpio_irq_chip(gc); struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D ep93xx_gpio_port(gc); =20 - gpio_int_unmasked[port] |=3D BIT(d->irq & 7); - ep93xx_gpio_update_int_params(epg, port); + eic->int_unmasked |=3D BIT(d->irq & 7); + ep93xx_gpio_update_int_params(epg, eic); } =20 /* @@ -209,8 +212,8 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d) static int ep93xx_gpio_irq_type(struct irq_data *d, unsigned int type) { struct gpio_chip *gc =3D irq_data_get_irq_chip_data(d); + struct ep93xx_gpio_irq_chip *eic =3D to_ep93xx_gpio_irq_chip(gc); struct ep93xx_gpio *epg =3D gpiochip_get_data(gc); - int port =3D ep93xx_gpio_port(gc); int offset =3D d->irq & 7; int port_mask =3D BIT(offset); irq_flow_handler_t handler; @@ -219,32 +222,32 @@ static int ep93xx_gpio_irq_type(struct irq_data *d, u= nsigned int type) =20 switch (type) { case IRQ_TYPE_EDGE_RISING: - gpio_int_type1[port] |=3D port_mask; - gpio_int_type2[port] |=3D port_mask; + eic->int_type1 |=3D port_mask; + eic->int_type2 |=3D port_mask; handler =3D handle_edge_irq; break; case IRQ_TYPE_EDGE_FALLING: - gpio_int_type1[port] |=3D port_mask; - gpio_int_type2[port] &=3D ~port_mask; + eic->int_type1 |=3D port_mask; + eic->int_type2 &=3D ~port_mask; handler =3D handle_edge_irq; break; case IRQ_TYPE_LEVEL_HIGH: - gpio_int_type1[port] &=3D ~port_mask; - gpio_int_type2[port] |=3D port_mask; + eic->int_type1 &=3D ~port_mask; + eic->int_type2 |=3D port_mask; handler =3D handle_level_irq; break; case IRQ_TYPE_LEVEL_LOW: - gpio_int_type1[port] &=3D ~port_mask; - gpio_int_type2[port] &=3D ~port_mask; + eic->int_type1 &=3D ~port_mask; + eic->int_type2 &=3D ~port_mask; handler =3D handle_level_irq; break; case IRQ_TYPE_EDGE_BOTH: - gpio_int_type1[port] |=3D port_mask; + eic->int_type1 |=3D port_mask; /* set initial polarity based on current input level */ if (gc->get(gc, offset)) - gpio_int_type2[port] &=3D ~port_mask; /* falling */ + eic->int_type2 &=3D ~port_mask; /* falling */ else - gpio_int_type2[port] |=3D port_mask; /* rising */ + eic->int_type2 |=3D port_mask; /* rising */ handler =3D handle_edge_irq; break; default: @@ -253,9 +256,9 @@ static int ep93xx_gpio_irq_type(struct irq_data *d, uns= igned int type) =20 irq_set_handler_locked(d, handler); =20 - gpio_int_enabled[port] |=3D port_mask; + eic->int_enabled |=3D port_mask; =20 - ep93xx_gpio_update_int_params(epg, port); + ep93xx_gpio_update_int_params(epg, eic); =20 return 0; } @@ -276,17 +279,19 @@ struct ep93xx_gpio_bank { const char *label; int data; int dir; + int irq; int base; bool has_irq; bool has_hierarchical_irq; unsigned int irq_base; }; =20 -#define EP93XX_GPIO_BANK(_label, _data, _dir, _base, _has_irq, _has_hier, = _irq_base) \ +#define EP93XX_GPIO_BANK(_label, _data, _dir, _irq, _base, _has_irq, _has_= hier, _irq_base) \ { \ .label =3D _label, \ .data =3D _data, \ .dir =3D _dir, \ + .irq =3D _irq, \ .base =3D _base, \ .has_irq =3D _has_irq, \ .has_hierarchical_irq =3D _has_hier, \ @@ -295,16 +300,16 @@ struct ep93xx_gpio_bank { =20 static struct ep93xx_gpio_bank ep93xx_gpio_banks[] =3D { /* Bank A has 8 IRQs */ - EP93XX_GPIO_BANK("A", 0x00, 0x10, 0, true, false, 64), + EP93XX_GPIO_BANK("A", 0x00, 0x10, 0x90, 0, true, false, 64), /* Bank B has 8 IRQs */ - EP93XX_GPIO_BANK("B", 0x04, 0x14, 8, true, false, 72), - EP93XX_GPIO_BANK("C", 0x08, 0x18, 40, false, false, 0), - EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 24, false, false, 0), - EP93XX_GPIO_BANK("E", 0x20, 0x24, 32, false, false, 0), + EP93XX_GPIO_BANK("B", 0x04, 0x14, 0xac, 8, true, false, 72), + EP93XX_GPIO_BANK("C", 0x08, 0x18, 0x00, 40, false, false, 0), + EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 0x00, 24, false, false, 0), + EP93XX_GPIO_BANK("E", 0x20, 0x24, 0x00, 32, false, false, 0), /* Bank F has 8 IRQs */ - EP93XX_GPIO_BANK("F", 0x30, 0x34, 16, false, true, 0), - EP93XX_GPIO_BANK("G", 0x38, 0x3c, 48, false, false, 0), - EP93XX_GPIO_BANK("H", 0x40, 0x44, 56, false, false, 0), + EP93XX_GPIO_BANK("F", 0x30, 0x34, 0x4c, 16, false, true, 0), + EP93XX_GPIO_BANK("G", 0x38, 0x3c, 0x00, 48, false, false, 0), + EP93XX_GPIO_BANK("H", 0x40, 0x44, 0x00, 56, false, false, 0), }; =20 static int ep93xx_gpio_set_config(struct gpio_chip *gc, unsigned offset, @@ -326,13 +331,14 @@ static int ep93xx_gpio_f_to_irq(struct gpio_chip *gc,= unsigned offset) return EP93XX_GPIO_F_IRQ_BASE + offset; } =20 -static int ep93xx_gpio_add_bank(struct gpio_chip *gc, +static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip *egc, struct platform_device *pdev, struct ep93xx_gpio *epg, struct ep93xx_gpio_bank *bank) { void __iomem *data =3D epg->base + bank->data; void __iomem *dir =3D epg->base + bank->dir; + struct gpio_chip *gc =3D &egc->gc; struct device *dev =3D &pdev->dev; struct gpio_irq_chip *girq; int err; @@ -347,6 +353,12 @@ static int ep93xx_gpio_add_bank(struct gpio_chip *gc, girq =3D &gc->irq; if (bank->has_irq || bank->has_hierarchical_irq) { gc->set_config =3D ep93xx_gpio_set_config; + egc->eic =3D devm_kcalloc(dev, 1, + sizeof(*egc->eic), + GFP_KERNEL); + if (!egc->eic) + return -ENOMEM; + egc->eic->irq_offset =3D bank->irq; girq->chip =3D &ep93xx_gpio_irq_chip; } =20 @@ -415,7 +427,7 @@ static int ep93xx_gpio_probe(struct platform_device *pd= ev) return PTR_ERR(epg->base); =20 for (i =3D 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) { - struct gpio_chip *gc =3D &epg->gc[i]; + struct ep93xx_gpio_chip *gc =3D &epg->gc[i]; struct ep93xx_gpio_bank *bank =3D &ep93xx_gpio_banks[i]; =20 if (ep93xx_gpio_add_bank(gc, pdev, epg, bank)) --=20 2.26.2 From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512403; cv=none; d=zohomail.com; s=zohoarc; b=U2sE+0dSQNRx/+71Zj+jomYWCc2vvYrAotRQdWwiUShPbNxThlG1DxZhmPEi73XuqE0tGi/R9M73tHvF+jY2qsMxccnB95M+5D+AaW1uw8D8HEq5Qs/4GV3rBE5bN1ANM4424SNSbw/ZtesU7lWObpLzb3qcDJ4qbOpnHIU5glU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512403; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=JPTXGO5bMF41hdHAoaK/g/DYbPxZx1DNYfpjY6Od3C0=; b=cuBvDVaORswvqEpKm3p+3JDO3PyjNBTvYxER7eeNqjI7ksrjVS1vb7MaqkIECZtGKtW7zxZCD2oPdPgm90afLDGjOMlSQ8CS1AVKX1g4iZaRXHRU4IVF3kguzwVeUD9K3ZVHdpH4w2IR0FdH3SGhvWPbvQTeh2FPO7AJx/Y9gpI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512403730735.8376322303476; Fri, 5 Feb 2021 00:06:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231428AbhBEIGK (ORCPT ); Fri, 5 Feb 2021 03:06:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231148AbhBEIGA (ORCPT ); Fri, 5 Feb 2021 03:06:00 -0500 Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::107]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B0D4C06178A; Fri, 5 Feb 2021 00:05:19 -0800 (PST) Received: from forward103q.mail.yandex.net (forward103q.mail.yandex.net [IPv6:2a02:6b8:c0e:50:0:640:b21c:d009]) by forward104j.mail.yandex.net (Yandex) with ESMTP id C94ED4A35B2; Fri, 5 Feb 2021 11:05:16 +0300 (MSK) Received: from vla1-7d66b24b62b3.qloud-c.yandex.net (vla1-7d66b24b62b3.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:360d:0:640:7d66:b24b]) by forward103q.mail.yandex.net (Yandex) with ESMTP id C1BF961E0008; Fri, 5 Feb 2021 11:05:16 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-7d66b24b62b3.qloud-c.yandex.net (mxback/Yandex) with ESMTP id ARjQYZbpdq-5GIi5ll7; Fri, 05 Feb 2021 11:05:16 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5Gn8UpBD; Fri, 05 Feb 2021 11:05:16 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512316; bh=JPTXGO5bMF41hdHAoaK/g/DYbPxZx1DNYfpjY6Od3C0=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=AOisBGI1HVCQ5Szt40XevfiNU724Dz+GXL3JnrIrbTHy93OkzgrpwDsabM1PEhCBv TrhSUnHBV0GPHe4arq1cLIU73zV+QgdP88y84Zx6Ot+KfL6wkgcSMdskkGJtkUAAmB u5oYzBOS4npyFvl72OYN1ZxxEZ2eowjMaoflgQs4= Authentication-Results: vla1-7d66b24b62b3.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/7] gpio: gpio-ep93xx: Fix single irqchip with multi gpiochips Date: Fri, 5 Feb 2021 11:05:02 +0300 Message-Id: <20210205080507.16007-3-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Fixes the following warnings which results in interrupts disabled on port B/F: gpio gpiochip1: (B): detected irqchip that is shared with multiple gpiochip= s: please fix the driver. gpio gpiochip5: (F): detected irqchip that is shared with multiple gpiochip= s: please fix the driver. - added separate irqchip for each interrupt capable gpiochip - provided unique names for each irqchip Fixes: d2b091961510 ("gpio: ep93xx: Pass irqchip when adding gpiochip") Signed-off-by: Nikita Shubin --- drivers/gpio/gpio-ep93xx.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index e3b5e2c37259..3c9f7233e62d 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -38,6 +38,7 @@ #define EP93XX_GPIO_F_IRQ_BASE 80 =20 struct ep93xx_gpio_irq_chip { + struct irq_chip ic; u8 irq_offset; u8 int_unmasked; u8 int_enabled; @@ -284,9 +285,11 @@ struct ep93xx_gpio_bank { bool has_irq; bool has_hierarchical_irq; unsigned int irq_base; + const char *irq_name; }; =20 -#define EP93XX_GPIO_BANK(_label, _data, _dir, _irq, _base, _has_irq, _has_= hier, _irq_base) \ +#define EP93XX_GPIO_BANK(_label, _data, _dir, _irq, _base, _has_irq, _has_= hier, _irq_base, \ +_irq_name) \ { \ .label =3D _label, \ .data =3D _data, \ @@ -296,20 +299,21 @@ struct ep93xx_gpio_bank { .has_irq =3D _has_irq, \ .has_hierarchical_irq =3D _has_hier, \ .irq_base =3D _irq_base, \ + .irq_name =3D _irq_name, \ } =20 static struct ep93xx_gpio_bank ep93xx_gpio_banks[] =3D { /* Bank A has 8 IRQs */ - EP93XX_GPIO_BANK("A", 0x00, 0x10, 0x90, 0, true, false, 64), + EP93XX_GPIO_BANK("A", 0x00, 0x10, 0x90, 0, true, false, 64, "gpio-irq-a"), /* Bank B has 8 IRQs */ - EP93XX_GPIO_BANK("B", 0x04, 0x14, 0xac, 8, true, false, 72), - EP93XX_GPIO_BANK("C", 0x08, 0x18, 0x00, 40, false, false, 0), - EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 0x00, 24, false, false, 0), - EP93XX_GPIO_BANK("E", 0x20, 0x24, 0x00, 32, false, false, 0), + EP93XX_GPIO_BANK("B", 0x04, 0x14, 0xac, 8, true, false, 72, "gpio-irq-b"), + EP93XX_GPIO_BANK("C", 0x08, 0x18, 0x00, 40, false, false, 0, 0), + EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 0x00, 24, false, false, 0, 0), + EP93XX_GPIO_BANK("E", 0x20, 0x24, 0x00, 32, false, false, 0, 0), /* Bank F has 8 IRQs */ - EP93XX_GPIO_BANK("F", 0x30, 0x34, 0x4c, 16, false, true, 0), - EP93XX_GPIO_BANK("G", 0x38, 0x3c, 0x00, 48, false, false, 0), - EP93XX_GPIO_BANK("H", 0x40, 0x44, 0x00, 56, false, false, 0), + EP93XX_GPIO_BANK("F", 0x30, 0x34, 0x4c, 16, false, true, 0, "gpio-irq-b"), + EP93XX_GPIO_BANK("G", 0x38, 0x3c, 0x00, 48, false, false, 0, 0), + EP93XX_GPIO_BANK("H", 0x40, 0x44, 0x00, 56, false, false, 0, 0), }; =20 static int ep93xx_gpio_set_config(struct gpio_chip *gc, unsigned offset, @@ -331,6 +335,16 @@ static int ep93xx_gpio_f_to_irq(struct gpio_chip *gc, = unsigned offset) return EP93XX_GPIO_F_IRQ_BASE + offset; } =20 +static void ep93xx_init_irq_chip(struct irq_chip *ic, const char *irq_name) +{ + ic->name =3D irq_name; + ic->irq_ack =3D ep93xx_gpio_irq_ack; + ic->irq_mask_ack =3D ep93xx_gpio_irq_mask_ack; + ic->irq_mask =3D ep93xx_gpio_irq_mask; + ic->irq_unmask =3D ep93xx_gpio_irq_unmask; + ic->irq_set_type =3D ep93xx_gpio_irq_type; +} + static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip *egc, struct platform_device *pdev, struct ep93xx_gpio *epg, @@ -352,6 +366,8 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, =20 girq =3D &gc->irq; if (bank->has_irq || bank->has_hierarchical_irq) { + struct irq_chip *ic; + gc->set_config =3D ep93xx_gpio_set_config; egc->eic =3D devm_kcalloc(dev, 1, sizeof(*egc->eic), @@ -359,7 +375,9 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, if (!egc->eic) return -ENOMEM; egc->eic->irq_offset =3D bank->irq; - girq->chip =3D &ep93xx_gpio_irq_chip; + ic =3D &egc->eic->ic; + ep93xx_init_irq_chip(ic, bank->irq_name); + girq->chip =3D ic; } =20 if (bank->has_irq) { --=20 2.26.2 From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512403; cv=none; d=zohomail.com; s=zohoarc; b=fnxkuBAN5l9LpIJDOjRWiMPA585k7erDqApPt7ptFQZkmWW/F6eE5ENs71Uj6FX97P7lQ1WnDtEb/ktCI2EaebqHvU5jjYCXN8lafyZ0cErYoQx1eEPhPMalxaCX89++iwcKQ5iF0RtorOdMqcGKE+lNIrNjMKdigROaOi0oPgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512403; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=L3i2GMpCyjFi2r2lWDiygR7hyvUJiR70+wZlbupXrw4=; b=U8ngfaM1Of2Reyz2k2JA4goNwseAilspGq+ZG3wLgD8dMUGcG4pz40SNhPXiwz42s/m+PmUihf7hhGBCYFhJAIW81hAVNzgBpam1CiMGeA1xc6Y/4QSc8t6KDQMJbz8qaJ25A5a453rbBrIV6oA5lbLgJ+JapHEnyO4vVrAswUI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512403437742.2944037905772; Fri, 5 Feb 2021 00:06:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231335AbhBEIGG (ORCPT ); Fri, 5 Feb 2021 03:06:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbhBEIGA (ORCPT ); Fri, 5 Feb 2021 03:06:00 -0500 Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97EE3C06178B; Fri, 5 Feb 2021 00:05:19 -0800 (PST) Received: from forward102q.mail.yandex.net (forward102q.mail.yandex.net [IPv6:2a02:6b8:c0e:1ba:0:640:516:4e7d]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 846F31D42DC7; Fri, 5 Feb 2021 11:05:17 +0300 (MSK) Received: from vla1-2e2fe8fd096a.qloud-c.yandex.net (vla1-2e2fe8fd096a.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:3495:0:640:2e2f:e8fd]) by forward102q.mail.yandex.net (Yandex) with ESMTP id 803C23A20002; Fri, 5 Feb 2021 11:05:17 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-2e2fe8fd096a.qloud-c.yandex.net (mxback/Yandex) with ESMTP id kq3TvhGqOL-5HI4TAcp; Fri, 05 Feb 2021 11:05:17 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5Gn8ZJw6; Fri, 05 Feb 2021 11:05:17 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512317; bh=L3i2GMpCyjFi2r2lWDiygR7hyvUJiR70+wZlbupXrw4=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=bKMBPtC1fMKSDNbS5HIRqxJIkORcpOoor9qm/DMFyEj865JxHfowdZMTIYwUQBZ/S eC2OTY13u+pF24ia9LjQT2NC6WeBSMJLdSvhWr8zBBeauxH97ZSlTwmeAzBXCyFcEc jNSDA+zJchNPm1hcTr0bfWSrkp8gSpF/dDgRGE0s= Authentication-Results: vla1-2e2fe8fd096a.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/7] gpio: gpio-ep93xx: Fix wrong irq numbers in port F Date: Fri, 5 Feb 2021 11:05:03 +0300 Message-Id: <20210205080507.16007-4-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Port F irq's should be statically mapped to EP93XX_GPIO_F_IRQ_BASE. So we need to specify girq->first otherwise: "If device tree is used, then first_irq will be 0 and irqs get mapped dynamically on the fly" And that's not the thing we want. Signed-off-by: Nikita Shubin --- drivers/gpio/gpio-ep93xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 3c9f7233e62d..38eeaa5c0e1e 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -426,6 +426,7 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, girq->default_type =3D IRQ_TYPE_NONE; girq->handler =3D handle_level_irq; gc->to_irq =3D ep93xx_gpio_f_to_irq; + girq->first =3D EP93XX_GPIO_F_IRQ_BASE; } =20 return devm_gpiochip_add_data(dev, gc, epg); --=20 2.26.2 From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512451; cv=none; d=zohomail.com; s=zohoarc; b=AKAktnvbqadZkg9o3A2bJcandrSJ2y1r+4F0/VHJe/VwQZCKys5z+nu+vXcuyJTis3Uh/X+ywcma46Bza9kx9Rw403qkfDrL2O81Hgrz3Ph2BVlkJJ/HWmktUeEKko2ZnNB9viVBV78vQyFShYZAP7osCv1TrpWufFO8+dph2Is= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512451; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=+WtcWBh58n5WNwBJ+Z/NkhGBdSYSmclbOjEUFB/CcOE=; b=QaSUfn7PRp3D6/j2aGPQIKJALO4ed2LVSyhGvmOOzUzAQK76qESvtSD6EM0ihpwR0aB1m7DfmMeT0PgI1EvWmOJgVwGiytRbQGOUg9YI387EOXun09EaoCNMJJv9YJtBcQrs8jCNXGfN8ciYae+i9kCKFzk4iPioKfBTaK7EnT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512451725271.6820080442245; Fri, 5 Feb 2021 00:07:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbhBEIGj (ORCPT ); Fri, 5 Feb 2021 03:06:39 -0500 Received: from forward101o.mail.yandex.net ([37.140.190.181]:57780 "EHLO forward101o.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbhBEIGC (ORCPT ); Fri, 5 Feb 2021 03:06:02 -0500 Received: from forward100q.mail.yandex.net (forward100q.mail.yandex.net [IPv6:2a02:6b8:c0e:4b:0:640:4012:bb97]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 5B7D73C03740; Fri, 5 Feb 2021 11:05:18 +0300 (MSK) Received: from vla1-ae662a693c21.qloud-c.yandex.net (vla1-ae662a693c21.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:2915:0:640:ae66:2a69]) by forward100q.mail.yandex.net (Yandex) with ESMTP id 575C77080009; Fri, 5 Feb 2021 11:05:18 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-ae662a693c21.qloud-c.yandex.net (mxback/Yandex) with ESMTP id iilsBm1FJI-5IHmpm7V; Fri, 05 Feb 2021 11:05:18 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5Hn8rYH6; Fri, 05 Feb 2021 11:05:17 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512318; bh=+WtcWBh58n5WNwBJ+Z/NkhGBdSYSmclbOjEUFB/CcOE=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=ahbC8NAwD+LjDX/63GTuQdw9YYfH/toKKnlgWpEsD0B2XSymcNJw3T/G6oYG+W426 315h16PCAbsPcaxByKccKIcyYAM4BtfNZfInwFf+22qe5tSbWNCoqp+ClgbOSIVjP3 NxI7kOTPaZSXAp8RqHx+juTqhhenuyl3Z7AZ/BCg= Authentication-Results: vla1-ae662a693c21.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 4/7] gpio: ep93xx: drop to_irq binding Date: Fri, 5 Feb 2021 11:05:04 +0300 Message-Id: <20210205080507.16007-5-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" As ->to_irq is redefined in gpiochip_add_irqchip, having it defined in driver is useless, so let's drop it. Signed-off-by: Nikita Shubin --- drivers/gpio/gpio-ep93xx.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 38eeaa5c0e1e..6208a8010ff5 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -330,11 +330,6 @@ static int ep93xx_gpio_set_config(struct gpio_chip *gc= , unsigned offset, return 0; } =20 -static int ep93xx_gpio_f_to_irq(struct gpio_chip *gc, unsigned offset) -{ - return EP93XX_GPIO_F_IRQ_BASE + offset; -} - static void ep93xx_init_irq_chip(struct irq_chip *ic, const char *irq_name) { ic->name =3D irq_name; @@ -425,7 +420,6 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, } girq->default_type =3D IRQ_TYPE_NONE; girq->handler =3D handle_level_irq; - gc->to_irq =3D ep93xx_gpio_f_to_irq; girq->first =3D EP93XX_GPIO_F_IRQ_BASE; } =20 --=20 2.26.2 From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512509; cv=none; d=zohomail.com; s=zohoarc; b=XXTBZ6dpo2fOT6Y7VB4AYz2oGxvqaLL3D+d5KX3HlUUZ1joAKf35Y0u94qZBr1GF0VWZolV1X3j90pJ0SXw6ak68BrcHfmYQ/ZuZa7MebFhWCsGUndfTn9Ix4eafNqO7jXRueSqZtBMTKV/KmvMpkeFtC9sI+tBxC+XXC520QW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512509; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=Dp6HxZC/4K5OdVprRMjSdc4GwEMF/JOfPqAMm/0L38Y=; b=cVI1U7A0b1u8O1amJsx5QXL58CL/0rmNYVAcYQCQ9ng8F5UWA/YtPy1S3SK5XyXDsOLCfz6gDXY6M0AkYvnoVIY4RofipjabfDs/GmckSkU0BcgObCVaEBWVGlvNQ0aJ/Y19bFw6d7i5FM14be5iYyI0FUIpqeIQKkB+L2mVn2E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512509746748.5664279304445; Fri, 5 Feb 2021 00:08:29 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231618AbhBEIHk (ORCPT ); Fri, 5 Feb 2021 03:07:40 -0500 Received: from forward102o.mail.yandex.net ([37.140.190.182]:52882 "EHLO forward102o.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231378AbhBEIGM (ORCPT ); Fri, 5 Feb 2021 03:06:12 -0500 Received: from forward102q.mail.yandex.net (forward102q.mail.yandex.net [IPv6:2a02:6b8:c0e:1ba:0:640:516:4e7d]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 3BBF166837F6; Fri, 5 Feb 2021 11:05:19 +0300 (MSK) Received: from vla1-85d2a0988c40.qloud-c.yandex.net (vla1-85d2a0988c40.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:511a:0:640:85d2:a098]) by forward102q.mail.yandex.net (Yandex) with ESMTP id 392D23A20010; Fri, 5 Feb 2021 11:05:19 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-85d2a0988c40.qloud-c.yandex.net (mxback/Yandex) with ESMTP id q3Bxqkxiwg-5JHiwiVJ; Fri, 05 Feb 2021 11:05:19 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5In8Bom7; Fri, 05 Feb 2021 11:05:18 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512319; bh=Dp6HxZC/4K5OdVprRMjSdc4GwEMF/JOfPqAMm/0L38Y=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=HkKzNoR6SgmJX0Ld1WtB4MtOZRBehEDe03JrBUS4NIiP14GJ4JdH1ocotZrwwuyKP vHsHaOMEmL2rJkmZy0PK+dvQO0i+HyDKgvv18GxM/PIsvm+JuNQNt3SR5ZcYq6t1Z0 Heq1CshG4p8Kd21T1MyVvzjZkkQfj7t3pg9pYUW8= Authentication-Results: vla1-85d2a0988c40.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/7] gpio: ep93xx: Fix typo s/hierarchial/hierarchical Date: Fri, 5 Feb 2021 11:05:05 +0300 Message-Id: <20210205080507.16007-6-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Fix typo in comment. Signed-off-by: Nikita Shubin --- drivers/gpio/gpio-ep93xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 6208a8010ff5..d330bff4d9f9 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -398,7 +398,7 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, =20 /* * FIXME: convert this to use hierarchical IRQ support! - * this requires fixing the root irqchip to be hierarchial. + * this requires fixing the root irqchip to be hierarchical. */ girq->parent_handler =3D ep93xx_gpio_f_irq_handler; girq->num_parents =3D 8; --=20 2.26.2 From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512767; cv=none; d=zohomail.com; s=zohoarc; b=CvdYA8AykfVGXS8w8BHGW3AheX2cRbjYBmfdLJJTpxERarTPntXaVP5nq7VtXtSOJI12b6XQDDWPyPKpLIEqediDLm3p67ru+zw+nE4w6rYBUttpRcYXmaTaxnx1EEeoi6WVq20tnNyx6SwmX4SL15Upg9Jfd7oPah97gj+am48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512767; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=dNqi01d8QzHphiScOYF0PoGYfIs0vwlJHIgHUmqjP9k=; b=Z41Zf3QTI3L5B8W/hzW6yjBc08MvsaynyQE+HyUlCKpON7IZPNrGga4gFATr7u2gM6i56MnOKMY+ESi/lEa7o6hbxmTsccUvUWy6IvRD3Qbk2AoPBZSLw9UAMjoyUFtIMMelli2TC/qwtsjZIJMUvyXihkTcncC2vieWhfOAQWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512767115881.8706431741505; Fri, 5 Feb 2021 00:12:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231526AbhBEIHf (ORCPT ); Fri, 5 Feb 2021 03:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231269AbhBEIGC (ORCPT ); Fri, 5 Feb 2021 03:06:02 -0500 Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::601]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11CA1C0613D6; Fri, 5 Feb 2021 00:05:22 -0800 (PST) Received: from forward102q.mail.yandex.net (forward102q.mail.yandex.net [IPv6:2a02:6b8:c0e:1ba:0:640:516:4e7d]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 20F573C02DBA; Fri, 5 Feb 2021 11:05:20 +0300 (MSK) Received: from vla1-977d04bfd94d.qloud-c.yandex.net (vla1-977d04bfd94d.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:3020:0:640:977d:4bf]) by forward102q.mail.yandex.net (Yandex) with ESMTP id 1C1303A20002; Fri, 5 Feb 2021 11:05:20 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-977d04bfd94d.qloud-c.yandex.net (mxback/Yandex) with ESMTP id VHRza60bZi-5JH01gO7; Fri, 05 Feb 2021 11:05:20 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5Jn8AvRb; Fri, 05 Feb 2021 11:05:19 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512320; bh=dNqi01d8QzHphiScOYF0PoGYfIs0vwlJHIgHUmqjP9k=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=hL9uVhABSYCAyq5EK80SP87y1HIzpWO63eb3Biw18Gk0wMcXXYI6apOUXegSoOKvx 9Fb4ZN5xkaJvqSpxVcYHTnzoV3buHF6bym48at4nsTaVwyj9vVwUncLJXmnNWYu+P5 nPZq8/c9DBWq7MS1OlvnIUKRku/9u1ks/AlyFAoU= Authentication-Results: vla1-977d04bfd94d.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 6/7] gpio: ep93xx: refactor ep93xx_gpio_add_bank Date: Fri, 5 Feb 2021 11:05:06 +0300 Message-Id: <20210205080507.16007-7-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" - replace plain numbers with girq->num_parents in devm_kcalloc - replace plain numbers with girq->num_parents for port F - refactor i - 1 to i + 1 to make loop more readable - combine getting IRQ's loop and setting handler's into single loop Signed-off-by: Nikita Shubin --- drivers/gpio/gpio-ep93xx.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index d330bff4d9f9..41b5b1de14f6 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -380,7 +380,7 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, =20 girq->parent_handler =3D ep93xx_gpio_ab_irq_handler; girq->num_parents =3D 1; - girq->parents =3D devm_kcalloc(dev, 1, + girq->parents =3D devm_kcalloc(dev, girq->num_parents, sizeof(*girq->parents), GFP_KERNEL); if (!girq->parents) @@ -402,15 +402,14 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_ch= ip *egc, */ girq->parent_handler =3D ep93xx_gpio_f_irq_handler; girq->num_parents =3D 8; - girq->parents =3D devm_kcalloc(dev, 8, + girq->parents =3D devm_kcalloc(dev, girq->num_parents, sizeof(*girq->parents), GFP_KERNEL); if (!girq->parents) return -ENOMEM; /* Pick resources 1..8 for these IRQs */ - for (i =3D 1; i <=3D 8; i++) - girq->parents[i - 1] =3D platform_get_irq(pdev, i); - for (i =3D 0; i < 8; i++) { + for (i =3D 0; i < girq->num_parents; i++) { + girq->parents[i] =3D platform_get_irq(pdev, i + 1); gpio_irq =3D EP93XX_GPIO_F_IRQ_BASE + i; irq_set_chip_data(gpio_irq, &epg->gc[5]); irq_set_chip_and_handler(gpio_irq, --=20 2.26.2 From nobody Sat May 10 03:51:52 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612512452; cv=none; d=zohomail.com; s=zohoarc; b=DXA0nE6ox+10y8DZ6CzPWHTSEcmapSJw9aCEyr4+LYyJohRx139pjyE8nn+auzdYDuE53Q+RWSeOpzKuMI4GFZpSbthrVJl72fG87Oz1rdCbIkfBjYC4IGhyCsS8Dr5xfNtvBAo8tAKxTWDvFDMJGVtUnIhia1TuWlndJmIyj98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612512452; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=C5tU/jiLrZmvj9xOWKPAfwt+7YcgCQ3SmmER8nQlmxc=; b=OqX1rkgq/uMPvFog+nbfcCdzg8BgeyWpM/kf/3lbJ43iTkaum3+fukcwkzwGCbd9AtjhLkFDCRUelJI9cIi4h07kcwOH5v2TmDzRZVgPAX9/NdfZ9Unz9eA5SrCUPpJ79amnZ8qPo8qZtvii18sAgbvGfJyqfEdL98cYqyF9kiE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1612512452944684.4350334435898; Fri, 5 Feb 2021 00:07:32 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbhBEIHF (ORCPT ); Fri, 5 Feb 2021 03:07:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231294AbhBEIGD (ORCPT ); Fri, 5 Feb 2021 03:06:03 -0500 Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::608]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F04C061793; Fri, 5 Feb 2021 00:05:22 -0800 (PST) Received: from forward100q.mail.yandex.net (forward100q.mail.yandex.net [IPv6:2a02:6b8:c0e:4b:0:640:4012:bb97]) by forward105o.mail.yandex.net (Yandex) with ESMTP id E22294203827; Fri, 5 Feb 2021 11:05:20 +0300 (MSK) Received: from vla1-4e4ee944ff6b.qloud-c.yandex.net (vla1-4e4ee944ff6b.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:3192:0:640:4e4e:e944]) by forward100q.mail.yandex.net (Yandex) with ESMTP id DDE6D7080004; Fri, 5 Feb 2021 11:05:20 +0300 (MSK) Received: from vla1-1bc5b51c612f.qloud-c.yandex.net (vla1-1bc5b51c612f.qloud-c.yandex.net [2a02:6b8:c0d:89c:0:640:1bc5:b51c]) by vla1-4e4ee944ff6b.qloud-c.yandex.net (mxback/Yandex) with ESMTP id EmakGzbKsi-5KHOfrIV; Fri, 05 Feb 2021 11:05:20 +0300 Received: by vla1-1bc5b51c612f.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8MWdPhaokU-5Kn8lqqC; Fri, 05 Feb 2021 11:05:20 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1612512320; bh=C5tU/jiLrZmvj9xOWKPAfwt+7YcgCQ3SmmER8nQlmxc=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=DOgAfDXIHXQm6lp8n6o9EdKgZe9lkl9EYWzW9kYbNUwQcZQ86xshLa4bhC76uq/v/ smhm76sS+RpTZd3n4vkXQEaUdBf1KoOLtMcVfPtVHf4kigsdrwMvxmPYJmQ4cGiVCQ 73EUaafLOKLyU7B3hz0CiLGCRnkfJLM0fHKl6bsQ= Authentication-Results: vla1-4e4ee944ff6b.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me From: Nikita Shubin Cc: Andy Shevchenko , Nikita Shubin , Linus Walleij , Bartosz Golaszewski , Alexander Sverdlin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 7/7] gpio: ep93xx: refactor base IRQ number Date: Fri, 5 Feb 2021 11:05:07 +0300 Message-Id: <20210205080507.16007-8-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210205080507.16007-1-nikita.shubin@maquefel.me> References: <20210205080507.16007-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" - use predefined constants instead of plain numbers - use provided bank IRQ number instead of defined constant for port F Signed-off-by: Nikita Shubin --- drivers/gpio/gpio-ep93xx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 41b5b1de14f6..252f7d765ff2 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c @@ -31,6 +31,8 @@ /* Maximum value for irq capable line identifiers */ #define EP93XX_GPIO_LINE_MAX_IRQ 23 =20 +#define EP93XX_GPIO_A_IRQ_BASE 64 +#define EP93XX_GPIO_B_IRQ_BASE 72 /* * Static mapping of GPIO bank F IRQS: * F0..F7 (16..24) to irq 80..87. @@ -304,14 +306,17 @@ _irq_name) \ =20 static struct ep93xx_gpio_bank ep93xx_gpio_banks[] =3D { /* Bank A has 8 IRQs */ - EP93XX_GPIO_BANK("A", 0x00, 0x10, 0x90, 0, true, false, 64, "gpio-irq-a"), + EP93XX_GPIO_BANK("A", 0x00, 0x10, 0x90, 0, true, false, + EP93XX_GPIO_A_IRQ_BASE, "gpio-irq-a"), /* Bank B has 8 IRQs */ - EP93XX_GPIO_BANK("B", 0x04, 0x14, 0xac, 8, true, false, 72, "gpio-irq-b"), + EP93XX_GPIO_BANK("B", 0x04, 0x14, 0xac, 8, true, false, + EP93XX_GPIO_B_IRQ_BASE, "gpio-irq-b"), EP93XX_GPIO_BANK("C", 0x08, 0x18, 0x00, 40, false, false, 0, 0), EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 0x00, 24, false, false, 0, 0), EP93XX_GPIO_BANK("E", 0x20, 0x24, 0x00, 32, false, false, 0, 0), /* Bank F has 8 IRQs */ - EP93XX_GPIO_BANK("F", 0x30, 0x34, 0x4c, 16, false, true, 0, "gpio-irq-b"), + EP93XX_GPIO_BANK("F", 0x30, 0x34, 0x4c, 16, false, true, 0, + EP93XX_GPIO_F_IRQ_BASE, "gpio-irq-b"), EP93XX_GPIO_BANK("G", 0x38, 0x3c, 0x00, 48, false, false, 0, 0), EP93XX_GPIO_BANK("H", 0x40, 0x44, 0x00, 56, false, false, 0, 0), }; @@ -410,7 +415,7 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, /* Pick resources 1..8 for these IRQs */ for (i =3D 0; i < girq->num_parents; i++) { girq->parents[i] =3D platform_get_irq(pdev, i + 1); - gpio_irq =3D EP93XX_GPIO_F_IRQ_BASE + i; + gpio_irq =3D bank->irq_base + i; irq_set_chip_data(gpio_irq, &epg->gc[5]); irq_set_chip_and_handler(gpio_irq, &ep93xx_gpio_irq_chip, @@ -419,7 +424,7 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip= *egc, } girq->default_type =3D IRQ_TYPE_NONE; girq->handler =3D handle_level_irq; - girq->first =3D EP93XX_GPIO_F_IRQ_BASE; + girq->first =3D bank->irq_base; } =20 return devm_gpiochip_add_data(dev, gc, epg); --=20 2.26.2