Skip to content

Commit 04523ac

Browse files
Uwe Kleine-Königarndb
authored andcommitted
soc: ti: smartreflex: Simplify getting the opam_sr pointer
The probe function stores the sr_info pointer using platform_set_drvdata(). Use the corresponding platform_get_drvdata() to retrieve that pointer in the remove and shutdown functions. This simplifies these functions and makes error handling unnecessary. This is a good thing as at least for .remove() returning an error code doesn't have the desired effect. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Tony Lindgren <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent aebe916 commit 04523ac

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

drivers/soc/ti/smartreflex.c

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -937,21 +937,8 @@ static int omap_sr_probe(struct platform_device *pdev)
937937

938938
static int omap_sr_remove(struct platform_device *pdev)
939939
{
940-
struct omap_sr_data *pdata = pdev->dev.platform_data;
941940
struct device *dev = &pdev->dev;
942-
struct omap_sr *sr_info;
943-
944-
if (!pdata) {
945-
dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
946-
return -EINVAL;
947-
}
948-
949-
sr_info = _sr_lookup(pdata->voltdm);
950-
if (IS_ERR(sr_info)) {
951-
dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
952-
__func__);
953-
return PTR_ERR(sr_info);
954-
}
941+
struct omap_sr *sr_info = platform_get_drvdata(pdev);
955942

956943
if (sr_info->autocomp_active)
957944
sr_stop_vddautocomp(sr_info);
@@ -965,20 +952,7 @@ static int omap_sr_remove(struct platform_device *pdev)
965952

966953
static void omap_sr_shutdown(struct platform_device *pdev)
967954
{
968-
struct omap_sr_data *pdata = pdev->dev.platform_data;
969-
struct omap_sr *sr_info;
970-
971-
if (!pdata) {
972-
dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
973-
return;
974-
}
975-
976-
sr_info = _sr_lookup(pdata->voltdm);
977-
if (IS_ERR(sr_info)) {
978-
dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
979-
__func__);
980-
return;
981-
}
955+
struct omap_sr *sr_info = platform_get_drvdata(pdev);
982956

983957
if (sr_info->autocomp_active)
984958
sr_stop_vddautocomp(sr_info);

0 commit comments

Comments
 (0)