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

reset: uniphier-glue: Use devm_add_action_or_reset()

Slightly simplify uniphier_glue_reset_probe() and drop
uniphier_glue_reset_remove() by using devm_add_action_or_reset()
for clock and reset cleanup.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/20211215093829.3209416-2-p.zabel@pengutronix.de
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

+24 -26
+24 -26
drivers/reset/reset-uniphier-glue.c
··· 28 28 const struct uniphier_glue_reset_soc_data *data; 29 29 }; 30 30 31 + static void uniphier_clk_disable(void *_priv) 32 + { 33 + struct uniphier_glue_reset_priv *priv = _priv; 34 + 35 + clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); 36 + } 37 + 38 + static void uniphier_rst_assert(void *_priv) 39 + { 40 + struct uniphier_glue_reset_priv *priv = _priv; 41 + 42 + reset_control_bulk_assert(priv->data->nrsts, priv->rst); 43 + } 44 + 31 45 static int uniphier_glue_reset_probe(struct platform_device *pdev) 32 46 { 33 47 struct device *dev = &pdev->dev; ··· 82 68 if (ret) 83 69 return ret; 84 70 71 + ret = devm_add_action_or_reset(dev, uniphier_clk_disable, priv); 72 + if (ret) 73 + return ret; 74 + 85 75 ret = reset_control_bulk_deassert(priv->data->nrsts, priv->rst); 86 76 if (ret) 87 - goto out_clk_disable; 77 + return ret; 78 + 79 + ret = devm_add_action_or_reset(dev, uniphier_rst_assert, priv); 80 + if (ret) 81 + return ret; 88 82 89 83 spin_lock_init(&priv->rdata.lock); 90 84 priv->rdata.rcdev.owner = THIS_MODULE; ··· 103 81 104 82 platform_set_drvdata(pdev, priv); 105 83 106 - ret = devm_reset_controller_register(dev, &priv->rdata.rcdev); 107 - if (ret) 108 - goto out_rst_assert; 109 - 110 - return 0; 111 - 112 - out_rst_assert: 113 - reset_control_bulk_assert(priv->data->nrsts, priv->rst); 114 - 115 - out_clk_disable: 116 - clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); 117 - 118 - return ret; 119 - } 120 - 121 - static int uniphier_glue_reset_remove(struct platform_device *pdev) 122 - { 123 - struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev); 124 - 125 - reset_control_bulk_assert(priv->data->nrsts, priv->rst); 126 - 127 - clk_bulk_disable_unprepare(priv->data->nclks, priv->clk); 128 - 129 - return 0; 84 + return devm_reset_controller_register(dev, &priv->rdata.rcdev); 130 85 } 131 86 132 87 static const char * const uniphier_pro4_clock_reset_names[] = { ··· 171 172 172 173 static struct platform_driver uniphier_glue_reset_driver = { 173 174 .probe = uniphier_glue_reset_probe, 174 - .remove = uniphier_glue_reset_remove, 175 175 .driver = { 176 176 .name = "uniphier-glue-reset", 177 177 .of_match_table = uniphier_glue_reset_match,