Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4483911rwl; Wed, 28 Dec 2022 04:57:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXv2gOQ1+5txYcd3PQKb1DhkXtN360dMNxrD/PXshapoAPcc6CGaX6cpKk7lflIrfzM4lO2r X-Received: by 2002:a17:902:7243:b0:189:30cd:8fa2 with SMTP id c3-20020a170902724300b0018930cd8fa2mr32645132pll.50.1672232249564; Wed, 28 Dec 2022 04:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672232249; cv=none; d=google.com; s=arc-20160816; b=lv1S3RG7A8DI/5FBfLIDHDm+fUKDdi/ACkQIeZm0AbA775dw9F1jcdj4c0QX9jo6QZ rPcRbAymvE54o5sQKeIJbsa1kdoIHhgCFyAdN2XN8VCgCEcH5K/1yBR8NAGJ6WdN7Yiq N4XElcOwohNqdmylhuW7KSdoz4UjQGLOBLpgWjBt0t7SqjWYqc+XSgilVy5LdKMf8G5T 9s5l/VmpozPRm2iiENSMti9QAN1KF2lFPf9d7NGG4MZE1nIKB8sDu4qBrAOXS0pxeKR3 ekXLB1vcEcRZyIuz5wyKO5w+H1Sr/l3kui+k+1ssjMDHOFSReABPUZwC7TcqlDPkb/pI 47XA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BTPJCC4TTwP84BBs21zNnyfu2sa/UTInRsPtE+n30Ws=; b=GqJSpLXZCWmVJyfwzFzuAmUF25KeC0UJIEIgf+D4pXQHe6dQ5+tj2R/VjJru4+1RES z+x6JD54P3YLJOsvNMIAE/v8KmKY8tG3Ev/TN9cn2iN1VKFseutvi3qnaB0UBX51lXZ9 M46gTmmAENzoSnIfX+nbRRXYufTFAC/sxsZejysWJ0aTLNhiB1EK6EXLSyFVmFv+34kH 63rCjkZVMrp3LZSGtc6Tix1AZ4oDOvE+GkNUikiMd9aoQopSkHWLm7vaPWvYJCDPQI0q CLbP0dwGD+mjJj42msR5VN9WjqSstyr3ino3dymLOhQ2EdG89DS/OAaSQkt6tBWHgWH8 AUEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=V1S7bplS; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020a170902f60100b001928c9d771asi4457274plg.517.2022.12.28.04.57.19; Wed, 28 Dec 2022 04:57:29 -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=@linux.dev header.s=key1 header.b=V1S7bplS; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232918AbiL1Mc7 (ORCPT + 64 others); Wed, 28 Dec 2022 07:32:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232830AbiL1MZL (ORCPT ); Wed, 28 Dec 2022 07:25:11 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60CD72BA; Wed, 28 Dec 2022 04:25:10 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1672230309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BTPJCC4TTwP84BBs21zNnyfu2sa/UTInRsPtE+n30Ws=; b=V1S7bplS+y8D9cCLAQGLJABikiXryBsHamNvolWehSPkVGmzskHzmK0d9V/KdWty0+tj/N XS6PWb4TbHD/7k8mFgTf5Yk0sY29fIP8dheLnyntQ8dUSYTF7H4VMwwU5ehVQfGQRwS8Z8 6SMai/It+C3fIamoNts88ANxY8FYot8= From: Cixi Geng To: linus.walleij@linaro.org, brgl@bgdev.pl, orsonzhai@gmail.com, baolin.wang@linux.alibaba.com, zhang.lyra@gmail.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, cixi.geng1@unisoc.com Subject: [PATCH V3 3/3] gpio: gpio-sprd: Make the irqchip immutable Date: Wed, 28 Dec 2022 20:24:42 +0800 Message-Id: <20221228122442.392504-4-cixi.geng@linux.dev> In-Reply-To: <20221228122442.392504-1-cixi.geng@linux.dev> References: <20221228122442.392504-1-cixi.geng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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: Cixi Geng Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions. Reported-by: kernel test robot Reported-by: Julia Lawall Signed-off-by: Cixi Geng --- drivers/gpio/gpio-sprd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-sprd.c b/drivers/gpio/gpio-sprd.c index 9bff63990eee..072b4e653216 100644 --- a/drivers/gpio/gpio-sprd.c +++ b/drivers/gpio/gpio-sprd.c @@ -120,6 +120,7 @@ static void sprd_gpio_irq_mask(struct irq_data *data) u32 offset = irqd_to_hwirq(data); sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 0); + gpiochip_disable_irq(chip, offset); } static void sprd_gpio_irq_ack(struct irq_data *data) @@ -136,6 +137,7 @@ static void sprd_gpio_irq_unmask(struct irq_data *data) u32 offset = irqd_to_hwirq(data); sprd_gpio_update(chip, offset, SPRD_GPIO_IE, 1); + gpiochip_enable_irq(chip, offset); } static int sprd_gpio_irq_set_type(struct irq_data *data, @@ -205,13 +207,14 @@ static void sprd_gpio_irq_handler(struct irq_desc *desc) chained_irq_exit(ic, desc); } -static struct irq_chip sprd_gpio_irqchip = { +static const struct irq_chip sprd_gpio_irqchip = { .name = "sprd-gpio", .irq_ack = sprd_gpio_irq_ack, .irq_mask = sprd_gpio_irq_mask, .irq_unmask = sprd_gpio_irq_unmask, .irq_set_type = sprd_gpio_irq_set_type, - .flags = IRQCHIP_SKIP_SET_WAKE, + .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int sprd_gpio_probe(struct platform_device *pdev) @@ -245,7 +248,7 @@ static int sprd_gpio_probe(struct platform_device *pdev) sprd_gpio->chip.direction_output = sprd_gpio_direction_output; irq = &sprd_gpio->chip.irq; - irq->chip = &sprd_gpio_irqchip; + gpio_irq_chip_set_chip(irq, &sprd_gpio_irqchip); irq->handler = handle_bad_irq; irq->default_type = IRQ_TYPE_NONE; irq->parent_handler = sprd_gpio_irq_handler; -- 2.34.1