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

Configure Feed

Select the types of activity you want to include in your feed.

clk: qcom: use devm_pm_runtime_enable and devm_pm_clk_create

Use two new helpers instead of pm_runtime_enable() and pm_clk_create(),
removing the need for calling pm_runtime_disable and pm_clk_destroy().

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20210731195034.979084-4-dmitry.baryshkov@linaro.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Dmitry Baryshkov and committed by
Stephen Boyd
72cfc73f a649136b

+46 -110
+10 -15
drivers/clk/qcom/camcc-sc7180.c
··· 1652 1652 struct regmap *regmap; 1653 1653 int ret; 1654 1654 1655 - pm_runtime_enable(&pdev->dev); 1656 - ret = pm_clk_create(&pdev->dev); 1655 + ret = devm_pm_runtime_enable(&pdev->dev); 1656 + if (ret < 0) 1657 + return ret; 1658 + 1659 + ret = devm_pm_clk_create(&pdev->dev); 1657 1660 if (ret < 0) 1658 1661 return ret; 1659 1662 1660 1663 ret = pm_clk_add(&pdev->dev, "xo"); 1661 1664 if (ret < 0) { 1662 1665 dev_err(&pdev->dev, "Failed to acquire XO clock\n"); 1663 - goto disable_pm_runtime; 1666 + return ret; 1664 1667 } 1665 1668 1666 1669 ret = pm_clk_add(&pdev->dev, "iface"); 1667 1670 if (ret < 0) { 1668 1671 dev_err(&pdev->dev, "Failed to acquire iface clock\n"); 1669 - goto disable_pm_runtime; 1672 + return ret; 1670 1673 } 1671 1674 1672 1675 ret = pm_runtime_get(&pdev->dev); 1673 1676 if (ret) 1674 - goto destroy_pm_clk; 1677 + return ret; 1675 1678 1676 1679 regmap = qcom_cc_map(pdev, &cam_cc_sc7180_desc); 1677 1680 if (IS_ERR(regmap)) { 1678 1681 ret = PTR_ERR(regmap); 1679 1682 pm_runtime_put(&pdev->dev); 1680 - goto destroy_pm_clk; 1683 + return ret; 1681 1684 } 1682 1685 1683 1686 clk_fabia_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config); ··· 1692 1689 pm_runtime_put(&pdev->dev); 1693 1690 if (ret < 0) { 1694 1691 dev_err(&pdev->dev, "Failed to register CAM CC clocks\n"); 1695 - goto destroy_pm_clk; 1692 + return ret; 1696 1693 } 1697 1694 1698 1695 return 0; 1699 - 1700 - destroy_pm_clk: 1701 - pm_clk_destroy(&pdev->dev); 1702 - 1703 - disable_pm_runtime: 1704 - pm_runtime_disable(&pdev->dev); 1705 - 1706 - return ret; 1707 1696 } 1708 1697 1709 1698 static const struct dev_pm_ops cam_cc_pm_ops = {
+9 -12
drivers/clk/qcom/lpass-gfm-sm8250.c
··· 251 251 if (IS_ERR(cc->base)) 252 252 return PTR_ERR(cc->base); 253 253 254 - pm_runtime_enable(dev); 255 - err = pm_clk_create(dev); 254 + err = devm_pm_runtime_enable(dev); 256 255 if (err) 257 - goto pm_clk_err; 256 + return err; 257 + 258 + err = devm_pm_clk_create(dev); 259 + if (err) 260 + return err; 258 261 259 262 err = of_pm_clk_add_clks(dev); 260 263 if (err < 0) { 261 264 dev_dbg(dev, "Failed to get lpass core voting clocks\n"); 262 - goto clk_reg_err; 265 + return err; 263 266 } 264 267 265 268 for (i = 0; i < data->onecell_data->num; i++) { ··· 276 273 277 274 err = devm_clk_hw_register(dev, &data->gfm_clks[i]->hw); 278 275 if (err) 279 - goto clk_reg_err; 276 + return err; 280 277 281 278 } 282 279 283 280 err = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, 284 281 data->onecell_data); 285 282 if (err) 286 - goto clk_reg_err; 283 + return err; 287 284 288 285 return 0; 289 - 290 - clk_reg_err: 291 - pm_clk_destroy(dev); 292 - pm_clk_err: 293 - pm_runtime_disable(dev); 294 - return err; 295 286 } 296 287 297 288 static const struct of_device_id lpass_gfm_clk_match_table[] = {
+2 -16
drivers/clk/qcom/lpasscorecc-sc7180.c
··· 356 356 .num_gdscs = ARRAY_SIZE(lpass_audio_hm_sc7180_gdscs), 357 357 }; 358 358 359 - static void lpass_pm_runtime_disable(void *data) 360 - { 361 - pm_runtime_disable(data); 362 - } 363 - 364 - static void lpass_pm_clk_destroy(void *data) 365 - { 366 - pm_clk_destroy(data); 367 - } 368 - 369 359 static int lpass_create_pm_clks(struct platform_device *pdev) 370 360 { 371 361 int ret; 372 362 373 363 pm_runtime_use_autosuspend(&pdev->dev); 374 364 pm_runtime_set_autosuspend_delay(&pdev->dev, 500); 375 - pm_runtime_enable(&pdev->dev); 376 365 377 - ret = devm_add_action_or_reset(&pdev->dev, lpass_pm_runtime_disable, &pdev->dev); 366 + ret = devm_pm_runtime_enable(&pdev->dev); 378 367 if (ret) 379 368 return ret; 380 369 381 - ret = pm_clk_create(&pdev->dev); 382 - if (ret) 383 - return ret; 384 - ret = devm_add_action_or_reset(&pdev->dev, lpass_pm_clk_destroy, &pdev->dev); 370 + ret = devm_pm_clk_create(&pdev->dev); 385 371 if (ret) 386 372 return ret; 387 373
+8 -22
drivers/clk/qcom/mss-sc7180.c
··· 73 73 { 74 74 int ret; 75 75 76 - pm_runtime_enable(&pdev->dev); 77 - ret = pm_clk_create(&pdev->dev); 76 + ret = devm_pm_runtime_enable(&pdev->dev); 78 77 if (ret) 79 - goto disable_pm_runtime; 78 + return ret; 79 + 80 + ret = devm_pm_clk_create(&pdev->dev); 81 + if (ret) 82 + return ret; 80 83 81 84 ret = pm_clk_add(&pdev->dev, "cfg_ahb"); 82 85 if (ret < 0) { 83 86 dev_err(&pdev->dev, "failed to acquire iface clock\n"); 84 - goto destroy_pm_clk; 87 + return ret; 85 88 } 86 89 87 90 ret = qcom_cc_probe(pdev, &mss_sc7180_desc); 88 91 if (ret < 0) 89 - goto destroy_pm_clk; 90 - 91 - return 0; 92 - 93 - destroy_pm_clk: 94 - pm_clk_destroy(&pdev->dev); 95 - 96 - disable_pm_runtime: 97 - pm_runtime_disable(&pdev->dev); 98 - 99 - return ret; 100 - } 101 - 102 - static int mss_sc7180_remove(struct platform_device *pdev) 103 - { 104 - pm_clk_destroy(&pdev->dev); 105 - pm_runtime_disable(&pdev->dev); 92 + return ret; 106 93 107 94 return 0; 108 95 } ··· 106 119 107 120 static struct platform_driver mss_sc7180_driver = { 108 121 .probe = mss_sc7180_probe, 109 - .remove = mss_sc7180_remove, 110 122 .driver = { 111 123 .name = "sc7180-mss", 112 124 .of_match_table = mss_sc7180_match_table,
+9 -23
drivers/clk/qcom/q6sstop-qcs404.c
··· 159 159 const struct qcom_cc_desc *desc; 160 160 int ret; 161 161 162 - pm_runtime_enable(&pdev->dev); 163 - ret = pm_clk_create(&pdev->dev); 162 + ret = devm_pm_runtime_enable(&pdev->dev); 164 163 if (ret) 165 - goto disable_pm_runtime; 164 + return ret; 165 + 166 + ret = devm_pm_clk_create(&pdev->dev); 167 + if (ret) 168 + return ret; 166 169 167 170 ret = pm_clk_add(&pdev->dev, NULL); 168 171 if (ret < 0) { 169 172 dev_err(&pdev->dev, "failed to acquire iface clock\n"); 170 - goto destroy_pm_clk; 173 + return ret; 171 174 } 172 175 173 176 q6sstop_regmap_config.name = "q6sstop_tcsr"; ··· 178 175 179 176 ret = qcom_cc_probe_by_index(pdev, 1, desc); 180 177 if (ret) 181 - goto destroy_pm_clk; 178 + return ret; 182 179 183 180 q6sstop_regmap_config.name = "q6sstop_cc"; 184 181 desc = &q6sstop_qcs404_desc; 185 182 186 183 ret = qcom_cc_probe_by_index(pdev, 0, desc); 187 184 if (ret) 188 - goto destroy_pm_clk; 189 - 190 - return 0; 191 - 192 - destroy_pm_clk: 193 - pm_clk_destroy(&pdev->dev); 194 - 195 - disable_pm_runtime: 196 - pm_runtime_disable(&pdev->dev); 197 - 198 - return ret; 199 - } 200 - 201 - static int q6sstopcc_qcs404_remove(struct platform_device *pdev) 202 - { 203 - pm_clk_destroy(&pdev->dev); 204 - pm_runtime_disable(&pdev->dev); 185 + return ret; 205 186 206 187 return 0; 207 188 } ··· 196 209 197 210 static struct platform_driver q6sstopcc_qcs404_driver = { 198 211 .probe = q6sstopcc_qcs404_probe, 199 - .remove = q6sstopcc_qcs404_remove, 200 212 .driver = { 201 213 .name = "qcs404-q6sstopcc", 202 214 .of_match_table = q6sstopcc_qcs404_match_table,
+8 -22
drivers/clk/qcom/turingcc-qcs404.c
··· 110 110 { 111 111 int ret; 112 112 113 - pm_runtime_enable(&pdev->dev); 114 - ret = pm_clk_create(&pdev->dev); 113 + ret = devm_pm_runtime_enable(&pdev->dev); 115 114 if (ret) 116 - goto disable_pm_runtime; 115 + return ret; 116 + 117 + ret = devm_pm_clk_create(&pdev->dev); 118 + if (ret) 119 + return ret; 117 120 118 121 ret = pm_clk_add(&pdev->dev, NULL); 119 122 if (ret < 0) { 120 123 dev_err(&pdev->dev, "failed to acquire iface clock\n"); 121 - goto destroy_pm_clk; 124 + return ret; 122 125 } 123 126 124 127 ret = qcom_cc_probe(pdev, &turingcc_desc); 125 128 if (ret < 0) 126 - goto destroy_pm_clk; 127 - 128 - return 0; 129 - 130 - destroy_pm_clk: 131 - pm_clk_destroy(&pdev->dev); 132 - 133 - disable_pm_runtime: 134 - pm_runtime_disable(&pdev->dev); 135 - 136 - return ret; 137 - } 138 - 139 - static int turingcc_remove(struct platform_device *pdev) 140 - { 141 - pm_clk_destroy(&pdev->dev); 142 - pm_runtime_disable(&pdev->dev); 129 + return ret; 143 130 144 131 return 0; 145 132 } ··· 143 156 144 157 static struct platform_driver turingcc_driver = { 145 158 .probe = turingcc_probe, 146 - .remove = turingcc_remove, 147 159 .driver = { 148 160 .name = "qcs404-turingcc", 149 161 .of_match_table = turingcc_match_table,