From: Cosmin Tanislav Date: Wed, 27 May 2026 14:56:03 +0000 (+0300) Subject: mfd: rz-mtu3: Use device-managed APIs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed1a370da26369a26b25901685e620c12040a471;p=thirdparty%2Fkernel%2Flinux.git mfd: rz-mtu3: Use device-managed APIs Replace devm_reset_control_get_exclusive() and the manual reset_control_deassert()/reset_control_assert() with handling by devm_reset_control_get_exclusive_deasserted(). Replace mfd_add_devices()/mfd_remove_devices() with devm_mfd_add_devices(). Remove the custom cleanup action. Signed-off-by: Cosmin Tanislav Link: https://patch.msgid.link/20260527145606.136536-2-cosmin-gabriel.tanislav.xa@renesas.com Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/rz-mtu3.c b/drivers/mfd/rz-mtu3.c index 9cdfef610398f..6f6ed32e75922 100644 --- a/drivers/mfd/rz-mtu3.c +++ b/drivers/mfd/rz-mtu3.c @@ -301,15 +301,6 @@ void rz_mtu3_disable(struct rz_mtu3_channel *ch) } EXPORT_SYMBOL_GPL(rz_mtu3_disable); -static void rz_mtu3_reset_assert(void *data) -{ - struct rz_mtu3 *mtu = dev_get_drvdata(data); - struct rz_mtu3_priv *priv = mtu->priv_data; - - mfd_remove_devices(data); - reset_control_assert(priv->rstc); -} - static const struct mfd_cell rz_mtu3_devs[] = { { .name = "rz-mtu3-counter", @@ -324,7 +315,6 @@ static int rz_mtu3_probe(struct platform_device *pdev) struct rz_mtu3_priv *priv; struct rz_mtu3 *ddata; unsigned int i; - int ret; ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) @@ -340,7 +330,7 @@ static int rz_mtu3_probe(struct platform_device *pdev) if (IS_ERR(priv->mmio)) return PTR_ERR(priv->mmio); - priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); + priv->rstc = devm_reset_control_get_exclusive_deasserted(&pdev->dev, NULL); if (IS_ERR(priv->rstc)) return PTR_ERR(priv->rstc); @@ -348,7 +338,6 @@ static int rz_mtu3_probe(struct platform_device *pdev) if (IS_ERR(ddata->clk)) return PTR_ERR(ddata->clk); - reset_control_deassert(priv->rstc); spin_lock_init(&priv->lock); platform_set_drvdata(pdev, ddata); @@ -358,17 +347,8 @@ static int rz_mtu3_probe(struct platform_device *pdev) mutex_init(&ddata->channels[i].lock); } - ret = mfd_add_devices(&pdev->dev, 0, rz_mtu3_devs, - ARRAY_SIZE(rz_mtu3_devs), NULL, 0, NULL); - if (ret < 0) - goto err_assert; - - return devm_add_action_or_reset(&pdev->dev, rz_mtu3_reset_assert, - &pdev->dev); - -err_assert: - reset_control_assert(priv->rstc); - return ret; + return devm_mfd_add_devices(&pdev->dev, 0, rz_mtu3_devs, + ARRAY_SIZE(rz_mtu3_devs), NULL, 0, NULL); } static const struct of_device_id rz_mtu3_of_match[] = {