All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCHv2 3/4] memory: fsl_ifc: Use devm_request_irq and simplify remove
Date: Tue, 21 Jul 2026 13:24:48 -0700	[thread overview]
Message-ID: <20260721202450.485171-4-rosenp@gmail.com> (raw)
In-Reply-To: <20260721202450.485171-1-rosenp@gmail.com>

Switch from request_irq to devm_request_irq(), eliminating the error
path labels and free_irq() calls in remove(). Since both IRQs are now
devm-managed, the remove function only needs of_platform_depopulate
to tear down child devices before devm cleanup fires.

Remove dev_err calls on failure as devm_request_irq() already does this.

Don't bother using the irq variables in the struct. They were only used to
free the irqs in _remove.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/memory/fsl_ifc.c | 47 ++++++++++------------------------------
 1 file changed, 12 insertions(+), 35 deletions(-)

diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
index 7e6800fc8480..7fea6a356b55 100644
--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -86,12 +86,7 @@ static int fsl_ifc_ctrl_init(struct fsl_ifc_ctrl *ctrl)
 
 static void fsl_ifc_ctrl_remove(struct platform_device *dev)
 {
-	struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev);
-
 	of_platform_depopulate(&dev->dev);
-	if (ctrl->nand_irq > 0)
-		free_irq(ctrl->nand_irq, ctrl);
-	free_irq(ctrl->irq, ctrl);
 }
 
 /*
@@ -253,8 +248,6 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
 		addr += PGOFFSET_4K;
 	fsl_ifc_ctrl_dev->rregs = addr;
 
-	fsl_ifc_ctrl_dev->irq = irq;
-
 	fsl_ifc_ctrl_dev->dev = &dev->dev;
 
 	ret = fsl_ifc_ctrl_init(fsl_ifc_ctrl_dev);
@@ -263,38 +256,22 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
 
 	init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
 
-	ret = request_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_irq, IRQF_SHARED,
-			  "fsl-ifc", fsl_ifc_ctrl_dev);
-	if (ret != 0) {
-		dev_err(&dev->dev, "failed to install irq (%d)\n",
-			fsl_ifc_ctrl_dev->irq);
-		goto err_free_irq;
-	}
+	ret = devm_request_irq(&dev->dev, irq,
+			       fsl_ifc_ctrl_irq, IRQF_SHARED,
+			       "fsl-ifc", fsl_ifc_ctrl_dev);
+	if (ret)
+		return ret;
 
-	fsl_ifc_ctrl_dev->nand_irq = nand_irq;
-	if (fsl_ifc_ctrl_dev->nand_irq > 0) {
-		ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq,
-				0, "fsl-ifc-nand", fsl_ifc_ctrl_dev);
-		if (ret != 0) {
-			dev_err(&dev->dev, "failed to install irq (%d)\n",
-				fsl_ifc_ctrl_dev->nand_irq);
-			goto err_free_irq;
-		}
+	if (nand_irq > 0) {
+		ret = devm_request_irq(&dev->dev,
+				       nand_irq, fsl_ifc_nand_irq, 0,
+				       "fsl-ifc-nand", fsl_ifc_ctrl_dev);
+		if (ret)
+			return ret;
 	}
 
 	/* legacy dts may still use "simple-bus" compatible */
-	ret = of_platform_default_populate(dev->dev.of_node, NULL, &dev->dev);
-	if (ret)
-		goto err_free_nandirq;
-
-	return 0;
-
-err_free_nandirq:
-	if (fsl_ifc_ctrl_dev->nand_irq > 0)
-		free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev);
-err_free_irq:
-	free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
-	return ret;
+	return of_platform_default_populate(dev->dev.of_node, NULL, &dev->dev);
 }
 
 static const struct of_device_id fsl_ifc_match[] = {
-- 
2.55.0


  parent reply	other threads:[~2026-07-21 20:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 20:24 [PATCHv2 0/4] memory: fsl_ifc: Switch to modern devm and platform IRQ APIs Rosen Penev
2026-07-21 20:24 ` [PATCHv2 1/4] memory: fsl_ifc: Fix optional NAND IRQ handling and migrate to platform IRQ API Rosen Penev
2026-09-01 15:29   ` Krzysztof Kozlowski
2026-09-06 18:34     ` Rosen Penev
2026-09-09  6:00       ` Krzysztof Kozlowski
2026-09-09 22:33         ` Rosen Penev
2026-09-10  6:28           ` Krzysztof Kozlowski
2026-07-21 20:24 ` [PATCHv2 2/4] memory: fsl_ifc: Use devm_platform_ioremap_resource and fix error paths Rosen Penev
2026-09-01 15:34   ` Krzysztof Kozlowski
2026-07-21 20:24 ` Rosen Penev [this message]
2026-07-21 20:24 ` [PATCHv2 4/4] memory: fsl_ifc: drop simple-bus emulation Rosen Penev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260721202450.485171-4-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.