Skip to content

Commit

Permalink
ramips: mtk_eth_soc: make reset registration more concise
Browse files Browse the repository at this point in the history
Use devm_reset_control_array_get_optional_exclusive to register reset
controls in more concise way, dropping the extra error checking required
by the previous implementation.

Signed-off-by: Maxim Anisimov <[email protected]>

[Split out of the bigger commit, provide commit mesage]
Signed-off-by: Lech Perczak <[email protected]>
  • Loading branch information
Linaro1985 authored and Leo-PL committed Dec 10, 2023
1 parent 00ac2ed commit 1fd8847
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1441,12 +1441,8 @@ static int esw_probe(struct platform_device *pdev)
if (reg_init)
esw->reg_led_source = be32_to_cpu(*reg_init);

esw->rst_esw = devm_reset_control_get(&pdev->dev, "esw");
if (IS_ERR(esw->rst_esw))
esw->rst_esw = NULL;
esw->rst_ephy = devm_reset_control_get(&pdev->dev, "ephy");
if (IS_ERR(esw->rst_ephy))
esw->rst_ephy = NULL;
esw->rst_esw = devm_reset_control_get_optional_exclusive(&pdev->dev, "esw");
esw->rst_ephy = devm_reset_control_get_optional_exclusive(&pdev->dev, "ephy");

spin_lock_init(&esw->reg_rw_lock);
platform_set_drvdata(pdev, esw);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1595,9 +1595,7 @@ static int fe_probe(struct platform_device *pdev)

priv = netdev_priv(netdev);
spin_lock_init(&priv->page_lock);
priv->rst_fe = devm_reset_control_get(&pdev->dev, "fe");
if (IS_ERR(priv->rst_fe))
priv->rst_fe = NULL;
priv->rst_fe = devm_reset_control_array_get_optional_exclusive(&pdev->dev);

if (soc->init_data)
soc->init_data(soc, netdev);
Expand Down

0 comments on commit 1fd8847

Please sign in to comment.