From patchwork Thu Feb 16 09:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 654661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6723C636CC for ; Thu, 16 Feb 2023 09:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbjBPJih (ORCPT ); Thu, 16 Feb 2023 04:38:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229960AbjBPJiF (ORCPT ); Thu, 16 Feb 2023 04:38:05 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B780518CA for ; Thu, 16 Feb 2023 01:37:27 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id f34so2001197lfv.10 for ; Thu, 16 Feb 2023 01:37:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=uTZJUuoTLvnb8+dIB2o2Mq6G+9PNstLnM4iOJQS28hg=; b=N8DrrLId/y7Llqj7BdEcTudPqAcKbLDdGVDlOE2D0AK9b5LDmeYFaXxOiHxAsF/EET kbETpK1FE0ZMXlmnuqIKaBqKavRFFIo/USTTzCIxKnJs+EXePGNHyOlMb2Kww9Tcdo5U JRU4yWH1c1ijp1D0GG2qeHoSVCgxV4XQl6ltyVJh/S71QSeLTdpNPNygnrzpoletwSm9 e/J4O2OooCcB7iYvdLH6BNYK4HpHyt0rUbQE/HcsUiuGDb8CuhDldZJUQc1or8iUszSx BPBBOG8ltw6GVPXCxqoZgbvQ5KWpNAzMzpk9wjxF6LYIQ01KZNZvrsTc8LiVzsajYT43 d3WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=uTZJUuoTLvnb8+dIB2o2Mq6G+9PNstLnM4iOJQS28hg=; b=CPvL6DxBG/f9EdVcYGzcp0LfROJBa7ySklMdWW2A/tC7GpntiPKsm0hkTnR8RAui56 9ki1mkh5GFZXGmnI4YGDXtV5rgIOXfsk0unRvUETAMwa/kJ/NEO7sQuqlO3v1ZQtMKvi 5FQZxw3qeci3v5LPDQQVPWMhIrcxXDiAwhyng/5Gm5NPmwnZ/cl4STKMy8k1Jg/hQ7nw BeZAb32feSAvE4Cm2HNFbWpd/fWwA5LtErQc7lldoN7ARSJpdJod2aCWw9Hlf9ImN0K9 sEgY1U3Zr0OxNNancrVR/lWkskKdecgOby/TiL8FeNmv2q1kHRnt0gdoZsLh+37rKHmF G0+A== X-Gm-Message-State: AO0yUKWn30Sl4GQd8+Ozt9ijcw+WVbQKh7SkJ7ZoBwHrDx+BRwFuflob 7a631C51X/Bmo3ezKys9fJC+He/AO+ayqseC X-Google-Smtp-Source: AK7set8MZjOAbMcR9f34HdbTkDlR7J174NgMUjyFUi3tJw50XTL3Njfopnu5TIY3mJ4RzbH8YG1EQQ== X-Received: by 2002:a05:6512:e95:b0:4b5:70e0:f2e6 with SMTP id bi21-20020a0565120e9500b004b570e0f2e6mr762445lfb.24.1676540247187; Thu, 16 Feb 2023 01:37:27 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id r3-20020a19ac43000000b004d8758a452asm229069lfc.288.2023.02.16.01.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 01:37:26 -0800 (PST) From: Linus Walleij Date: Thu, 16 Feb 2023 10:37:18 +0100 Subject: [PATCH 17/17] gpio: pcie-idio-24: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v1-17-51a8f224a5d0@linaro.org> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> In-Reply-To: <20230215-immutable-chips-v1-0-51a8f224a5d0@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 , Grygorii Strashko , 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 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pcie-idio-24.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c index 8a9b98fa418f..ac42150f4009 100644 --- a/drivers/gpio/gpio-pcie-idio-24.c +++ b/drivers/gpio/gpio-pcie-idio-24.c @@ -396,6 +396,8 @@ static void idio_24_irq_mask(struct irq_data *data) } raw_spin_unlock_irqrestore(&idio24gpio->lock, flags); + + gpiochip_disable_irq(chip, irqd_to_hwirq(data)); } static void idio_24_irq_unmask(struct irq_data *data) @@ -408,6 +410,8 @@ static void idio_24_irq_unmask(struct irq_data *data) const unsigned long bank_offset = bit_offset / 8; unsigned char cos_enable_state; + gpiochip_enable_irq(chip, irqd_to_hwirq(data)); + raw_spin_lock_irqsave(&idio24gpio->lock, flags); prev_irq_mask = idio24gpio->irq_mask >> bank_offset * 8; @@ -437,12 +441,14 @@ static int idio_24_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } -static struct irq_chip idio_24_irqchip = { +static const struct irq_chip idio_24_irqchip = { .name = "pcie-idio-24", .irq_ack = idio_24_irq_ack, .irq_mask = idio_24_irq_mask, .irq_unmask = idio_24_irq_unmask, - .irq_set_type = idio_24_irq_set_type + .irq_set_type = idio_24_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t idio_24_irq_handler(int irq, void *dev_id) @@ -535,7 +541,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) idio24gpio->chip.set_multiple = idio_24_gpio_set_multiple; girq = &idio24gpio->chip.irq; - girq->chip = &idio_24_irqchip; + gpio_irq_chip_set_chip(girq, &idio_24_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;