Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp6358082pxb; Thu, 27 Jan 2022 12:02:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+8j3HvN2Jo7vTG0tzjqWzCsH3tSg2ve+iEm4fFcmEP7DAwv+9dU1hONNRry1pPWUGOed7 X-Received: by 2002:a17:903:187:: with SMTP id z7mr4750899plg.123.1643313774931; Thu, 27 Jan 2022 12:02:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643313774; cv=none; d=google.com; s=arc-20160816; b=egSHFV2rAeyaUrLa8+Ef2Ql6oxdNIZNuExowhnFPG0CNfMAnKnoyRf5rW3VN3HZK5i rYc7aczmX/DxvFeDxslnJdZPo93araZdn6mnS8vKclTCqFpGqaaN6a74SptDpbfp9K5C AmThWLEnH8A6tWk6hT5318qWd1oGvGPYhwNGtQqxT9vEXuuT8J0fipJWo4SNdQJzqCzs 4TYZ08P4WuhCFglwE8ySp7p1rS+TGLVQeSt6qKcZu7veBAqGFwmf//hna34DRIWfgxJc UYrkVcZHOXltA05uwosYW8vAFw7266/VzN0W9KC+J+jHHrIbwewEg3SrCbXfDYvEbyHT OIRQ== 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:dkim-signature :dkim-signature:from; bh=i7B20wzlMtToieI5G7tCnCKu5TFMOwHYL5yYAy+C5s0=; b=aZx/OJ9uS13a/mV+mZCiKWkZDkQt+QNK3vm9yVHJGJ4liNpdIx5LIqjv9/t7Irk9EL kJ3IUOTQXD4ngf1aj+UQnRIbRTnp37JK2VqLB/+GLnnuVVU5ngvqVHMlbCCTeXMPuPLd C96/ccb5IlTVDdYiE+5lesvgC2ljESsZyLqkgUVRebRfHnSebrWs5wCgoch5xpvhVHoG olmqJbcNMfq71NM3a+5aNV0GGFO8EbzdSIkFsmYaouJszxZ1WM7C3v/Vd58QIwVIat0R 4NBlQayGDXbh9KXWPBOWYGMv+FjCmLnQ53+yf/ppnFfJbMrJoijcKUZf7+nx55EtRGcY 1Reg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JBkP8NyE; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si266182pjm.50.2022.01.27.12.02.42; Thu, 27 Jan 2022 12:02:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JBkP8NyE; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240477AbiA0LdS (ORCPT + 99 others); Thu, 27 Jan 2022 06:33:18 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:35652 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240431AbiA0LdP (ORCPT ); Thu, 27 Jan 2022 06:33:15 -0500 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643283194; 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=i7B20wzlMtToieI5G7tCnCKu5TFMOwHYL5yYAy+C5s0=; b=JBkP8NyESqVS1Hlzz9WJk5NOcg243nCN04rH587WjPfrsgbMd+GF/cLL/KbCXARSBGy1te hnCMEdp37RY02ygC9IbYA60OWJRD5q7sv+jMgvDu1eUKskhYRm8bG1FdR30mutei0b5Wi4 0k2g6OoFCBnXNs6C8CXFmSE+P3tuS6qhvlOyeWawldEug7w4y5qGsgUCe8Ca2Q1TguzFAY VtqdCdIlbp3ysKNH7OdDI0WzDdkrdnrKM/ELtMGf8lwFX15SItsdZSArQhIdQB4OHefEDF pAiL+soouMZwsuDsrY0hfyAN42JEj2I+goxptLQyo3+9vr4MAWvXSJMxVycebA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643283194; 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=i7B20wzlMtToieI5G7tCnCKu5TFMOwHYL5yYAy+C5s0=; b=rx72YmxkZxACjESl0FCo5J02aVqivX+TAKPihjEbioTCo9OxW5XT5J4ODTO61qpGacEqwu WPl6X2GShe2I5oAw== To: greybus-dev@lists.linaro.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: "David S. Miller" , Alex Elder , Arnd Bergmann , Greg Kroah-Hartman , Hans de Goede , Jakub Kicinski , Johan Hovold , Lee Jones , Rui Miguel Silva , Thomas Gleixner , UNGLinuxDriver@microchip.com, Wolfram Sang , Woojung Huh , Sebastian Andrzej Siewior Subject: [PATCH 1/7] genirq: Provide generic_handle_irq_safe(). Date: Thu, 27 Jan 2022 12:32:57 +0100 Message-Id: <20220127113303.3012207-2-bigeasy@linutronix.de> In-Reply-To: <20220127113303.3012207-1-bigeasy@linutronix.de> References: <20220127113303.3012207-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide generic_handle_irq_safe() which can be used can used from any context. Suggested-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior --- include/linux/irqdesc.h | 1 + kernel/irq/irqdesc.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 93d270ca0c567..a77584593f7d1 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -160,6 +160,7 @@ static inline void generic_handle_irq_desc(struct irq_d= esc *desc) =20 int handle_irq_desc(struct irq_desc *desc); int generic_handle_irq(unsigned int irq); +int generic_handle_irq_safe(unsigned int irq); =20 #ifdef CONFIG_IRQ_DOMAIN /* diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 2267e6527db3c..97223df2f460e 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -662,6 +662,27 @@ int generic_handle_irq(unsigned int irq) } EXPORT_SYMBOL_GPL(generic_handle_irq); =20 +/** + * generic_handle_irq_safe - Invoke the handler for a particular irq + * @irq: The irq number to handle + * + * Returns: 0 on success, or -EINVAL if conversion has failed + * + * This function must be called either from an IRQ context with irq regs + * initialized or with care from any context. + */ +int generic_handle_irq_safe(unsigned int irq) +{ + unsigned long flags; + int ret; + + local_irq_save(flags); + ret =3D handle_irq_desc(irq_to_desc(irq)); + local_irq_restore(flags); + return ret; +} +EXPORT_SYMBOL_GPL(generic_handle_irq_safe); + #ifdef CONFIG_IRQ_DOMAIN /** * generic_handle_domain_irq - Invoke the handler for a HW irq belonging --=20 2.34.1