Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2869872pxv; Mon, 12 Jul 2021 04:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy91mH2IbOhD1uxjYxyGJHFoTRQctndMkk0dQ50zspaPTa7BqP6kme1wKQcFxB7+iL2F0sH X-Received: by 2002:a92:7c11:: with SMTP id x17mr34450636ilc.224.1626087773215; Mon, 12 Jul 2021 04:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626087773; cv=none; d=google.com; s=arc-20160816; b=e7l8TlM50iTm5ZmtxOiZXmC582q3XlfGxtfvmO8XvhhyghuaTQ7Jix36mMyV+unGwI JMRQAkY74lp5dPGG2DmfHyhvA24gKWyKiI+Q1U3d4j8XXJxAeeRffrwEtqhuYty9jNOt WUjFOfw6v4Ws09voYX6DdqFZ6Z1s/rTg8sDn3vj9CN2TK44wlAbYHFIM2x+eM+/F5eQa fJc5+cqOjn3Zd2wyDhhD9L9wv8lISZJlXV0kcSlE70IKwMd8ivYIXLSUro+/V22s69n1 PFyfZ01zNC/OqAKi5yv/jY2pWe7UDSekfBYmhr4fbcQHpJ5LZbylMrhDKODiLryy+8qg QUEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=GPR/GW9e8J8blXeD9r+mE7HxrrVHXsdcs63kO5JUP8A=; b=Eap3quw3g44tbi6v8yo9pIO1rLXDCQzu9wZxzzGaEvxh11Brn0G5/REXtITNPzWZGC wi6QHKd8mHfrsBnXOnoz68LjWalL/EiZqGdzVSqshbM5If6SGzyTmUZP/LnN0dWhi5/j gniDozA9AMGGBVB35lmoQpHyBf/Y3o6yksu1vAJoqAS+uZ8U84GizMsvcgH5vojX5O86 RVstf9cjzhLG7R67kRIIAN1ZwFLEE9pZewU5Pcaj/wAeONF3Bcx+5wFOE/RE/3b9y4BL pnZiRqY5og2ewA8/4Yi2/vbroRJhVyE/Awu7OU2Xj2fkqFw4+Ho9updpbYM8D5ZACS7r T4FA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@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.google.com with ESMTP id l7si18425511jad.12.2021.07.12.04.02.41; Mon, 12 Jul 2021 04:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238383AbhGLKHE (ORCPT + 99 others); Mon, 12 Jul 2021 06:07:04 -0400 Received: from twspam01.aspeedtech.com ([211.20.114.71]:18777 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235249AbhGLKGu (ORCPT ); Mon, 12 Jul 2021 06:06:50 -0400 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 16C9lbVK099596; Mon, 12 Jul 2021 17:47:37 +0800 (GMT-8) (envelope-from steven_lee@aspeedtech.com) Received: from localhost.localdomain (192.168.100.253) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Jul 2021 18:03:31 +0800 From: Steven Lee To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Joel Stanley , Andrew Jeffery , "open list:GPIO SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , "moderated list:ARM/ASPEED MACHINE SUPPORT" , open list CC: , , , Subject: [PATCH v6 7/9] gpio: gpio-aspeed-sgpio: Move irq_chip to aspeed-sgpio struct Date: Mon, 12 Jul 2021 18:03:14 +0800 Message-ID: <20210712100317.23298-8-steven_lee@aspeedtech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210712100317.23298-1-steven_lee@aspeedtech.com> References: <20210712100317.23298-1-steven_lee@aspeedtech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.100.253] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 16C9lbVK099596 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current design initializes irq->chip from a global irqchip struct, which causes multiple sgpio devices use the same irq_chip. The patch moves irq_chip to aspeed_sgpio struct for initializing irq_chip from their private gpio struct. Signed-off-by: Steven Lee Reviewed-by: Andrew Jeffery --- drivers/gpio/gpio-aspeed-sgpio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c index 9b809c28f842..6b3695197c97 100644 --- a/drivers/gpio/gpio-aspeed-sgpio.c +++ b/drivers/gpio/gpio-aspeed-sgpio.c @@ -29,6 +29,7 @@ struct aspeed_sgpio_pdata { struct aspeed_sgpio { struct gpio_chip chip; + struct irq_chip intc; struct clk *pclk; spinlock_t lock; void __iomem *base; @@ -403,14 +404,6 @@ static void aspeed_sgpio_irq_handler(struct irq_desc *desc) chained_irq_exit(ic, desc); } -static struct irq_chip aspeed_sgpio_irqchip = { - .name = "aspeed-sgpio", - .irq_ack = aspeed_sgpio_irq_ack, - .irq_mask = aspeed_sgpio_irq_mask, - .irq_unmask = aspeed_sgpio_irq_unmask, - .irq_set_type = aspeed_sgpio_set_type, -}; - static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, struct platform_device *pdev) { @@ -433,8 +426,14 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_status)); } + gpio->intc.name = dev_name(&pdev->dev); + gpio->intc.irq_ack = aspeed_sgpio_irq_ack; + gpio->intc.irq_mask = aspeed_sgpio_irq_mask; + gpio->intc.irq_unmask = aspeed_sgpio_irq_unmask; + gpio->intc.irq_set_type = aspeed_sgpio_set_type; + irq = &gpio->chip.irq; - irq->chip = &aspeed_sgpio_irqchip; + irq->chip = &gpio->intc; irq->init_valid_mask = aspeed_sgpio_irq_init_valid_mask; irq->handler = handle_bad_irq; irq->default_type = IRQ_TYPE_NONE; -- 2.17.1