Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2023410rwn; Fri, 16 Sep 2022 04:42:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6n2A5pRzESP8q0D6Qei9FN1v+1afBbeB4k3V+c6MswINGXlMpSB1t0HG06a1f+7+ayeDgZ X-Received: by 2002:a17:90a:2b0a:b0:1ff:f1cc:b430 with SMTP id x10-20020a17090a2b0a00b001fff1ccb430mr16057681pjc.243.1663328562821; Fri, 16 Sep 2022 04:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663328562; cv=none; d=google.com; s=arc-20160816; b=OqqcsKR+1n0o8n1Urp7+lMipKWItDXpfPsholrhWTz+4cXSnO/0mVrtOiWFFJ3yOnT +7q6EfP1Rl684qtSDC4H3hpKL1Me05q28fzP6NIVjH81Pj+zFCj6Yx85LbCt5NNNZTw9 modSp4+iMbXpixS6XH+ufLMi+4uNgkJBzorf4tp77/83WpxZL+JCyPpCWCTqunCvD4n1 5dXcKAJ82zW6ILHIkCYS2rND6/nu7/C1m7IO/W1DKeIV4W4v0qWFFoZoAud0POHs0vHv LPfcuxBPt8pb0xsg+8EDH6qKWMxmD/WtrbxJjWGlstxDEbxBn5ylfdwMWdYEF0nN1kfu PlmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z+jCxDKwtapqbyMs+SM4yYk+ZodpM4Payz/GekVtyn0=; b=t07Qa32G8kGZ1BE9yaMthqg2CSb1RRa/kFmnVOcKnP2uiCkB8zsyvLjITYMz7+Ixr3 B7uHcNhGfnBzUYz3tVIS56G9NSZX6q7hjAHn/TADQXwIRWfG062X/Od0P7XnQxgbFpF2 cIn99eq8bzFjVegcqwbiMeuf+h+FKxaWTRjpzrRCr+gEm2pV01jxb3beF6GDFV5d7IAN MpiPPb9nGuu8h8E/3+xtUoujjGNznEbCoMkavWra3jhmaCG4vX5djppNNNv5mf+5khvV RAcRsnCpkopxzLfAGQEgtlKcZITIn10V7yXKe6Z73UkKUTMc98BmXvX9UDsma3ea/3UO SyRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ujvorCjT; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a170902e9d400b001783edea139si5448657plk.352.2022.09.16.04.42.29; Fri, 16 Sep 2022 04:42:42 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=ujvorCjT; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232212AbiIPK1t (ORCPT + 99 others); Fri, 16 Sep 2022 06:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231955AbiIPK0h (ORCPT ); Fri, 16 Sep 2022 06:26:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDA2365675; Fri, 16 Sep 2022 03:15:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CE5E2B82508; Fri, 16 Sep 2022 10:14:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28111C433C1; Fri, 16 Sep 2022 10:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663323286; bh=OSeSvRnImeo8dv9QwngwQ9WiyEgOdmCucfPlzB1B/e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ujvorCjTfjBPNpRBQN6iDGaMqKAFNSXkjtpiA5MbkQ701LOfPU+CFFN0cOu1aUPlC hYmubebJRxUqcZNQBF81Q7NgWOB1QCo9Yu4a2ilKgQG035/iURqu0VS0svC/BeKVch YRjtGMFpBCKcTEkCNYcykTP8hlLYtYuCdvs/76S8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Breathitt Gray , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.19 36/38] gpio: 104-idio-16: Make irq_chip immutable Date: Fri, 16 Sep 2022 12:09:10 +0200 Message-Id: <20220916100449.977361343@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220916100448.431016349@linuxfoundation.org> References: <20220916100448.431016349@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: William Breathitt Gray [ Upstream commit 410a5041aa60d91ff66a861560e7c879d664270f ] 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 Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- 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 45f7ad8573e19..a8b7c8eafac5a 100644 --- a/drivers/gpio/gpio-104-idio-16.c +++ b/drivers/gpio/gpio-104-idio-16.c @@ -150,10 +150,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); @@ -168,11 +169,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); @@ -193,12 +195,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) @@ -275,7 +279,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; -- 2.35.1