From patchwork Fri Sep 2 17:45:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 602271 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 7F232C6FA83 for ; Fri, 2 Sep 2022 21:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbiIBVkf (ORCPT ); Fri, 2 Sep 2022 17:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbiIBVka (ORCPT ); Fri, 2 Sep 2022 17:40:30 -0400 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE5D332B83 for ; Fri, 2 Sep 2022 14:40:19 -0700 (PDT) Received: by mail-qv1-xf2d.google.com with SMTP id f9so2390444qvw.11 for ; Fri, 02 Sep 2022 14:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=xMrbWUY6zwIx3C/ybxag/rE7UT2Nj7W56VkoAh9Wle8=; b=NfdZGBLUYxOfd0iRQmmgqdPNUIOCNG10zN/1mBMpSNBIJfxVF84r8HKTk6fRQPssLo AqIXg+mhMMNU3RkgetY55baklrCOfNuZYxssO1m9jV7gv0Fc433K0YJ438t6kyW4NYAc 24HOTICGTo5tNhpVkerh0TaDoiXvNeQ5U/fzchE9ZabKnOwsHB9GOs4wq2S/mzVmMO3B laKfXhIrMdGMlKpEs9In+Xn2bTVGHioa03dofEAXecJMz5K60gA0km4VgfNv6L1C16Fp 2R8S9BD6Z97OrbUm47f7jc2iUZuwCb7FR4t6/8ZGgY8ufslkOLEGE9CgGjhr27mQUKuG Adrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=xMrbWUY6zwIx3C/ybxag/rE7UT2Nj7W56VkoAh9Wle8=; b=Tcnmo8szn9rN8CUY8jWODAAQroRWfNNiOUKSUhCn7s0axhO6kJ9yg9VRSnFNR9Y/zU 1GrWQRItKBfPI3n6aUvQsG8sskVC6AwxPQM+qA16ipe6GO9MOrFwcm6rdT3mLAc/mIYX rDC0hE4PL2sDAVni4d7JVKVl/wD2YKC69C3Hom94RFCzoIPHLvKDUWmV1+iqmAk++DmU XHSxkrMHlZd6ZeVePsHmNQ22FVy9J1huqSa4HPPBj5FyKSFdqXED4BA4jkFmfuvx1Nlb L92Yi3K18tzUkhBATwWTj4e6opshIoKchiaQJC6vQ+yRZW7UAdIfJFc4O9FWdHBc40ME B6SQ== X-Gm-Message-State: ACgBeo0rtAIzHOGlUcpq/LUUbn5MpfKPJk9GPAiowShZQ5Zrw45fEdhb +uZrMEaSfai3glBInVZALPng9g== X-Google-Smtp-Source: AA6agR6jDjhaLewM868f5dZUQDWZdeXFGETjL2RBbYT5x8nl805M4ouJtIAIOoAKWRton7fMIlMnfQ== X-Received: by 2002:a0c:ab07:0:b0:474:9c36:413e with SMTP id h7-20020a0cab07000000b004749c36413emr30915739qvb.56.1662154818756; Fri, 02 Sep 2022 14:40:18 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id 15-20020ac84e8f000000b0031f0b43629dsm1819533qtp.23.2022.09.02.14.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 14:40:18 -0700 (PDT) From: William Breathitt Gray To: brgl@bgdev.pl, linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, William Breathitt Gray Subject: [PATCH 1/4] gpio: 104-dio-48e: Make irq_chip immutable Date: Fri, 2 Sep 2022 13:45:23 -0400 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-dio-48e.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index a41551870759..74cc71bb3984 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -164,6 +164,7 @@ static void dio48e_irq_mask(struct irq_data *data) dio48egpio->irq_mask &= ~BIT(0); else dio48egpio->irq_mask &= ~BIT(1); + gpiochip_disable_irq(chip, offset); if (!dio48egpio->irq_mask) /* disable interrupts */ @@ -191,6 +192,7 @@ static void dio48e_irq_unmask(struct irq_data *data) iowrite8(0x00, &dio48egpio->reg->enable_interrupt); } + gpiochip_enable_irq(chip, offset); if (offset == 19) dio48egpio->irq_mask |= BIT(0); else @@ -213,12 +215,14 @@ static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } -static struct irq_chip dio48e_irqchip = { +static const struct irq_chip dio48e_irqchip = { .name = "104-dio-48e", .irq_ack = dio48e_irq_ack, .irq_mask = dio48e_irq_mask, .irq_unmask = dio48e_irq_unmask, - .irq_set_type = dio48e_irq_set_type + .irq_set_type = dio48e_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t dio48e_irq_handler(int irq, void *dev_id) @@ -322,7 +326,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple; girq = &dio48egpio->chip.irq; - girq->chip = &dio48e_irqchip; + gpio_irq_chip_set_chip(girq, &dio48e_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0; From patchwork Fri Sep 2 17:45:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 602526 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 AC3E0C6FA89 for ; Fri, 2 Sep 2022 21:40:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbiIBVkg (ORCPT ); Fri, 2 Sep 2022 17:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbiIBVkb (ORCPT ); Fri, 2 Sep 2022 17:40:31 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D12737194 for ; Fri, 2 Sep 2022 14:40:20 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id cv7so2417377qvb.3 for ; Fri, 02 Sep 2022 14:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=+5W3kIyuKIp9hTxfCgunIN6PQveCEir/569gHMdhyOc=; b=j80KkNfzDLQPPP6jv+cQ+Yydwhz8HRQENT41Pf6dYvGrapRyr4+S4vD35MwkFID5UD knJCoiJd9cGE7jfrOB86i/HLLX805ds1QfLcCsgRubE/fwP9gaCvURLDAfWPlwUO0yFn RY5OP2vnCUuRYV1CYFrduWMtWprZ+XHFybLpXrOLT/7qLxlZ/LnL6lmUvwJvGo2OlWeU vjtog/5KK2zQglRC/YeLVMJOietAySDpFQ48GN+jnrxPAJRnSIu2VXmM4a2IGExpBlrr X2iCmLV2q1mywLlrNiQCtQ6+zKk+fi95ExuEfQ3aF8Duvpp27azmsq6TIAEfwmZbdzmO f5iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=+5W3kIyuKIp9hTxfCgunIN6PQveCEir/569gHMdhyOc=; b=jiOVihtxOFCwG3v78ECgce6LtEWd5gqN2si80gYkQtnje0y58yRybtQgmcM2aJcX9s TNLaCG2ovhJReEtr6Bfo+32i01SHmtDmmcpHW/xfUtD9r/CAFRF5DlJQkT2GLP1zkH33 7cVqoH8w77bYETqV38PKVjwLhca+KfIcSWOqKPj5ovlgWhliPlpcNyxNVjIVkbCHF8BV C3/v1PNnD+C2mVFOlBzQ8rv8Gts1gCzFJVA9ZIzqfKoN9HXgsmadAMvlXg+kfrkwO401 Tb+nxpAx/qusbTmABH2Ze/qygJp4rN78xyLVFMpfqQLuX2Y6IhH8GeMdSh5bq0WcGFrz 9hIA== X-Gm-Message-State: ACgBeo2FrX7pFNB7+eJjzzgNyDsW3JqxNKnelA2S63Uqs2uQZ5gpKW3o CQrxiz2bChXsJYQGtkB/1JStBg== X-Google-Smtp-Source: AA6agR4TFJACeWR/WS95zWZP4ea+baOtunwHv3hkiI+TUYWmdBYAuBl3hVo13YauYO8E83rcId6E6Q== X-Received: by 2002:a05:6214:20a2:b0:476:9071:2e60 with SMTP id 2-20020a05621420a200b0047690712e60mr30255860qvd.110.1662154819521; Fri, 02 Sep 2022 14:40:19 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id 15-20020ac84e8f000000b0031f0b43629dsm1819533qtp.23.2022.09.02.14.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 14:40:19 -0700 (PDT) From: William Breathitt Gray To: brgl@bgdev.pl, linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, William Breathitt Gray Subject: [PATCH 2/4] gpio: 104-idi-48: Make irq_chip immutable Date: Fri, 2 Sep 2022 13:45:24 -0400 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-idi-48.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index 40be76efeed7..3286b914a2cf 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c @@ -113,6 +113,7 @@ static void idi_48_irq_mask(struct irq_data *data) spin_lock_irqsave(&idi48gpio->lock, flags); idi48gpio->irq_mask[boundary] &= ~mask; + gpiochip_disable_irq(chip, offset); /* Exit early if there are still input lines with IRQ unmasked */ if (idi48gpio->irq_mask[boundary]) @@ -140,6 +141,7 @@ static void idi_48_irq_unmask(struct irq_data *data) prev_irq_mask = idi48gpio->irq_mask[boundary]; + gpiochip_enable_irq(chip, offset); idi48gpio->irq_mask[boundary] |= mask; /* Exit early if IRQ was already unmasked for this boundary */ @@ -164,12 +166,14 @@ static int idi_48_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } -static struct irq_chip idi_48_irqchip = { +static const struct irq_chip idi_48_irqchip = { .name = "104-idi-48", .irq_ack = idi_48_irq_ack, .irq_mask = idi_48_irq_mask, .irq_unmask = idi_48_irq_unmask, - .irq_set_type = idi_48_irq_set_type + .irq_set_type = idi_48_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t idi_48_irq_handler(int irq, void *dev_id) @@ -267,7 +271,7 @@ static int idi_48_probe(struct device *dev, unsigned int id) idi48gpio->chip.get_multiple = idi_48_gpio_get_multiple; girq = &idi48gpio->chip.irq; - girq->chip = &idi_48_irqchip; + gpio_irq_chip_set_chip(girq, &idi_48_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0; From patchwork Fri Sep 2 17:45:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 602527 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 C99D9ECAAA1 for ; Fri, 2 Sep 2022 21:40:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231254AbiIBVke (ORCPT ); Fri, 2 Sep 2022 17:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbiIBVka (ORCPT ); Fri, 2 Sep 2022 17:40:30 -0400 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C75DD399D3 for ; Fri, 2 Sep 2022 14:40:21 -0700 (PDT) Received: by mail-qk1-x734.google.com with SMTP id s22so2766830qkj.3 for ; Fri, 02 Sep 2022 14:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=bR3hEleHn1hDXjDK6nUjMSvBYEAsUeJzCzyUGuVERRQ=; b=wuzCTnre6tTsSegsWv8KZyKcXhhqdhcG6fFIvRHpUAcFTLq9edlgDAeNCrP1BZBuQs +snDeAgYpQ9ou4o7gjLmO4qAPCuMqjAMbSPDH6nE3m4Wt26glIh+Q+WnQ8h2JPbH743C XofCCIy/C62BWw7Gz4ktIrZQqvhlIuwS7utzOIyMLVq6TDdCeNhT05Niap6zzINjxe9d VRnsUCafjeFcUtRGslnzqSsXeskPb0D729WRKiT3jNNohcyEJmY1jMASfZ0wmaKpZmpH seXeBDvkWD9yhDdZJxHZ8g6wAsmC/bSfQs1ikHOQO7BCPMuu2XRckAw5U3BgMDCidcWo 28Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=bR3hEleHn1hDXjDK6nUjMSvBYEAsUeJzCzyUGuVERRQ=; b=mgMIbQ86EtH+JOdc/XvMrkeShI6SK/J5Cx8euh2zBkrZh/He5W2nFEEH3oACfUP88e /Cd2IIiQClZVQI+YfnGVXRNFN9a9Nb6m93SLgjKf9d7mNrdznxDE0KtPgmD5TYRA/0KS v11dvCcMBMc4F5bPBa6U/CfPWmjDa9laXJv48PZYkGhEoIsXvk6nvKocWI+HmUiQOYhD Dw2USqEYtoeyrVgIf9e54oMriE9iIg0f55MMNGlE/PGlDuP+I4mSxnyXTEn8B3lHa1qq reUunGh4QJ/j9sdA+XvUwVim3o05CtFJ5T/YfOSnrUgDfTYcAjg5OwgLuIlRLpM3P+cy IVkQ== X-Gm-Message-State: ACgBeo1dtiyQ5XhIAG/K/uJFd7s6NAjVoeZpXh8bfYwUqURHx7wmtR1V 5+ANFg7qEXo4IKm18tyTQM41vw== X-Google-Smtp-Source: AA6agR5GjIxXkb/bcDLBsnO3UPU6jpE1pq17eJNvvjhLBlYBn3BCFQ7DqD21u9qoZ70EX7rLo01JsA== X-Received: by 2002:a05:620a:4094:b0:6bb:8514:9c84 with SMTP id f20-20020a05620a409400b006bb85149c84mr24438491qko.134.1662154820356; Fri, 02 Sep 2022 14:40:20 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id 15-20020ac84e8f000000b0031f0b43629dsm1819533qtp.23.2022.09.02.14.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 14:40:20 -0700 (PDT) From: William Breathitt Gray To: brgl@bgdev.pl, linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, William Breathitt Gray , Frede@cmslaser.com Subject: [PATCH 3/4] gpio: 104-idio-16: Make irq_chip immutable Date: Fri, 2 Sep 2022 13:45:25 -0400 Message-Id: <1a97e3f21f695f238fad9366e5976694b41a5da0.1662140119.git.william.gray@linaro.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-104-idio-16.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c index 65a5f581d981..4756e583f223 100644 --- a/drivers/gpio/gpio-104-idio-16.c +++ b/drivers/gpio/gpio-104-idio-16.c @@ -174,10 +174,11 @@ static void idio_16_irq_mask(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); - const unsigned long mask = BIT(irqd_to_hwirq(data)); + const unsigned long offset = irqd_to_hwirq(data); unsigned long flags; - idio16gpio->irq_mask &= ~mask; + idio16gpio->irq_mask &= ~BIT(offset); + gpiochip_disable_irq(chip, offset); if (!idio16gpio->irq_mask) { raw_spin_lock_irqsave(&idio16gpio->lock, flags); @@ -192,11 +193,12 @@ static void idio_16_irq_unmask(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); - const unsigned long mask = BIT(irqd_to_hwirq(data)); + const unsigned long offset = irqd_to_hwirq(data); const unsigned long prev_irq_mask = idio16gpio->irq_mask; unsigned long flags; - idio16gpio->irq_mask |= mask; + gpiochip_enable_irq(chip, offset); + idio16gpio->irq_mask |= BIT(offset); if (!prev_irq_mask) { raw_spin_lock_irqsave(&idio16gpio->lock, flags); @@ -217,12 +219,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 = "104-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) @@ -299,7 +303,7 @@ static int idio_16_probe(struct device *dev, unsigned int id) idio16gpio->out_state = 0xFFFF; 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; From patchwork Fri Sep 2 17:45:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 602272 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 E6688C6FA82 for ; Fri, 2 Sep 2022 21:40:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbiIBVkc (ORCPT ); Fri, 2 Sep 2022 17:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231232AbiIBVka (ORCPT ); Fri, 2 Sep 2022 17:40:30 -0400 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7ADC31DD4 for ; Fri, 2 Sep 2022 14:40:22 -0700 (PDT) Received: by mail-qk1-x729.google.com with SMTP id s22so2766846qkj.3 for ; Fri, 02 Sep 2022 14:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=a/6y1tnbijdXc5qSMdd4IK5j90OSsiP2sEjvKMKEBTI=; b=K6w/ph2YvbrAoqqGMdDTbzaJxkU/GCskA/gO5HYUyptfDzMuD/PCZN1AbjYE3Gz7kp 4qog5itKarci+dzN0DwAog50b8cVEWazuo1qmQbyjZzx4E7UdlnoZWRUB/dwB5pHj3v8 dqf50X1ggz6hSRBfL7zG0xJ6GyDhVmlADQKfkdiJUXCX4J4Wu51qxWaHi5XmELZEqF+3 KOdG549A38ufAzxL+PHq59/SFtS3W4i9tr9FaiKwl7dyXHUpYW7EXoBAoKMWyWLMRs0r X2dref2ucuJ9yK/mW1v3ZguZpL9hmvpWKa64EWt++3TyJTjV0/wCRB8Ef5MH1ai19vZh txcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=a/6y1tnbijdXc5qSMdd4IK5j90OSsiP2sEjvKMKEBTI=; b=RyxEBgX/eXughjZ6Au68G3fuM94P3YTqDqLhQGqF07NFr/1evE90O2Ln9D9vuruRvz dqxQscfFgT0rw7+ZxeFOGnmNBLiuGH9oiy5LNCYqQxa1HF7a8Ya5b7W20vACqv2wDhRf TgSXo8sAwhIfe2NJ4/UONbOY5kPkOVz0X2Wce8Ifi9avToh6Xd2lwqhB1fgNcHmFUnCU tlcbECLA7Jw4d2H3Wg/l9r+qYwBvLZvpxpv0B0bYIhrhDdYL2Z46pdKlgTAdwzZeoag8 LTeex1lNqFS6H/JZ03T50hRF0Vo3N8kStA4ajOWwRThVUeQ+62jvhPTw0eWXNjWOcrnR ZePQ== X-Gm-Message-State: ACgBeo05mzhaEnYHbhdHO8yj/k/jw1H908SDUPojd/KAnB2/rEPK9+cZ Et1K2qxEh0lXz10Mdu8eVXZB61WDnlmxcw== X-Google-Smtp-Source: AA6agR6OyuWkqksbnk9o2odwFhmHjE3fR48VDFM11LQr6zwHpcQ+2cXpaK5b2lZ0sKIUAtzPPBNrgA== X-Received: by 2002:ae9:e841:0:b0:6b9:c69e:ac99 with SMTP id a62-20020ae9e841000000b006b9c69eac99mr24436570qkg.450.1662154821173; Fri, 02 Sep 2022 14:40:21 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id 15-20020ac84e8f000000b0031f0b43629dsm1819533qtp.23.2022.09.02.14.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 14:40:20 -0700 (PDT) From: William Breathitt Gray To: brgl@bgdev.pl, linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, William Breathitt Gray Subject: [PATCH 4/4] gpio: ws16c48: Make irq_chip immutable Date: Fri, 2 Sep 2022 13:45:26 -0400 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Kernel warns about mutable irq_chips: "not an immutable chip, please consider fixing!" Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-ws16c48.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c index b098f2dc196b..59fb10641598 100644 --- a/drivers/gpio/gpio-ws16c48.c +++ b/drivers/gpio/gpio-ws16c48.c @@ -265,6 +265,7 @@ static void ws16c48_irq_mask(struct irq_data *data) raw_spin_lock_irqsave(&ws16c48gpio->lock, flags); ws16c48gpio->irq_mask &= ~mask; + gpiochip_disable_irq(chip, offset); port_state = ws16c48gpio->irq_mask >> (8 * port); /* Select Register Page 2; Unlock all I/O ports */ @@ -295,6 +296,7 @@ static void ws16c48_irq_unmask(struct irq_data *data) raw_spin_lock_irqsave(&ws16c48gpio->lock, flags); + gpiochip_enable_irq(chip, offset); ws16c48gpio->irq_mask |= mask; port_state = ws16c48gpio->irq_mask >> (8 * port); @@ -356,12 +358,14 @@ static int ws16c48_irq_set_type(struct irq_data *data, unsigned flow_type) return 0; } -static struct irq_chip ws16c48_irqchip = { +static const struct irq_chip ws16c48_irqchip = { .name = "ws16c48", .irq_ack = ws16c48_irq_ack, .irq_mask = ws16c48_irq_mask, .irq_unmask = ws16c48_irq_unmask, - .irq_set_type = ws16c48_irq_set_type + .irq_set_type = ws16c48_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t ws16c48_irq_handler(int irq, void *dev_id) @@ -463,7 +467,7 @@ static int ws16c48_probe(struct device *dev, unsigned int id) ws16c48gpio->chip.set_multiple = ws16c48_gpio_set_multiple; girq = &ws16c48gpio->chip.irq; - girq->chip = &ws16c48_irqchip; + gpio_irq_chip_set_chip(girq, &ws16c48_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;