From nobody Mon Feb 9 00:47:03 2026 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) (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 EEA4F171A1 for ; Mon, 8 Apr 2024 23:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.36.163.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712619663; cv=none; b=mF58f9JVga/WEcx7oCpNLUDNOkq2LR5bMaPdYzKcGH669VBxOYBbSpOQZawwXNPF3w0Xe+vGUUcDJDASltJ+xNwseKUi/39XQTAXu+Kvl7eowmUWgwP/UspExanYcfy3w61IeSllHvdAa5fZZX++VKYQd9H3TSAZWoVa6PtZ9fQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712619663; c=relaxed/simple; bh=nGVBkZiKyNJu572sTsUpZ6tZsvjqorg2/fE5SwF8ubY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aM33B0ERvoScPEDRMhq2xkLHLCwAclMWKHwK7kW5Q7LuyX/wgPzHi1E4z8ktzTp9Y9MqH+8pmZaMhF6Li6Z2mpp0fSWt+3L1kLiNgMBCU1zZ6gtJYbPEYzr1bO6kYPuFcX1dPOXCvNZLBI5CklrwcpCq8YmaF3pWPLqo8AwAoEs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=alliedtelesis.co.nz; spf=pass smtp.mailfrom=alliedtelesis.co.nz; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b=CE3xrwCY; arc=none smtp.client-ip=202.36.163.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=alliedtelesis.co.nz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alliedtelesis.co.nz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b="CE3xrwCY" Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 56C3E2C023D; Tue, 9 Apr 2024 11:40:52 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1712619652; bh=ce2C3mFUjKHfphm5glLdo0kYS8B23G4tb8eLLffI+F0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CE3xrwCYAXgCKQ1ghoDmBjulloVo/VtAdpNIbvq4UNzpCPeTP+rt6xqb3qmeFsh2Q r44nTA2dbsbhjGzOJGXhvQ7g6E6LSjI2kua1lGo/Ryw15MpQb4WCxm/e+Ew6JFGb7o x9cMyPtz11JmNrVdRYKK2OHwibl4YwChRL/bfYCIa7Ubq6ZfhCrHqTdGxZPmyw+BRk rrc+sjRCw99MkaTG9NRX3MTR5k5BSCvxru+fL7w7udx1GHJsPXnK421TC0XCn9xaoI kvyu0R3DX+xFqEySBcxSMo1kxKZ0kqJ353AXYTTSWQHDmhRGtrNRYDRb0MIPE0ZdBC bpCZFwHzTmD6w== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Tue, 09 Apr 2024 11:40:52 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 3255113EE52; Tue, 9 Apr 2024 11:40:52 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 2EEA828058C; Tue, 9 Apr 2024 11:40:52 +1200 (NZST) From: Chris Packham To: gregkh@linuxfoundation.org, guanghuifeng@linux.alibaba.com, cleech@redhat.com, njavali@marvell.com, baolin.wang@linux.alibaba.com Cc: linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH v2 1/2] uio_pdrv_genirq: convert to use device_property APIs Date: Tue, 9 Apr 2024 11:40:48 +1200 Message-ID: <20240408234050.2056374-2-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240408234050.2056374-1-chris.packham@alliedtelesis.co.nz> References: <20240408234050.2056374-1-chris.packham@alliedtelesis.co.nz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.4 cv=AuZN3/9P c=1 sm=1 tr=0 ts=66148084 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=raytVjVEu-sA:10 a=0-5qEPbCpBJHDBHC09kA:9 a=3ZKOabzyN94A:10 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat Content-Type: text/plain; charset="utf-8" Convert the uio_pdrv_genirq driver to use the device_property_* APIs instead of the of_property_* ones. This allows UIO interrupts to be defined via an ACPI overlay using the Device Tree namespace linkage. Signed-off-by: Chris Packham --- Notes: Changes in v2: - Remove extraneous newline drivers/uio/uio_pdrv_genirq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 63258b6accc4..796f5be0a086 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c @@ -23,8 +23,8 @@ #include =20 #include -#include -#include +#include +#include =20 #define DRIVER_NAME "uio_pdrv_genirq" =20 @@ -110,7 +110,7 @@ static void uio_pdrv_genirq_cleanup(void *data) static int uio_pdrv_genirq_probe(struct platform_device *pdev) { struct uio_info *uioinfo =3D dev_get_platdata(&pdev->dev); - struct device_node *node =3D pdev->dev.of_node; + struct fwnode_handle *node =3D dev_fwnode(&pdev->dev); struct uio_pdrv_genirq_platdata *priv; struct uio_mem *uiomem; int ret =3D -EINVAL; @@ -127,11 +127,11 @@ static int uio_pdrv_genirq_probe(struct platform_devi= ce *pdev) return -ENOMEM; } =20 - if (!of_property_read_string(node, "linux,uio-name", &name)) + if (!device_property_read_string(&pdev->dev, "linux,uio-name", &name)) uioinfo->name =3D devm_kstrdup(&pdev->dev, name, GFP_KERNEL); else uioinfo->name =3D devm_kasprintf(&pdev->dev, GFP_KERNEL, - "%pOFn", node); + "%pfwP", node); =20 uioinfo->version =3D "devicetree"; /* Multiple IRQs are not supported */ --=20 2.43.2 From nobody Mon Feb 9 00:47:03 2026 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) (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 EEA7D1D699 for ; Mon, 8 Apr 2024 23:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.36.163.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712619664; cv=none; b=AayadeM/ec0BXmkGqzRchatCdA1RpoKJhnSxx32VKxL3l3m4CIkZtfZ7WEvuz+7qt4Zf05krmzvuwfhDZJqWdNx7Ma6sf3nz7DbHYwy0nIfYJu33KFGO3DJRSVho38vFoGqJMX4gn6i3K6mRfdtZNebCnbruFdt9i/a6mppvzvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712619664; c=relaxed/simple; bh=F6TpPh7NUX2CkBTZYVAkftU4gr3TzKGrTz28G2Ai128=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rNuAFtW78qu3h9Z1BRTxDQuqcPKKHpZRAhMjVtGAKiQn28rfqGKYLwSOyh4ZhJSDPgzOMRAyjnn2HOwwS6Jk6MSjUjZp903ib8d9TVC/ED+/QGfoOSiqs80d653wJOEy98rNyClmjWRqXPI9LmjhABFk8np6myDQ8z0ZZNdx/cQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=alliedtelesis.co.nz; spf=pass smtp.mailfrom=alliedtelesis.co.nz; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b=1sHYe6nh; arc=none smtp.client-ip=202.36.163.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=alliedtelesis.co.nz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alliedtelesis.co.nz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b="1sHYe6nh" Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 69E282C03C5; Tue, 9 Apr 2024 11:40:52 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1712619652; bh=tG4XBEHYBLX8lfUqr7++s9+IEeYNvdGxMpDJ7zllgQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1sHYe6nhp6iN9nTyFDQ/pWg0Nu765zjY7Od50DI2aVX1EnW6X22jw3CHqSqGOyxR1 pcGhuL7OkQiBqZoeftuXRpeH1bTYMpNbH92jguuuf8Qu/V/yp3pFOAjq3u7WqiOhTQ e4neUkCikd1nUIuWpSvA3yb307G46uUcyz68xIe9PnewUNPnjQQ52sm2ngKhg6BLg1 38SQmLb2oT0Fafj12VO+nkdD11W6pDaqitWlbaOCJitLcj0c7B4Xsu+pXKc9rkJWni ak5Ar+GSLqBdKRHWBVw/UP9l9b1jlOeeuGk0E98pBxY0zh3YRFeyBbBAYlBNOMN3y2 fPMR4TFYPUxOA== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id ; Tue, 09 Apr 2024 11:40:52 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 371C213ED0C; Tue, 9 Apr 2024 11:40:52 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 34A2028078B; Tue, 9 Apr 2024 11:40:52 +1200 (NZST) From: Chris Packham To: gregkh@linuxfoundation.org, guanghuifeng@linux.alibaba.com, cleech@redhat.com, njavali@marvell.com, baolin.wang@linux.alibaba.com Cc: linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH v2 2/2] uio: use threaded interrupts Date: Tue, 9 Apr 2024 11:40:49 +1200 Message-ID: <20240408234050.2056374-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240408234050.2056374-1-chris.packham@alliedtelesis.co.nz> References: <20240408234050.2056374-1-chris.packham@alliedtelesis.co.nz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.4 cv=AuZN3/9P c=1 sm=1 tr=0 ts=66148084 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=raytVjVEu-sA:10 a=J0zaVX0nx6ystpX9sXEA:9 a=3ZKOabzyN94A:10 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat Content-Type: text/plain; charset="utf-8" Split the existing uio_interrupt into a hardirq handler and a thread function. The hardirq handler deals with the interrupt source in hardware, the thread function notifies userspace that there is an event to be handled. Signed-off-by: Chris Packham --- Notes: I find myself needing to have a UIO interrupt associated with an interrupt pin on a PCA9539 (yes I know, it's a terrible chip but HW engineers love it because it's cheap). =20 Prior to this the UIO registration fails with: =20 [ 6.484699] uio_pdrv_genirq detect-gpio-9: unable to register uio = device [ 6.484722] uio_pdrv_genirq detect-gpio-9: probe with driver uio_p= drv_genirq failed with error -22 =20 The -EINVAL ultimately comes from __setup_irq() where it knows the interrupt descriptor is nested but we haven't provided a thread_fn. =20 Changes in v2: - None drivers/uio/uio.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index bb77de6fa067..a86cf2e4f200 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -442,18 +442,27 @@ EXPORT_SYMBOL_GPL(uio_event_notify); * @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer * @dev_id: Pointer to the devices uio_device structure */ -static irqreturn_t uio_interrupt(int irq, void *dev_id) +static irqreturn_t uio_interrupt_handler(int irq, void *dev_id) { struct uio_device *idev =3D (struct uio_device *)dev_id; irqreturn_t ret; =20 ret =3D idev->info->handler(irq, idev->info); if (ret =3D=3D IRQ_HANDLED) - uio_event_notify(idev->info); + ret =3D IRQ_WAKE_THREAD; =20 return ret; } =20 +static irqreturn_t uio_interrupt_thread(int irq, void *dev_id) +{ + struct uio_device *idev =3D (struct uio_device *)dev_id; + + uio_event_notify(idev->info); + + return IRQ_HANDLED; +} + struct uio_listener { struct uio_device *dev; s32 event_count; @@ -1024,8 +1033,8 @@ int __uio_register_device(struct module *owner, * FDs at the time of unregister and therefore may not be * freed until they are released. */ - ret =3D request_irq(info->irq, uio_interrupt, - info->irq_flags, info->name, idev); + ret =3D request_threaded_irq(info->irq, uio_interrupt_handler, uio_inter= rupt_thread, + info->irq_flags, info->name, idev); if (ret) { info->uio_dev =3D NULL; goto err_request_irq; --=20 2.43.2