From patchwork Wed Feb 28 11:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Patchwork-Id: 207784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3289560dyb; Wed, 28 Feb 2024 03:45:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUP9h4doPaOsg3voG3GzrkITAhWZ3sRfD+5oZ+3PIAY54sUUKElizrJGa6dC6vj7ZJ1F7gry7ZrSpemEnmroCtUqTzz8A== X-Google-Smtp-Source: AGHT+IE77+Gi3WgfwhDd+jPMp2XNyJ/MaDqJXGHLXt8JCCtmZsNJuSgNgpMsQxdS6AO3fAsB5VM/ X-Received: by 2002:a05:6870:d392:b0:21e:825b:1cda with SMTP id k18-20020a056870d39200b0021e825b1cdamr14920401oag.17.1709120734422; Wed, 28 Feb 2024 03:45:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709120734; cv=pass; d=google.com; s=arc-20160816; b=ts/cMZEhsRPgXDrLG83W9FqTafwR7WuQ7snLnosNs5vpt4PAad2s5nYZJ54z163up/ z7kseypNX35azmLoFH1KlcDEq7jMNA6qzNP6tcO4Yn92sWRT5xfdBkayoPxua/zLZBvs 3NJ77vPlwWCxAN9JbBlQhcKhF32DN/SZhx0jmK0SmIm7+xl+mRXVYlMleolXXeOKH7b2 wiZTp6b81B1kSABqxjkxG+re4PZJR2Ul18xuGxYQj99GvS7E+PMs723/C3/btBUo+XLU o+dPP+jmO7ys9MIOakr3hwMMfQySZqLhS4LQcsZLlb5tK8C+m2V1B5EVeaWcAa7Gh0Tt aHuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=FNoO6vmJ9el3v5aN6NX8aYKdgPlN5duDCePRMfT5iF0=; fh=n7XGc60qr+bhE+23iumYKk4CHvQA06ClFbqKYWc01x4=; b=yEcc0R47Qn/A9RDrz7MYlycB182K92LP8SuIXBuBbd/EgDGm8e268eA01Q41DTaZ5G nSX1f72F6rl9koQkwJq6OHA3xug5u5udegLKXu8wZsR0dwDxC5KfuCSAXOJJo9WUq712 WR6egf3jBCUg1x3k7G5JGwb1OE5KlfGtx4tATDT8OsPx51mcwqmjLZ2+HiTR0vxin7rc 4GS+Ficor1OmH6hCYES6tilmsEY8aUltv1Li9FW8Dn0tOurOMfenXcpcFsbnH2Nebw6t tRn5eIunNAdUjsnI8jiPDfUKQm7aT8u36gSjDORG2OHa67XaAwsf0AWLkCaXqIInsgC2 dnFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=FPs4A+FS; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-84903-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84903-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j15-20020a63594f000000b005cdf992367csi7142269pgm.691.2024.02.28.03.45.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:45:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84903-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=FPs4A+FS; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-84903-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84903-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D6C9C28E275 for ; Wed, 28 Feb 2024 11:36:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EACB15E5C9; Wed, 28 Feb 2024 11:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="FPs4A+FS" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46A3215B100; Wed, 28 Feb 2024 11:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709119714; cv=none; b=QjY2t4z/+VFfCHPzFNZcucB7BPGtDA46gH2aMOT8B2tJ0Nc4I4D1M3BWR1pAaS4J9uRuYDY3rIALtQLtGiBu/LcnJ7hSm1kkhw4QmwQ888gv7gv71NXR1VYHFtck9qFDaVWcWUM4Lyo0lAG9IuNi4HGKc7IU9UQJGk4Avqta1FM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709119714; c=relaxed/simple; bh=CuQIZkGPYKfwIxHjL83ks3D5WIvU+cFZKGpyf39cIfk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ETMMRDvFqotPBiK1YgXGcIp7qjlhHFQf0VG0T4H/ij15rn1rf1ycNydbl+Bg9k5ZJQ48AjCSfdyaKsLHyCehQQEJwi9aAe9w+AkjQ7eJ/fCafcQYxszaU7uczXZ6cKLUZDskrD2qgNq3MtR92KfTWwk2h9Xv/tGT8iLOX0L94ds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=FPs4A+FS; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 7DEAD1BF216; Wed, 28 Feb 2024 11:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709119710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FNoO6vmJ9el3v5aN6NX8aYKdgPlN5duDCePRMfT5iF0=; b=FPs4A+FSUsI1jbmC5iRp/YjJ5AetOfXSFRU/BbEMB8tPtEzk8ghIPZvPVYoEE9QrzAALr7 PYLOp+tdssftRzOGsKPmKwsiDsp8lJbtqsjXyQRE1xx48ZBJfuNngfeqKmp0cxN7LeFbJ6 9SPUDb2BYKToI3Mic91+gTQOtqA8ZbBa4SC/wC1pyK51coWhuwH5sohz/QtA2m2R133V03 /NUUU8qlZtHa4bC76oGxJ5cK/0FezljCo7PWfIJPBG2EgrdfMk/ND049CjHnTa0u8Xi/t0 TgiE4MWdX0mBJ98RYVzABKHdHhzWKQhaSFiWAsXLSGMoMtzmq9uvFHGazvYWKA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 28 Feb 2024 12:28:24 +0100 Subject: [PATCH v2 26/30] Documentation: gpio: mention generic_handle_irq_safe() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240228-mbly-gpio-v2-26-3ba757474006@bootlin.com> References: <20240228-mbly-gpio-v2-0-3ba757474006@bootlin.com> In-Reply-To: <20240228-mbly-gpio-v2-0-3ba757474006@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Thomas Bogendoerfer Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Gregory CLEMENT , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= , Stephen Warren , Jonathan Corbet , linux-doc@vger.kernel.org X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792142983425471207 X-GMAIL-MSGID: 1792142983425471207 generic_handle_irq() must be called from a no-IRQ context. Documentation advices on using a fake raw lock to call generic_handle_irq() from any context. Since 509853f9e1e7 ("genirq: Provide generic_handle_irq_safe()"), a better alternative is available. To: Stephen Warren To: Jonathan Corbet Cc: linux-doc@vger.kernel.org Signed-off-by: Théo Lebrun Reviewed-by: Linus Walleij --- Documentation/driver-api/gpio/driver.rst | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst index bf6319cc531b..550d167a82ed 100644 --- a/Documentation/driver-api/gpio/driver.rst +++ b/Documentation/driver-api/gpio/driver.rst @@ -339,15 +339,8 @@ Cascaded GPIO irqchips usually fall in one of three categories: The generic_handle_irq() is expected to be called with IRQ disabled, so the IRQ core will complain if it is called from an IRQ handler which is - forced to a thread. The "fake?" raw lock can be used to work around this - problem:: - - raw_spinlock_t wa_lock; - static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) - unsigned long wa_lock_flags; - raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags); - generic_handle_irq(irq_find_mapping(bank->chip.irq.domain, bit)); - raw_spin_unlock_irqrestore(&bank->wa_lock, wa_lock_flags); + forced to a thread. generic_handle_irq_safe() can be used to work around + this problem; it can safely be called from any context. - GENERIC CHAINED GPIO IRQCHIPS: these are the same as "CHAINED GPIO irqchips", but chained IRQ handlers are not used. Instead GPIO IRQs dispatching is