Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code
@ 2025-10-24  1:45 Peng Fan
  2025-10-24  2:15 ` Shengjiu Wang
  2025-11-11 15:46 ` Abel Vesa
  0 siblings, 2 replies; 3+ messages in thread
From: Peng Fan @ 2025-10-24  1:45 UTC (permalink / raw)
  To: Abel Vesa, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: Laurentiu Mihalcea, Shengjiu Wang, Frank Li, linux-clk, imx,
	linux-arm-kernel, linux-kernel, Abel Vesa, Frank Li, Peng Fan

Use helper function devm_auxiliary_device_create() to remove some
boilerplate code.

Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in v2:
- Update commit log per Frank
- Add R-b from Frank and Abel
- Link to v1: https://lore.kernel.org/r/20251023-auxiliary-v1-1-0a16fa4c3cdd@nxp.com
---
 drivers/clk/imx/clk-imx8mp-audiomix.c | 39 ++++-------------------------------
 1 file changed, 4 insertions(+), 35 deletions(-)

diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/clk-imx8mp-audiomix.c
index 775f62dddb11d8cfd17a4ebf7a677ef399c5e617..131702f2c9ecfd693af47094fe61b486ae6e8f6d 100644
--- a/drivers/clk/imx/clk-imx8mp-audiomix.c
+++ b/drivers/clk/imx/clk-imx8mp-audiomix.c
@@ -230,50 +230,19 @@ struct clk_imx8mp_audiomix_priv {
 
 #if IS_ENABLED(CONFIG_RESET_CONTROLLER)
 
-static void clk_imx8mp_audiomix_reset_unregister_adev(void *_adev)
-{
-	struct auxiliary_device *adev = _adev;
-
-	auxiliary_device_delete(adev);
-	auxiliary_device_uninit(adev);
-}
-
-static void clk_imx8mp_audiomix_reset_adev_release(struct device *dev)
-{
-	struct auxiliary_device *adev = to_auxiliary_dev(dev);
-
-	kfree(adev);
-}
-
 static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev,
 							 struct clk_imx8mp_audiomix_priv *priv)
 {
-	struct auxiliary_device *adev __free(kfree) = NULL;
-	int ret;
+	struct auxiliary_device *adev;
 
 	if (!of_property_present(dev->of_node, "#reset-cells"))
 		return 0;
 
-	adev = kzalloc(sizeof(*adev), GFP_KERNEL);
+	adev = devm_auxiliary_device_create(dev, "reset", NULL);
 	if (!adev)
-		return -ENOMEM;
-
-	adev->name = "reset";
-	adev->dev.parent = dev;
-	adev->dev.release = clk_imx8mp_audiomix_reset_adev_release;
-
-	ret = auxiliary_device_init(adev);
-	if (ret)
-		return ret;
+		return -ENODEV;
 
-	ret = auxiliary_device_add(adev);
-	if (ret) {
-		auxiliary_device_uninit(adev);
-		return ret;
-	}
-
-	return devm_add_action_or_reset(dev, clk_imx8mp_audiomix_reset_unregister_adev,
-					no_free_ptr(adev));
+	return 0;
 }
 
 #else /* !CONFIG_RESET_CONTROLLER */

---
base-commit: aaa9c3550b60d6259d6ea8b1175ade8d1242444e
change-id: 20251023-auxiliary-3998bced9cb9

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code
  2025-10-24  1:45 [PATCH v2] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code Peng Fan
@ 2025-10-24  2:15 ` Shengjiu Wang
  2025-11-11 15:46 ` Abel Vesa
  1 sibling, 0 replies; 3+ messages in thread
From: Shengjiu Wang @ 2025-10-24  2:15 UTC (permalink / raw)
  To: Peng Fan
  Cc: Abel Vesa, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Laurentiu Mihalcea, Shengjiu Wang, Frank Li, linux-clk, imx,
	linux-arm-kernel, linux-kernel, Abel Vesa

On Fri, Oct 24, 2025 at 9:46 AM Peng Fan <peng.fan@nxp.com> wrote:
>
> Use helper function devm_auxiliary_device_create() to remove some
> boilerplate code.
>
> Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>

Best regards
Shengjiu wang
> ---
> Changes in v2:
> - Update commit log per Frank
> - Add R-b from Frank and Abel
> - Link to v1: https://lore.kernel.org/r/20251023-auxiliary-v1-1-0a16fa4c3cdd@nxp.com
> ---
>  drivers/clk/imx/clk-imx8mp-audiomix.c | 39 ++++-------------------------------
>  1 file changed, 4 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/clk-imx8mp-audiomix.c
> index 775f62dddb11d8cfd17a4ebf7a677ef399c5e617..131702f2c9ecfd693af47094fe61b486ae6e8f6d 100644
> --- a/drivers/clk/imx/clk-imx8mp-audiomix.c
> +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c
> @@ -230,50 +230,19 @@ struct clk_imx8mp_audiomix_priv {
>
>  #if IS_ENABLED(CONFIG_RESET_CONTROLLER)
>
> -static void clk_imx8mp_audiomix_reset_unregister_adev(void *_adev)
> -{
> -       struct auxiliary_device *adev = _adev;
> -
> -       auxiliary_device_delete(adev);
> -       auxiliary_device_uninit(adev);
> -}
> -
> -static void clk_imx8mp_audiomix_reset_adev_release(struct device *dev)
> -{
> -       struct auxiliary_device *adev = to_auxiliary_dev(dev);
> -
> -       kfree(adev);
> -}
> -
>  static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev,
>                                                          struct clk_imx8mp_audiomix_priv *priv)
>  {
> -       struct auxiliary_device *adev __free(kfree) = NULL;
> -       int ret;
> +       struct auxiliary_device *adev;
>
>         if (!of_property_present(dev->of_node, "#reset-cells"))
>                 return 0;
>
> -       adev = kzalloc(sizeof(*adev), GFP_KERNEL);
> +       adev = devm_auxiliary_device_create(dev, "reset", NULL);
>         if (!adev)
> -               return -ENOMEM;
> -
> -       adev->name = "reset";
> -       adev->dev.parent = dev;
> -       adev->dev.release = clk_imx8mp_audiomix_reset_adev_release;
> -
> -       ret = auxiliary_device_init(adev);
> -       if (ret)
> -               return ret;
> +               return -ENODEV;
>
> -       ret = auxiliary_device_add(adev);
> -       if (ret) {
> -               auxiliary_device_uninit(adev);
> -               return ret;
> -       }
> -
> -       return devm_add_action_or_reset(dev, clk_imx8mp_audiomix_reset_unregister_adev,
> -                                       no_free_ptr(adev));
> +       return 0;
>  }
>
>  #else /* !CONFIG_RESET_CONTROLLER */
>
> ---
> base-commit: aaa9c3550b60d6259d6ea8b1175ade8d1242444e
> change-id: 20251023-auxiliary-3998bced9cb9
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code
  2025-10-24  1:45 [PATCH v2] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code Peng Fan
  2025-10-24  2:15 ` Shengjiu Wang
@ 2025-11-11 15:46 ` Abel Vesa
  1 sibling, 0 replies; 3+ messages in thread
From: Abel Vesa @ 2025-11-11 15:46 UTC (permalink / raw)
  To: Abel Vesa, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Peng Fan
  Cc: Laurentiu Mihalcea, Shengjiu Wang, Frank Li, linux-clk, imx,
	linux-arm-kernel, linux-kernel, Frank Li


On Fri, 24 Oct 2025 09:45:51 +0800, Peng Fan wrote:
> Use helper function devm_auxiliary_device_create() to remove some
> boilerplate code.
> 
> 

Applied, thanks!

[1/1] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code
      commit: 9d97a2fe48ae77976baff441edd5b30ea4e179c0

Best regards,
-- 
Abel Vesa <abel.vesa@linaro.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-11 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24  1:45 [PATCH v2] clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code Peng Fan
2025-10-24  2:15 ` Shengjiu Wang
2025-11-11 15:46 ` Abel Vesa

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