From nobody Mon Feb 9 05:01:47 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 1BCD3305E32; Mon, 2 Feb 2026 19:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061252; cv=none; b=D5RzA9RJZc26mspmTFdwfji3J19hDzT1Z3Q/Jdkhhjz6qHsfHNSCyxWtx3ZNFiLv/RvaTJPZd1Tjb1pZuWSFE4t3YFKmv8SD87E9DCVAmy0DHWW9Hm4tfWYicC5/sg16me6Xutmc1B4DnOjVaKQnDAOK6Mm9qCxfSKEoOSpM0e0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061252; c=relaxed/simple; bh=5QxBWkL2GpHirekmd8T2XkjiVKcSsgff4NWpA8kRhvI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q/9tDU3Ls3+LsG7a77fsXFovFV7giw0BR86oTW8dFcnFHQWez/6xgFE/FvPxKOwzmPRAPYDtubnreAI7R88b2mfV1UCkhVwiwPJM7x92NZqa7Ag0nL98/njxM1aKwofKCoFkgRj1bGEnq1eQvVcUY6YHpcs/W7tgi9PctsRkL/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=qMfso7w0; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="qMfso7w0" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612J2aTf1383306; Mon, 2 Feb 2026 19:40:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=kto37 XlM9klCE2nsRYmNAN7SW5yE4yqWww2L5yHHUF0=; b=qMfso7w0FmoOEDBjI0K0l 2j459kn7paHGEqbw8BAIhT6/jT2K0pjapqFZ3VvFxEUCvZ286LHw9piKDepKISZ8 PCH+utwzxqn57Z8E3x1PO/IMSZMn7eabTqgi1G+NpmLGHsArYqlgxXQikoMXdn8b NydAEb2A5nT6HkdsYilP6OqlJfXSZdgbKPituqSR+BA/chds8QN/2yxpb6FYZ6bb 2KfLFvIZFz5k5vNzrtQBqoPMNJxgJwSWW1K5PWIBwJAQKYjwf8hCojIF8fRsqSVw eoEcCoXzti6a+lAHgvYP7mmobQIvQLmigSjMF62B2j2eV54MvPfsREUETchHRGFg Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4c1arhjux5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:42 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 612IfVPV001209; Mon, 2 Feb 2026 19:40:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4c1868urx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:41 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 612JeaU1019500; Mon, 2 Feb 2026 19:40:40 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4c1868ursy-2; Mon, 02 Feb 2026 19:40:40 +0000 From: Harshit Mogalapalli To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Harshit Mogalapalli , Antoniu Miclaus , Andrew Ijano , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, error27@gmail.com, andriy.shevchenko@intel.com Subject: [PATCH v2 next 1/5] iio: sca3000: cache SPI device ID in probe Date: Mon, 2 Feb 2026 11:40:08 -0800 Message-ID: <20260202194033.627967-2-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> References: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> 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-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_05,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2602020154 X-Proofpoint-ORIG-GUID: GPcfrHGciQEN0Bc6W1ti9DAke3iFKEO6 X-Proofpoint-GUID: GPcfrHGciQEN0Bc6W1ti9DAke3iFKEO6 X-Authority-Analysis: v=2.4 cv=fdmgCkQF c=1 sm=1 tr=0 ts=6980fdba cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=QyXUC8HyAAAA:8 a=yPCof4ZbAAAA:8 a=eY56iXQc7nrdnX74TsgA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDE1MyBTYWx0ZWRfXxAoKzXfEw01P SvB6QVaVo+SrP8wlqsGtPX8x9jBQJd8mo8jxANetqyB1QEjKzBAJRt9q+MlPP243wrF/kD7INsI nwDsaW/ZJewvq+q5+xD/oaJqt2jWWpb8oW8eTq3SlGfMswMmqv5mlu/3QZVlcXMpyYJeWe7O9su lgNUDj56A9CIQpKJfHLNLCtZNQf2aYlXfKB8MEF4tcb5N61uAcVnuTOjj34BBHAhO/VBSZZgkMj GmyGA1Ct64bWqbbLAALhxubwYnrwZI2uzCtwL1ay8h1JUVIyfMtEkrqGR1hrxWCOFvhXpIByxjY yPghkuly3bkVN9rU9FfhuRokSBCfX1O91YcDthGxfT9wkXoVzCQaYNTbRO3g3prHovuRqz4lQLm JIiIVeG3ZdK7eipTtsZ8w3hR52Rwxuq/7OVW9wFdCfjR3AAfRudtofzAlCLFyK2aTSHMWqnFqKi cMF+hNSivpVOU1mlEgQ== Content-Type: text/plain; charset="utf-8" Store the spi_device_id at probe entry and reuse it for the name and chip info instead of calling spi_get_device_id() repeatedly. Reuse the local dev pointer for resource managed helpers. While at it, reshuffle variable list in a reverse Christmas tree order. No functional change intended. Suggested-by: Andy Shevchenko Signed-off-by: Harshit Mogalapalli --- v1->v2: No change --- drivers/iio/accel/sca3000.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 9ef4d6e27466..afe6ef61a53b 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -1439,11 +1439,13 @@ static const struct iio_info sca3000_info =3D { =20 static int sca3000_probe(struct spi_device *spi) { - int ret; + const struct spi_device_id *id =3D spi_get_device_id(spi); + struct device *dev =3D &spi->dev; struct sca3000_state *st; struct iio_dev *indio_dev; + int ret; =20 - indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*st)); if (!indio_dev) return -ENOMEM; =20 @@ -1451,10 +1453,9 @@ static int sca3000_probe(struct spi_device *spi) spi_set_drvdata(spi, indio_dev); st->us =3D spi; mutex_init(&st->lock); - st->info =3D &sca3000_spi_chip_info_tbl[spi_get_device_id(spi) - ->driver_data]; + st->info =3D &sca3000_spi_chip_info_tbl[id->driver_data]; =20 - indio_dev->name =3D spi_get_device_id(spi)->name; + indio_dev->name =3D id->name; indio_dev->info =3D &sca3000_info; if (st->info->temp_output) { indio_dev->channels =3D sca3000_channels_with_temp; @@ -1466,7 +1467,7 @@ static int sca3000_probe(struct spi_device *spi) } indio_dev->modes =3D INDIO_DIRECT_MODE; =20 - ret =3D devm_iio_kfifo_buffer_setup(&spi->dev, indio_dev, + ret =3D devm_iio_kfifo_buffer_setup(dev, indio_dev, &sca3000_ring_setup_ops); if (ret) return ret; --=20 2.47.3 From nobody Mon Feb 9 05:01:47 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 E12503090D9; Mon, 2 Feb 2026 19:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061254; cv=none; b=TF+DIIsiuF/0A1BmXrWVbayYR1TtcqOj+PEWHrwuHoaxqcTNWAma20M5s4cWlqozHGmzx/S5nnrV6fryV/rM7a2go6xiB1ocv+99SSnCgOYzWFMSTJTw0LY+yt5D/WWvYnqtF9dEEYhZ1RyfaVgASO8VNt2JCVQsqpkyTqlK/14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061254; c=relaxed/simple; bh=HVC9ArOx9WOxUBJqsf78/JGCJReRMpqOsXB0aZ+LDoY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MzKyqaJJW6jxQryC14FWd+5M6uTgHr+OxwUdlSgBg42qtcYI8GaI8OIFKdK18Im3neTD06K0YACXpUuaXVJRx9P7EJFd4R+dY05DdXiZh6T024CkMmFiwNQ80mUXv7+lh2oE9Qnw9TrWByRigjuONSBY3OjBeJFXJRS34whskx0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=AfKg39PF; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="AfKg39PF" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612J6w0m1430165; Mon, 2 Feb 2026 19:40:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=aGYRa zAzFESOV0UG63MxkTWbBoME3/WVsyh+DS4KLN0=; b=AfKg39PFdR/IgYyetAWF5 npN4aMZcCJ/kKZVF0NzruT1qPo10pqgcoz62QQQEf0TZgWnRL78IQ5pN4ywA/nMk BTsUNN+ItZ+Z03b5PIkhAunLtsGJsYRf/wyUIdL1FmyqOIBzZ9Y0IfpCiuVvghep iumAcQM7sT9Ey/zG6ZIOHGZJS2OF3ZzJY5jwHH80TQkm+IbvgZq0q3i+TJxHBPWf SlJfqKi5iICsTwfkIvw8kZGD09g7AV5E3lSnApNe2801yP7xS/L8ei6tlNrbO4JU kqH6/6jZ5KRNDqrGe624n9gpc0EuMvQih/tgni6JkZGCAfa+/C/kYwAFrLRbWKMe Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4c1au62vg8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:46 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 612JTTJb001228; Mon, 2 Feb 2026 19:40:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4c1868us15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:45 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 612JeaU3019500; Mon, 2 Feb 2026 19:40:45 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4c1868ursy-3; Mon, 02 Feb 2026 19:40:45 +0000 From: Harshit Mogalapalli To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Harshit Mogalapalli , Andrew Ijano , Antoniu Miclaus , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, error27@gmail.com, andriy.shevchenko@intel.com Subject: [PATCH v2 next 2/5] iio: sca3000: switch IRQ handling to devm helpers Date: Mon, 2 Feb 2026 11:40:09 -0800 Message-ID: <20260202194033.627967-3-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> References: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> 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-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_05,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2602020154 X-Proofpoint-GUID: -1saqS-MAbzJ6eR3Z7MGiCau5gIFUBXn X-Proofpoint-ORIG-GUID: -1saqS-MAbzJ6eR3Z7MGiCau5gIFUBXn X-Authority-Analysis: v=2.4 cv=Nf7rFmD4 c=1 sm=1 tr=0 ts=6980fdbe cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=QyXUC8HyAAAA:8 a=yPCof4ZbAAAA:8 a=X8t9xCqtd0ov-FsuJpcA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDE1MyBTYWx0ZWRfXyvTQelgAQ7W0 m8cC4Q9QXCaWQzdC8OYTkg4wbw64QxqMgCoejocksMeuCGt1oMkMMRH/BAAK9XPNwVddZ9nUtM8 0XJI98LLWetVx5EaeLGubMlpVGjQGK5JXYNoZGdEfGueifQez2OyZi/KrC6ywhRD70wmPHT3LOj A6B2SQeH2tKjgdQwebmb/2mXtrNL6Vc2RD+2cOQ0NHImEQugi1ZzVuE9xiEYs0ldb9kR0nWPcic NnXdpbDM0xYKDi5kEjgpqUA6cFFVIG+SftvblqXtf+wKYFHTAS7PMsSgUwlUeFtwkSXJ5Qfy0j2 +Uj3MmK8kge9C6LWc6Xi/cUgQKRAh7VVm3Qwmgj7kgzZaN20sddSQE8OOmPl1wnPH0Uc+2RhP2u YJdq3uovhHKI/Hc4oXJ2RO0GF/60g1DzjjGLcm6hLAsC9Vl4Z7xyWGHDZ1gfy/TPOLrPjfhNdXT xMTffoCio7wRJuPoJoA== Content-Type: text/plain; charset="utf-8" Convert the threaded IRQ registration to devm_request_threaded_irq() so that the probe and remove paths can drop manual freeing of irqs. No functionality change. Suggested-by: Andy Shevchenko Signed-off-by: Harshit Mogalapalli Reviewed-by: David Lechner --- v1->v2: Fix indentation in devm_request_threaded_irq() call[ Thanks to Jonathan] --- drivers/iio/accel/sca3000.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index afe6ef61a53b..37ef724d5dc5 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -1473,34 +1473,27 @@ static int sca3000_probe(struct spi_device *spi) return ret; =20 if (spi->irq) { - ret =3D request_threaded_irq(spi->irq, - NULL, - &sca3000_event_handler, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "sca3000", - indio_dev); + ret =3D devm_request_threaded_irq(dev, spi->irq, NULL, + &sca3000_event_handler, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "sca3000", + indio_dev); if (ret) return ret; } ret =3D sca3000_clean_setup(st); if (ret) - goto error_free_irq; + return ret; =20 ret =3D sca3000_print_rev(indio_dev); if (ret) - goto error_free_irq; + return ret; =20 ret =3D iio_device_register(indio_dev); if (ret) - goto error_free_irq; + return ret; =20 return 0; - -error_free_irq: - if (spi->irq) - free_irq(spi->irq, indio_dev); - - return ret; } =20 static int sca3000_stop_all_interrupts(struct sca3000_state *st) @@ -1530,8 +1523,6 @@ static void sca3000_remove(struct spi_device *spi) =20 /* Must ensure no interrupts can be generated after this! */ sca3000_stop_all_interrupts(st); - if (spi->irq) - free_irq(spi->irq, indio_dev); } =20 static const struct spi_device_id sca3000_id[] =3D { --=20 2.47.3 From nobody Mon Feb 9 05:01:47 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 8D1A23090D9; Mon, 2 Feb 2026 19:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061259; cv=none; b=XBN9Hz2K3kLZWI/+OMVKOnDV3wrArRIOMpGK/f4H8KwbyY4rer7vcrNcWFrTrxWpDut/U57gg8KAZGfHHlhYEQSEk26xp4aDS175TEH0Ga9d6W8ZNYUJz2RMBsVA1gnYr1fVSE1x63Nhmc99F1hJfd8wrjVPEbFryVrT6klSP9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061259; c=relaxed/simple; bh=sD0utbWyrvtmYNTdsIZBf2XSHsJzIvm4Q8xEOrwaYkQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ITGzkE6VmRxIZhL+IJIvCi2atvST8X9igtSP/4kK0AqgkqncMeS+AQcfH0uGBBOA5DINkzWheYQOZCMk2JHJgWBL6mJfX+fJBnRplouNm1NrvhuWUPBJTqZJhniDmLUkdy9mjkvqv93IAGuhwtRORV43/kCmRUPHTFEbym+XeFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ltpYBCYA; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ltpYBCYA" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612JIoOT1385262; Mon, 2 Feb 2026 19:40:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=jZIGW dr7TYcOInlEBYPyl9CuinfHm0geUXksGpgjt44=; b=ltpYBCYAsfN0v+l+8l1t2 luarKTphfkDlgxxmFd4jhhUSiZu4p2U26LQy6I3fHmHglHJJrLVs8WxE/VQTbtoZ S6Ult6j0fjWv/ENLXTezI7ZTBNTYLbbHePOJ9ErkgcDrybTSPbtZEih+CG/lUy82 zE/Th1emxuJiiJSz4ptXZ8vnarN5FZeRl2C6atkQWIRw/uApIvqcpip5/JmtUMy5 rMHL4+Jevz9cEOwZr0EpIoD1k6rPbtM6jhGtER8XNDlGyUPhtuSruc//GHycUovC fJdJpVAqCTOxrcr+Rn/zhUYAtxW47azZoFi/7W/OcsEmgzhZ7T0jW4YWxwNPIbyx A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4c1arhjuxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:50 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 612JTTJd001228; Mon, 2 Feb 2026 19:40:50 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4c1868us43-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:50 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 612JeaU5019500; Mon, 2 Feb 2026 19:40:49 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4c1868ursy-4; Mon, 02 Feb 2026 19:40:49 +0000 From: Harshit Mogalapalli To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Harshit Mogalapalli , Andrew Ijano , Antoniu Miclaus , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, error27@gmail.com, andriy.shevchenko@intel.com Subject: [PATCH v2 next 3/5] iio: sca3000: stop interrupts via devm_add_action_or_reset() Date: Mon, 2 Feb 2026 11:40:10 -0800 Message-ID: <20260202194033.627967-4-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> References: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> 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-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_05,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2602020154 X-Proofpoint-ORIG-GUID: VAWc72KYQP86Sg77U16zdzgjDVfyHLVM X-Proofpoint-GUID: VAWc72KYQP86Sg77U16zdzgjDVfyHLVM X-Authority-Analysis: v=2.4 cv=fdmgCkQF c=1 sm=1 tr=0 ts=6980fdc3 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=QyXUC8HyAAAA:8 a=yPCof4ZbAAAA:8 a=r7h_biJ6kzdeNql_50MA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDE1MyBTYWx0ZWRfX79McXTXnCRet yOKw67WpMszGmS8zRCS7qx0y13q6t45qwtzy3USGOI/oBofiGFgRS+bosaE7h+6lM88dus6VPAH HM/dvNsfvLd2fHbZc9nRafNzkI+iHDtboTzjCvZcTsRR+vNpHwDYzqQoz9jhy4TkteAEtlgZAY0 e7FXA/3KpueZvI2JqKscGsdwZeNzZt76EImOA7GksbrS1xrZz9ZNGNCzT0wlMkX/QvDIuIZ2m/v UIPqvHynnBo9wBRzZ0zOT/+4+4x8+tlPR+7vzel/BbgsII4vIAqayKafF5fY8tj+P1v00UU2eb+ O2JeR1q5hSGWmZqtrDOlBxrKAJfSFfaAq1OrOA3s8Q1O1I04Aabto12ASOjDGGYZjDTu2p0pwRm xhw9FZNa577con5U2w9XzLU66G4ptOftBO4M1rPNfbbYr07N1E2W+Ec+4JwgIfqzsTJjgz1ESkg CPuwINpwXnOpFT4AcpA== Content-Type: text/plain; charset="utf-8" sca3000_stop_all_interrupts() is moved above the probe routine so the new function sca3000_disable_interrupts() used in probe can directly call it without additional declaration. Used devm_add_action_or_reset() for shutting down the interrupts. No functional change intended. Suggested-by: Andy Shevchenko Signed-off-by: Harshit Mogalapalli --- v1->v2: Jonathan found a broken tear down sequence that was introduced by my ptach 3 in v1: https://lore.kernel.org/all/20260131163218.2a4b93e5@ji= c23-huawei/ So first converted the interrupt disabling task to devm based call, order of tear down is as follows after this patch: iio_unregister_device is called in the remove() callback, post which any interrupts will be disabled with devm_add_action_or_reset() call. --- drivers/iio/accel/sca3000.c | 53 ++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 37ef724d5dc5..4faffeea328c 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -1437,6 +1437,33 @@ static const struct iio_info sca3000_info =3D { .write_event_config =3D &sca3000_write_event_config, }; =20 +static int sca3000_stop_all_interrupts(struct sca3000_state *st) +{ + int ret; + + mutex_lock(&st->lock); + ret =3D sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); + if (ret) + goto error_ret; + ret =3D sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR, + (st->rx[0] & + ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER | + SCA3000_REG_INT_MASK_RING_HALF | + SCA3000_REG_INT_MASK_ALL_INTS))); +error_ret: + mutex_unlock(&st->lock); + return ret; +} + +static void sca3000_disable_interrupts(void *data) +{ + struct iio_dev *indio_dev =3D data; + struct sca3000_state *st =3D iio_priv(indio_dev); + + /* Must ensure no interrupts can be generated after this! */ + sca3000_stop_all_interrupts(st); +} + static int sca3000_probe(struct spi_device *spi) { const struct spi_device_id *id =3D spi_get_device_id(spi); @@ -1489,6 +1516,10 @@ static int sca3000_probe(struct spi_device *spi) if (ret) return ret; =20 + ret =3D devm_add_action_or_reset(dev, sca3000_disable_interrupts, indio_d= ev); + if (ret) + return ret; + ret =3D iio_device_register(indio_dev); if (ret) return ret; @@ -1496,33 +1527,11 @@ static int sca3000_probe(struct spi_device *spi) return 0; } =20 -static int sca3000_stop_all_interrupts(struct sca3000_state *st) -{ - int ret; - - mutex_lock(&st->lock); - ret =3D sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); - if (ret) - goto error_ret; - ret =3D sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR, - (st->rx[0] & - ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER | - SCA3000_REG_INT_MASK_RING_HALF | - SCA3000_REG_INT_MASK_ALL_INTS))); -error_ret: - mutex_unlock(&st->lock); - return ret; -} - static void sca3000_remove(struct spi_device *spi) { struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - struct sca3000_state *st =3D iio_priv(indio_dev); =20 iio_device_unregister(indio_dev); - - /* Must ensure no interrupts can be generated after this! */ - sca3000_stop_all_interrupts(st); } =20 static const struct spi_device_id sca3000_id[] =3D { --=20 2.47.3 From nobody Mon Feb 9 05:01:47 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 470BE309EFA; Mon, 2 Feb 2026 19:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061263; cv=none; b=RTz/1nXM72p0usuNngK3jtqVdvHubz4TzhC3EJV2MVmhw/TLeIW6svhsb0rxsy9uKfUPpGglkQlZlZFMY4blkjqM1aTvL07k4CwOPQ5RcQuxTa1YjTW0MiAVzfGuUH18n4sAZvjVc5FGr1hO4dtMspbzVIhsLPVXKBBlChqm6x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061263; c=relaxed/simple; bh=uwOPfs88su3ZtgLfOZHjkAILEvMAH7oG9NMIOCnFjcA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZFKNntNlASFhgSIOVlsTKf8SQHpj/m+yDWTWycVQGbIEeYTEjvjMBIRMRTVWdfhGekayKfoOnjYf1oxvDweTb2zSrgDCyrl1Il5NIKJ8Z0fwD9W8Ipnvs9AINnyWXhwP3VIh+TJe8QmP+EYjMWVq8x0kB9zstLRVWAhUJZTJITo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Q/GStTfo; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Q/GStTfo" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612IwiO61268729; Mon, 2 Feb 2026 19:40:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=TvuhU Hd6NQb8DC7pLE6Gf8pzD3TJvmbc5g71btovg5A=; b=Q/GStTfounq9Q13tRQ8j+ fnRKNnlE0cWFSNyfOY8PZn+Y297c/32azeXv0dQEDEx7NywvF9qFPQSHrNtX6rbN R4LHbugNQph34V0uM7k9339Uajq8RmCcpg7Cp8BTTnq9N+aTZqxsIGxWj5Er6ccR Lt8kLyWqI/P0b84n5MhbUIcv+cWY4ZJhBtOfSyTXiEih9lKMDjtSMGLov+Fs9kI1 WFP7Hw4zT2Ar32zVyb7a3jE4GFpMjrLl46KmwgoLOieLlbeEk7qTkiCh7GryAERA WGFRIVEWJRC8vFMtNXV4KqLYu/7wh5Em4iwS3PqjO6aced5rF+lnsO/MqZCn9FIP A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4c1as3avka-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:55 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 612JWGHe003367; Mon, 2 Feb 2026 19:40:54 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4c1868us6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:54 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 612JeaU7019500; Mon, 2 Feb 2026 19:40:53 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4c1868ursy-5; Mon, 02 Feb 2026 19:40:53 +0000 From: Harshit Mogalapalli To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Harshit Mogalapalli , Antoniu Miclaus , Andrew Ijano , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, error27@gmail.com, andriy.shevchenko@intel.com Subject: [PATCH v2 next 4/5] iio: sca3000: manage device registration with devm helper Date: Mon, 2 Feb 2026 11:40:11 -0800 Message-ID: <20260202194033.627967-5-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> References: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> 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-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_05,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2602020154 X-Proofpoint-ORIG-GUID: monnDV-A9Zvm8eTsElWxB6T7lUAyJG0R X-Authority-Analysis: v=2.4 cv=Sq6dKfO0 c=1 sm=1 tr=0 ts=6980fdc7 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=QyXUC8HyAAAA:8 a=yPCof4ZbAAAA:8 a=TX5tIiqRz0IEpTnFED8A:9 X-Proofpoint-GUID: monnDV-A9Zvm8eTsElWxB6T7lUAyJG0R X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDE1MyBTYWx0ZWRfX/4ebkmakY6jh I0TNbkzZuX0TtIb4QvWQ9iNfyRvfsjW9VGPvtC7eU5Q+Et6v2OaxfgzCyzJOofQopqAS1+64gqK cq8JpBAiv9bVPyg+q+ehUBDy1nBvp/Nudd7ChjCJhVsdq27zCgqoPX+g1SmLyCjtaIF6JT3fdVA 336/1rpm+alCPD4uIrm4mMjfqIa7Yonm0SM01aPsO1HIePiuZaXZJDj3kdCJHObTEBw3lQzODtx t1d5MgILJHtcOTCDUaMw10bBjsUfiF6uX8oYojQ9Y0YJWSwddh7f+4lnRFd/4Y9Q443bZMFTU9p TCNdkMzEeTql9eL+IzjJGqb6Ktuqrm9dRpHHx2Wd+BArQVUVA1z6D0tXgRFOI/S2vFDrx2BAa1f h8gYErqTTFTrWXKlSww4QLVkEQFdqZI8tEKUwr7EH68oMQ2R28Fta+VLegiLAmzT7ZF4EtdJ5fL Eqxhc9tgfAts/A/fWHA== Content-Type: text/plain; charset="utf-8" Convert the iio registration to use devm_* helpers so the probe no longer needs a separate cleanup path and remove callback can also drop the unregister. After this there is no need for having a remove callback, so remote it. No functional change intended. Suggested-by: Andy Shevchenko Signed-off-by: Harshit Mogalapalli Reviewed-by: David Lechner --- v1-> v2: This was a patch 3 in v1 but moved it to patch4 to preserve the teardown sequence (unregister the iio device first, we can disable interrupts later) -- Thanks to Jonathan for the guidance on V1. --- drivers/iio/accel/sca3000.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 4faffeea328c..989074de18b4 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -1520,18 +1520,7 @@ static int sca3000_probe(struct spi_device *spi) if (ret) return ret; =20 - ret =3D iio_device_register(indio_dev); - if (ret) - return ret; - - return 0; -} - -static void sca3000_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - - iio_device_unregister(indio_dev); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct spi_device_id sca3000_id[] =3D { @@ -1548,7 +1537,6 @@ static struct spi_driver sca3000_driver =3D { .name =3D "sca3000", }, .probe =3D sca3000_probe, - .remove =3D sca3000_remove, .id_table =3D sca3000_id, }; module_spi_driver(sca3000_driver); --=20 2.47.3 From nobody Mon Feb 9 05:01:47 2026 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 4AA843081DF; Mon, 2 Feb 2026 19:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061270; cv=none; b=WbH/eoLEFh0yDtCDv+cAlSXZR6kSCHC7hYABYoz4724/MYPKdTY6NkF4LmnDaZrPairv08T+WaAE9StjABoycDCPCTD5WYSFYMN4btLZaWrZxDx8/qs3FPU8OJvuWJX1doC7x7RIu1Qm8h5BpVxFeK4z7XzMK/A1rODRH2NOjTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061270; c=relaxed/simple; bh=ax92lBpMK4VLdhfSOhRHAYSY2oWIjwdzzAdFmfao3xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bT/AJxxEPMnJaAMOHpzjg+ZjV1DUpgOQWUDjZNCFNTGaFUcm5aVCw74bjlf0C/wYvqVadhOk4lrrcFoX4nJ/Yw+sj2AkTgl4upxk3m9HkJUlzgF8XwHP+gHBZpXCws655n7Gs16CaonlBNyBdpgEhgMxy3Ybvhjc6e6nfjLYZ3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=mNPMfZwf; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="mNPMfZwf" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 612IuEER2198518; Mon, 2 Feb 2026 19:41:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=Bvhlt QZ5+qvXJMPvxkGy4pZ0eqB062+hihcHLT52xcs=; b=mNPMfZwfmvAyfnevwx+U/ +qfkNtmfdIFN48w8smO40CJfxw4525zinZLGctV6JLEzTIr/g/SfhB5ilvNM24Eh IKyJBYB5+tvpoApNaJ3eKK3mxGffgwT1fco7UynQVOqmgiYifdAvEmGuskiptFBT on4Btr7xdKbAqYOV0dZwrGG6bXuvoFDgiB2WHyxxw5+MbIiDSUbgoM9cDI1SZzKO 3+xKrgnj9xW/PPPIxhWR5lRVLPu7TJqMlOSwgRvVmSHOSptheBMttUQha273JUYH dEYYtXGCNXuYYa4MGcKDbMBBiQC2i4TXAW7W6y3jlKYemrqwRidf05BrVnRTZJ2W g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4c1atmawnx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:59 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 612JWGHk003367; Mon, 2 Feb 2026 19:40:58 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4c1868us97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Feb 2026 19:40:58 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 612JeaU9019500; Mon, 2 Feb 2026 19:40:57 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4c1868ursy-6; Mon, 02 Feb 2026 19:40:57 +0000 From: Harshit Mogalapalli To: Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Harshit Mogalapalli , Gustavo Bastos , Antoniu Miclaus , Andrew Ijano , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, error27@gmail.com, andriy.shevchenko@intel.com Subject: [PATCH v2 next 5/5] iio: sca3000: use guard(mutex) to simplify return paths Date: Mon, 2 Feb 2026 11:40:12 -0800 Message-ID: <20260202194033.627967-6-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> References: <20260202194033.627967-1-harshit.m.mogalapalli@oracle.com> 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-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_05,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2601150000 definitions=main-2602020154 X-Proofpoint-ORIG-GUID: XVq4FYbNW7kjkGq8TWgqiNjbEJQKjPMV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDE1MyBTYWx0ZWRfXzvItVkxDrVx4 M7lvpbSB6jwstt4OWVWi/5IMul6bPNerhfTgslmq1iGaZVm/OC09Qv9Mx74IvVSN9XxrHaAwaN9 cbse41/ji3v9Hx12psutJebxz6v8HavCsl8Y59Q8H4VnC795oxi/xt5jP4gmSu2yodGS6dXMFwA TX8/TIE2rOsnxOwslvEFPjbe35+DQ63l7QseOGm7mHjUYOlcmRaHomZ+qiIbm7d+ZoalMLYsKNS EhOrsCLiYrOT68DLjIGk34duVVlSPdl/Ta8bmJQf+U4KbPx1ZVO8/VDwUpsEKu9eIHsTmbCmtIe s0drko/n7lqaqZvHzFT6q0sL7OvHw7uada8QD4QwrYfT7l/NOC/gznDFWnf9KyXe9L/gOEPzLaT +ACbPfApggUN1E1bnwmt901nIQhW1G4ZrWbqigWzl4Pgkh6Z9uK9D6vEzF7ancEFPqE/+3I71/d gyugBOZ9nfhNVemHMgg== X-Proofpoint-GUID: XVq4FYbNW7kjkGq8TWgqiNjbEJQKjPMV X-Authority-Analysis: v=2.4 cv=E+nAZKdl c=1 sm=1 tr=0 ts=6980fdcb cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=yPCof4ZbAAAA:8 a=Fb_YtQGqNHn76Ybc1w8A:9 Content-Type: text/plain; charset="utf-8" Switch sca3000_stop_all_interrupts() to use guard(mutex). Suggested-by: Jonathan Cameron Signed-off-by: Harshit Mogalapalli Reviewed-by: David Lechner --- drivers/iio/accel/sca3000.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 989074de18b4..1fccc493a0d7 100644 --- a/drivers/iio/accel/sca3000.c +++ b/drivers/iio/accel/sca3000.c @@ -7,6 +7,7 @@ * See industrialio/accels/sca3000.h for comments. */ =20 +#include #include #include #include @@ -1441,18 +1442,17 @@ static int sca3000_stop_all_interrupts(struct sca30= 00_state *st) { int ret; =20 - mutex_lock(&st->lock); + guard(mutex)(&st->lock); + ret =3D sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1); if (ret) - goto error_ret; - ret =3D sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR, - (st->rx[0] & + return ret; + + return sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR, + (st->rx[0] & ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER | SCA3000_REG_INT_MASK_RING_HALF | SCA3000_REG_INT_MASK_ALL_INTS))); -error_ret: - mutex_unlock(&st->lock); - return ret; } =20 static void sca3000_disable_interrupts(void *data) --=20 2.47.3