Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Peng Fan and committed by
Abel Vesa
9d97a2fe 25b47635

+4 -35
+4 -35
drivers/clk/imx/clk-imx8mp-audiomix.c
··· 230 230 231 231 #if IS_ENABLED(CONFIG_RESET_CONTROLLER) 232 232 233 - static void clk_imx8mp_audiomix_reset_unregister_adev(void *_adev) 234 - { 235 - struct auxiliary_device *adev = _adev; 236 - 237 - auxiliary_device_delete(adev); 238 - auxiliary_device_uninit(adev); 239 - } 240 - 241 - static void clk_imx8mp_audiomix_reset_adev_release(struct device *dev) 242 - { 243 - struct auxiliary_device *adev = to_auxiliary_dev(dev); 244 - 245 - kfree(adev); 246 - } 247 - 248 233 static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev, 249 234 struct clk_imx8mp_audiomix_priv *priv) 250 235 { 251 - struct auxiliary_device *adev __free(kfree) = NULL; 252 - int ret; 236 + struct auxiliary_device *adev; 253 237 254 238 if (!of_property_present(dev->of_node, "#reset-cells")) 255 239 return 0; 256 240 257 - adev = kzalloc(sizeof(*adev), GFP_KERNEL); 241 + adev = devm_auxiliary_device_create(dev, "reset", NULL); 258 242 if (!adev) 259 - return -ENOMEM; 243 + return -ENODEV; 260 244 261 - adev->name = "reset"; 262 - adev->dev.parent = dev; 263 - adev->dev.release = clk_imx8mp_audiomix_reset_adev_release; 264 - 265 - ret = auxiliary_device_init(adev); 266 - if (ret) 267 - return ret; 268 - 269 - ret = auxiliary_device_add(adev); 270 - if (ret) { 271 - auxiliary_device_uninit(adev); 272 - return ret; 273 - } 274 - 275 - return devm_add_action_or_reset(dev, clk_imx8mp_audiomix_reset_unregister_adev, 276 - no_free_ptr(adev)); 245 + return 0; 277 246 } 278 247 279 248 #else /* !CONFIG_RESET_CONTROLLER */