public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] ASoC: codec: rt274: Use devm_request_threaded_irq to manage IRQ lifetime and fix smatch warning
@ 2025-12-06 14:51 hariconscious
  0 siblings, 0 replies; only message in thread
From: hariconscious @ 2025-12-06 14:51 UTC (permalink / raw)
  To: oder_chiou, lgirdwood, broonie
  Cc: perex, tiwai, khalid, shuah, david.hunter.linux, linux-sound,
	linux-kernel, HariKrishna Sagala

From: HariKrishna Sagala <hariconscious@gmail.com>

Replace manual "request_threaded_irq()" with the device managed
"devm_request_threaded_irq" to manage the IRQ lifetime and also
it removes the smatch reported warning.
Remove the manual "free_irq()" in the "remove" function as free_irq
is tied to device teardown.

Signed-off-by: HariKrishna Sagala <hariconscious@gmail.com>
---
This patch replaces the manual management of IRQ with the device
managed IRQ API. Also, it removes the smatch reported warning.
sound/soc/codecs/rt274.c:1204 rt274_i2c_probe() warn: 
'rt274->i2c->irq' from request_threaded_irq() not released on lines: 1204.

Removed the "remove" function as IRQ is managed automatically.
Runtime testing is requested to see no regressions.
Please report any failures or unexpected behaviour, I will support in
updating the patch accordingly.

Similar warning is present in the codecs rt286 & rt298.
If you are ok for updating those, will update them.

Thank you.

 sound/soc/codecs/rt274.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c
index 2c055c45111f..d441851dee8c 100644
--- a/sound/soc/codecs/rt274.c
+++ b/sound/soc/codecs/rt274.c
@@ -1188,7 +1188,7 @@ static int rt274_i2c_probe(struct i2c_client *i2c)
 	regmap_write(rt274->regmap, RT274_UNSOLICITED_MIC, 0x82);
 
 	if (rt274->i2c->irq) {
-		ret = request_threaded_irq(rt274->i2c->irq, NULL, rt274_irq,
+		ret = devm_request_threaded_irq(&rt274->i2c->dev, rt274->i2c->irq, NULL, rt274_irq,
 			IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt274", rt274);
 		if (ret != 0) {
 			dev_err(&i2c->dev,
@@ -1204,15 +1204,6 @@ static int rt274_i2c_probe(struct i2c_client *i2c)
 	return ret;
 }
 
-static void rt274_i2c_remove(struct i2c_client *i2c)
-{
-	struct rt274_priv *rt274 = i2c_get_clientdata(i2c);
-
-	if (i2c->irq)
-		free_irq(i2c->irq, rt274);
-}
-
-
 static struct i2c_driver rt274_i2c_driver = {
 	.driver = {
 		   .name = "rt274",
@@ -1222,7 +1213,6 @@ static struct i2c_driver rt274_i2c_driver = {
 #endif
 		   },
 	.probe = rt274_i2c_probe,
-	.remove = rt274_i2c_remove,
 	.id_table = rt274_i2c_id,
 };
 

base-commit: 24172e0d79900908cf5ebf366600616d29c9b417
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-06 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-06 14:51 [PATCH RESEND] ASoC: codec: rt274: Use devm_request_threaded_irq to manage IRQ lifetime and fix smatch warning hariconscious

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox