From: Frank Li <Frank.li@oss.nxp.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: lee@kernel.org, maz@kernel.org, andy@kernel.org,
jic23@kernel.org, dmitry.torokhov@gmail.com,
linux-input@vger.kernel.org, mfd@lists.linux.dev,
linux-iio@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, crofts@kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Subject: Re: [PATCH v5 4/4] mfd: mxs-lradc: Convert to devm_clk_get_enabled()
Date: Thu, 19 Nov 2026 10:15:57 -0600 [thread overview]
Message-ID: <av8gvfhOJ_2PdEMr@SMW015318> (raw)
In-Reply-To: <20261119134041.16611-4-festevam@gmail.com>
On Thu, Nov 19, 2026 at 10:40:41AM -0300, Fabio Estevam wrote:
> The LRADC clock is acquired with a managed helper but enabled and
> disabled manually.
>
> Acquire the LRADC clock with devm_clk_get_enabled() instead of a bare
> devm_clk_get() followed by a manual clk_prepare_enable(), so it is
> prepared/enabled for the device lifetime and released on unbind.
>
> This conversion makes the code simpler.
>
> Suggested-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> Changes since v4:
> - None.
>
> drivers/mfd/mxs-lradc.c | 35 +++++++----------------------------
> 1 file changed, 7 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c
> index aa55f88399ef..c3dd2d80e7f1 100644
> --- a/drivers/mfd/mxs-lradc.c
> +++ b/drivers/mfd/mxs-lradc.c
> @@ -160,17 +160,10 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> if (IS_ERR(lradc->base))
> return PTR_ERR(lradc->base);
>
> - lradc->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(lradc->clk)) {
> - dev_err(dev, "Failed to get the delay unit clock\n");
> - return PTR_ERR(lradc->clk);
> - }
> -
> - ret = clk_prepare_enable(lradc->clk);
> - if (ret) {
> - dev_err(dev, "Failed to enable the delay unit clock\n");
> - return ret;
> - }
> + lradc->clk = devm_clk_get_enabled(dev, NULL);
> + if (IS_ERR(lradc->clk))
> + return dev_err_probe(dev, PTR_ERR(lradc->clk),
> + "Failed to get and enable the delay unit clock\n");
>
> ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
> &ts_wires);
> @@ -193,8 +186,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> dev_err(&pdev->dev,
> "Unsupported number of touchscreen wires (%d)\n"
> , ts_wires);
> - ret = -EINVAL;
> - goto err_clk;
> + return -EINVAL;
> }
> } else {
> lradc->buffer_vchans = BUFFER_VCHANS_ALL;
> @@ -204,29 +196,17 @@ static int mxs_lradc_probe(struct platform_device *pdev)
>
> ret = mxs_lradc_get_irqs(pdev, lradc, data);
> if (ret)
> - goto err_clk;
> + return ret;
>
> num_cells = lradc->touchscreen_wire ? ARRAY_SIZE(mxs_lradc_cells) : 1;
> ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
> mxs_lradc_cells, num_cells, NULL, 0, NULL);
> if (ret) {
> dev_err(dev, "Failed to add subdevices\n");
> - goto err_clk;
> + return ret;
If need respin, return dev_err_probe()
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> }
>
> return 0;
> -
> -err_clk:
> - clk_disable_unprepare(lradc->clk);
> -
> - return ret;
> -}
> -
> -static void mxs_lradc_remove(struct platform_device *pdev)
> -{
> - struct mxs_lradc *lradc = platform_get_drvdata(pdev);
> -
> - clk_disable_unprepare(lradc->clk);
> }
>
> static struct platform_driver mxs_lradc_driver = {
> @@ -235,7 +215,6 @@ static struct platform_driver mxs_lradc_driver = {
> .of_match_table = mxs_lradc_dt_ids,
> },
> .probe = mxs_lradc_probe,
> - .remove = mxs_lradc_remove,
> };
> module_platform_driver(mxs_lradc_driver);
>
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2026-11-19 16:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 13:40 [PATCH v5 1/4] dt-bindings: mfd: mxs-lradc: Fix interrupt order Fabio Estevam
2026-11-19 13:40 ` [PATCH v5 2/4] iio: adc: mxs-lradc: Fix trigger use-after-free on removal Fabio Estevam
2026-11-19 16:08 ` Frank Li
2026-11-19 13:40 ` [PATCH v5 3/4] mfd: mxs-lradc: Pass parent IRQs to child drivers Fabio Estevam
2026-11-19 16:14 ` Frank Li
2026-11-19 13:40 ` [PATCH v5 4/4] mfd: mxs-lradc: Convert to devm_clk_get_enabled() Fabio Estevam
2026-11-19 16:15 ` Frank Li [this message]
2026-11-19 16:07 ` [PATCH v5 1/4] dt-bindings: mfd: mxs-lradc: Fix interrupt order Frank Li
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=av8gvfhOJ_2PdEMr@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=crofts@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jic23@kernel.org \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=maz@kernel.org \
--cc=mfd@lists.linux.dev \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox