From: Krzysztof Kozlowski <krzk@kernel.org>
To: Rosen Penev <rosenp@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 2/4] memory: fsl_ifc: Use devm_platform_ioremap_resource and fix error paths
Date: Tue, 1 Sep 2026 17:34:02 +0200 [thread overview]
Message-ID: <d4af29ce-54e0-49aa-8b5f-b2ce06fa8f76@kernel.org> (raw)
In-Reply-To: <20260721202450.485171-3-rosenp@gmail.com>
On 21/07/2026 22:24, Rosen Penev wrote:
> Replace of_iomap() with devm_platform_ioremap_resource() for automatic
> resource management, eliminating manual iounmap in remove and error
> paths. devm_ioremap_resource() reserves the region and checks for
> overlaps, which is safe here since the IFC controller register space
> and child chip-select ranges are always at distinct addresses in all
> DTS files.
>
> As one of the errors is -EPROBE_DEFER, run it before anything else to
> avoid doing actual work in such a case.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/memory/fsl_ifc.c | 23 +++++++++--------------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
> index dce94d8b05b9..7e6800fc8480 100644
> --- a/drivers/memory/fsl_ifc.c
> +++ b/drivers/memory/fsl_ifc.c
> @@ -92,10 +92,6 @@ static void fsl_ifc_ctrl_remove(struct platform_device *dev)
> if (ctrl->nand_irq > 0)
> free_irq(ctrl->nand_irq, ctrl);
> free_irq(ctrl->irq, ctrl);
> -
> - iounmap(ctrl->gregs);
> -
> - dev_set_drvdata(&dev->dev, NULL);
> }
>
> /*
> @@ -201,6 +197,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
> {
> int ret = 0;
> int version, banks;
> + void __iomem *gregs;
Why another local variable?
> void __iomem *addr;
> int nand_irq;
> int irq;
> @@ -217,6 +214,11 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
> if (nand_irq == -EPROBE_DEFER)
> return nand_irq;
>
> + /* IOMAP the entire IFC region */
> + gregs = devm_platform_ioremap_resource(dev, 0);
> + if (IS_ERR(gregs))
> + return PTR_ERR(gregs);
> +
> fsl_ifc_ctrl_dev = devm_kzalloc(&dev->dev, sizeof(*fsl_ifc_ctrl_dev),
> GFP_KERNEL);
> if (!fsl_ifc_ctrl_dev)
> @@ -224,12 +226,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
>
> dev_set_drvdata(&dev->dev, fsl_ifc_ctrl_dev);
>
> - /* IOMAP the entire IFC region */
> - fsl_ifc_ctrl_dev->gregs = of_iomap(dev->dev.of_node, 0);
This is not equivalent and commit msg does not address that. Old code
allowed multiple maps of the same address space but new code bails with
EBUSY.
Again, I asked last time - how did you test it?
Please mark the patches as RFT.
Best regards,
Krzysztof
next prev parent reply other threads:[~2026-09-01 15:34 UTC|newest]
Thread overview: 7+ 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-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 [this message]
2026-07-21 20:24 ` [PATCHv2 3/4] memory: fsl_ifc: Use devm_request_irq and simplify remove Rosen Penev
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=d4af29ce-54e0-49aa-8b5f-b2ce06fa8f76@kernel.org \
--to=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rosenp@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®