mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code
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> Link: https://lore.kernel.org/r/20251024-auxiliary-v2-1-a353dc9e6b1a@nxp.com Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
This commit is contained in:
@@ -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;
|
||||
return -ENODEV;
|
||||
|
||||
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;
|
||||
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user