From patchwork Thu Mar 9 07:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp155216wrd; Wed, 8 Mar 2023 23:51:02 -0800 (PST) X-Google-Smtp-Source: AK7set/Ha/DQWryyVlu8tgHn38cv8uHwy16GJ6Nv9bpIJ8dt0iM2VTE0SrcjIDtgXrycZYKwEAQD X-Received: by 2002:a17:902:c40b:b0:19e:8bfe:7d68 with SMTP id k11-20020a170902c40b00b0019e8bfe7d68mr27660075plk.11.1678348262149; Wed, 08 Mar 2023 23:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348262; cv=none; d=google.com; s=arc-20160816; b=W9MbZgr2jbZfQAU2ZjOKM8hkITv/GZQHQbU6mM8umztn9ccNrLHYQL9OzPKsdmF1RS 8wFBBUC/61C+kBWhUnhuEwdEPForHN9KuDcME3R1RBF9M+yRmv4ZvnZyehD7N1IcGWoo QLB+owXYNbqwWqsf2IpkGrNY/RFBKSmTWPO5lpIcEHjqqK0UTPjraGasCUEyBz6AL4Zv pM7o8qLFtefY9w8qfo8Fy0E+yTrFHAKyoTMDP/j0TiPz8BlVgc8cpwiB9I2mi81z0Bbr N2pOo5VXcQbiC5r9bkpxFdXFkzdilmjzb1rZ26OBEomRkitf8MDdBiToCD3TOtbDZ4Mm ULiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=JIkSiPW+2aoPvA0+SmZYZeIw33BjEl01nmTwUgoRSQTl75dfJWn2DPsuKNBabdyRQD 1etEWwJU1TWq2vfepzHOyoyzwB96j/yw3lcEsNXneXBhKCLxIBlC/m3lkK1hj/78wjLS L4ecHQCH0FuvChQ67FVct1OcM5Ka4KKSZqEyrthsYo8FAlo29MVFpfnj8O3qHk+Fstfl 7Z8rR/y+l/yVbGtu4W2KFxis5nsqQJDBY6wGLdp7K0ABPFhuEyNAUCQJueUw1YTTe3Az 70zXYMeSJbiUCTYdl1b87M20hF8AOv9PWKGjlS9Lbhe/Doi/NCjQh9UH0QSFCY8V9S0S 4bfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bWmtMKb6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a170902f78c00b0019ead10c044si12862999pln.142.2023.03.08.23.50.48; Wed, 08 Mar 2023 23:51:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bWmtMKb6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230304AbjCIHrk (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbjCIHqo (ORCPT ); Thu, 9 Mar 2023 02:46:44 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BDADDF2C for ; Wed, 8 Mar 2023 23:46:13 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id bi9so1174374lfb.2 for ; Wed, 08 Mar 2023 23:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347972; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=bWmtMKb6fEUF/NZ6LH5RuXerUIViljmwR4bhAP4X3ybB1hO77AJtkWOPfPKgUmh/jW TmF5VNEgVV1l9zxS2yaBM0mmE1P8UQMBVY06NqrmxcGTY2KexUr8WXnpjvApNqP0XgwS xFDF/9ZXGlZWKSQproLVORlPhMr+pLQOhS6ifVO12cldkZJk2Kkl5fM2G7G0BomE5684 hMVjRCrFdG0EXD8hhzDA6Ppf/gHui37ivuZ/rMpnpbkI447fZlG798+d+wZkcNuKUBkP ppUhPHLOOMIwamflqyJtuoMxXx+FJiaP+JGvKBF9r/jQnXxqls2IIuFdVMDMOeePY5T2 IbXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347972; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=6jhl941DDiXQnDGf/S2puQnKhRyDBzUovF1A2cSq+WVlmiy4Ne3ii+GYZpIODq46r3 HRgIUn+mFui4YUHkF9v2bSB4n2LRGOmKXOJ3e9HUjW1VQYK/JH2t7s7nVl5GICYqj3hd 1frVD59Oy7gXOtyBWh4lI6OEtmqgjMOUsO2+8zP7FEbW1x0bsPmr0WIDbRvgiBW+LnrJ joT2crakJWZBYKC5flan4SUeo8EEIFZ5Jqv6lzBn+20PasITCohfgmkk0NR0AS1Vq4Lb y+y8JeEEE7WLM0thHaxCP65U5na8I1iDWbhgJ3LTUvol8reYbXjvNWaEu2qULgeEzIsv YJ2w== X-Gm-Message-State: AO0yUKXI9AmgNHf4KhilqJMYAU7s3vHsZWI5e6+OFshok9sxJpBdRmoN hVuwfjX8eov7O8IcTye+TqTvCQ== X-Received: by 2002:ac2:538c:0:b0:4d7:44c9:9f4c with SMTP id g12-20020ac2538c000000b004d744c99f4cmr5198184lfh.4.1678347972678; Wed, 08 Mar 2023 23:46:12 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:12 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:04 +0100 Subject: [PATCH v3 16/17] gpio: pci-idio-16: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-16-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> To: Mun Yew Tham , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , Alban Bedel , Orson Zhai , Baolin Wang , Chunyan Zhang , Jay Fang , Daniel Palmer , Romain Perier , Santosh Shilimkar , Kevin Hilman , William Breathitt Gray Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-omap@vger.kernel.org, Linus Walleij , Marc Zyngier X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759875707548101133?= X-GMAIL-MSGID: =?utf-8?q?1759875707548101133?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: William Breathitt Gray Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pci-idio-16.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-16.c index a86ce748384b..6726c32e31e6 100644 --- a/drivers/gpio/gpio-pci-idio-16.c +++ b/drivers/gpio/gpio-pci-idio-16.c @@ -107,6 +107,8 @@ static void idio_16_irq_mask(struct irq_data *data) raw_spin_unlock_irqrestore(&idio16gpio->lock, flags); } + + gpiochip_disable_irq(chip, irqd_to_hwirq(data)); } static void idio_16_irq_unmask(struct irq_data *data) @@ -117,6 +119,8 @@ static void idio_16_irq_unmask(struct irq_data *data) const unsigned long prev_irq_mask = idio16gpio->irq_mask; unsigned long flags; + gpiochip_enable_irq(chip, irqd_to_hwirq(data)); + idio16gpio->irq_mask |= mask; if (!prev_irq_mask) { @@ -138,12 +142,14 @@ static int idio_16_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } -static struct irq_chip idio_16_irqchip = { +static const struct irq_chip idio_16_irqchip = { .name = "pci-idio-16", .irq_ack = idio_16_irq_ack, .irq_mask = idio_16_irq_mask, .irq_unmask = idio_16_irq_unmask, - .irq_set_type = idio_16_irq_set_type + .irq_set_type = idio_16_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t idio_16_irq_handler(int irq, void *dev_id) @@ -242,7 +248,7 @@ static int idio_16_probe(struct pci_dev *pdev, const struct pci_device_id *id) idio_16_state_init(&idio16gpio->state); girq = &idio16gpio->chip.irq; - girq->chip = &idio_16_irqchip; + gpio_irq_chip_set_chip(girq, &idio_16_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;