Skip to content

Commit

Permalink
pinctrl: tegra-xusb: Use devm_pinctrl_register() for pinctrl registra…
Browse files Browse the repository at this point in the history
…tion

Use devm_pinctrl_register() for pin control registration and clean
the error path.

Signed-off-by: Laxman Dewangan <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Alexandre Courbot <[email protected]>
Cc: Jon Hunter <[email protected]>
Acked-by: Stephen Warren <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
ldewangan authored and linusw committed Apr 20, 2016
1 parent f1daa8a commit e46e3ef
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,8 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
padctl->desc.confops = &tegra_xusb_padctl_pinconf_ops;
padctl->desc.owner = THIS_MODULE;

padctl->pinctrl = pinctrl_register(&padctl->desc, &pdev->dev, padctl);
padctl->pinctrl = devm_pinctrl_register(&pdev->dev, &padctl->desc,
padctl);
if (IS_ERR(padctl->pinctrl)) {
dev_err(&pdev->dev, "failed to register pincontrol\n");
err = PTR_ERR(padctl->pinctrl);
Expand All @@ -924,7 +925,7 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
phy = devm_phy_create(&pdev->dev, NULL, &pcie_phy_ops);
if (IS_ERR(phy)) {
err = PTR_ERR(phy);
goto unregister;
goto reset;
}

padctl->phys[TEGRA_XUSB_PADCTL_PCIE] = phy;
Expand All @@ -933,7 +934,7 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
phy = devm_phy_create(&pdev->dev, NULL, &sata_phy_ops);
if (IS_ERR(phy)) {
err = PTR_ERR(phy);
goto unregister;
goto reset;
}

padctl->phys[TEGRA_XUSB_PADCTL_SATA] = phy;
Expand All @@ -944,13 +945,11 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
if (IS_ERR(padctl->provider)) {
err = PTR_ERR(padctl->provider);
dev_err(&pdev->dev, "failed to register PHYs: %d\n", err);
goto unregister;
goto reset;
}

return 0;

unregister:
pinctrl_unregister(padctl->pinctrl);
reset:
reset_control_assert(padctl->rst);
return err;
Expand All @@ -961,8 +960,6 @@ static int tegra_xusb_padctl_remove(struct platform_device *pdev)
struct tegra_xusb_padctl *padctl = platform_get_drvdata(pdev);
int err;

pinctrl_unregister(padctl->pinctrl);

err = reset_control_assert(padctl->rst);
if (err < 0)
dev_err(&pdev->dev, "failed to assert reset: %d\n", err);
Expand Down

0 comments on commit e46e3ef

Please sign in to comment.