Skip to content

Commit e9ac902

Browse files
krzkdlezcano
authored andcommitted
thermal/drivers/imx: Simplify probe() with local dev variable
Simplify the probe() function by using local 'dev' instead of &pdev->dev. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 3e1a068 commit e9ac902

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

drivers/thermal/imx_thermal.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -601,28 +601,29 @@ static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data
601601

602602
static int imx_thermal_probe(struct platform_device *pdev)
603603
{
604+
struct device *dev = &pdev->dev;
604605
struct imx_thermal_data *data;
605606
struct regmap *map;
606607
int measure_freq;
607608
int ret;
608609

609-
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
610+
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
610611
if (!data)
611612
return -ENOMEM;
612613

613-
data->dev = &pdev->dev;
614+
data->dev = dev;
614615

615-
map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "fsl,tempmon");
616+
map = syscon_regmap_lookup_by_phandle(dev->of_node, "fsl,tempmon");
616617
if (IS_ERR(map)) {
617618
ret = PTR_ERR(map);
618-
dev_err(&pdev->dev, "failed to get tempmon regmap: %d\n", ret);
619+
dev_err(dev, "failed to get tempmon regmap: %d\n", ret);
619620
return ret;
620621
}
621622
data->tempmon = map;
622623

623-
data->socdata = of_device_get_match_data(&pdev->dev);
624+
data->socdata = of_device_get_match_data(dev);
624625
if (!data->socdata) {
625-
dev_err(&pdev->dev, "no device match found\n");
626+
dev_err(dev, "no device match found\n");
626627
return -ENODEV;
627628
}
628629

@@ -645,15 +646,15 @@ static int imx_thermal_probe(struct platform_device *pdev)
645646

646647
platform_set_drvdata(pdev, data);
647648

648-
if (of_property_present(pdev->dev.of_node, "nvmem-cells")) {
649+
if (of_property_present(dev->of_node, "nvmem-cells")) {
649650
ret = imx_init_from_nvmem_cells(pdev);
650651
if (ret)
651-
return dev_err_probe(&pdev->dev, ret,
652+
return dev_err_probe(dev, ret,
652653
"failed to init from nvmem\n");
653654
} else {
654655
ret = imx_init_from_tempmon_data(pdev);
655656
if (ret) {
656-
dev_err(&pdev->dev, "failed to init from fsl,tempmon-data\n");
657+
dev_err(dev, "failed to init from fsl,tempmon-data\n");
657658
return ret;
658659
}
659660
}
@@ -673,15 +674,14 @@ static int imx_thermal_probe(struct platform_device *pdev)
673674

674675
ret = imx_thermal_register_legacy_cooling(data);
675676
if (ret)
676-
return dev_err_probe(&pdev->dev, ret,
677+
return dev_err_probe(dev, ret,
677678
"failed to register cpufreq cooling device\n");
678679

679-
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
680+
data->thermal_clk = devm_clk_get(dev, NULL);
680681
if (IS_ERR(data->thermal_clk)) {
681682
ret = PTR_ERR(data->thermal_clk);
682683
if (ret != -EPROBE_DEFER)
683-
dev_err(&pdev->dev,
684-
"failed to get thermal clk: %d\n", ret);
684+
dev_err(dev, "failed to get thermal clk: %d\n", ret);
685685
goto legacy_cleanup;
686686
}
687687

@@ -694,7 +694,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
694694
*/
695695
ret = clk_prepare_enable(data->thermal_clk);
696696
if (ret) {
697-
dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
697+
dev_err(dev, "failed to enable thermal clk: %d\n", ret);
698698
goto legacy_cleanup;
699699
}
700700

@@ -707,12 +707,12 @@ static int imx_thermal_probe(struct platform_device *pdev)
707707
IMX_POLLING_DELAY);
708708
if (IS_ERR(data->tz)) {
709709
ret = PTR_ERR(data->tz);
710-
dev_err(&pdev->dev,
711-
"failed to register thermal zone device %d\n", ret);
710+
dev_err(dev, "failed to register thermal zone device %d\n",
711+
ret);
712712
goto clk_disable;
713713
}
714714

715-
dev_info(&pdev->dev, "%s CPU temperature grade - max:%dC"
715+
dev_info(dev, "%s CPU temperature grade - max:%dC"
716716
" critical:%dC passive:%dC\n", data->temp_grade,
717717
data->temp_max / 1000, trips[IMX_TRIP_CRITICAL].temperature / 1000,
718718
trips[IMX_TRIP_PASSIVE].temperature / 1000);
@@ -736,7 +736,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
736736
usleep_range(20, 50);
737737

738738
/* the core was configured and enabled just before */
739-
pm_runtime_set_active(&pdev->dev);
739+
pm_runtime_set_active(dev);
740740
pm_runtime_enable(data->dev);
741741

742742
ret = pm_runtime_resume_and_get(data->dev);
@@ -748,11 +748,11 @@ static int imx_thermal_probe(struct platform_device *pdev)
748748
if (ret)
749749
goto thermal_zone_unregister;
750750

751-
ret = devm_request_threaded_irq(&pdev->dev, data->irq,
751+
ret = devm_request_threaded_irq(dev, data->irq,
752752
imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,
753753
0, "imx_thermal", data);
754754
if (ret < 0) {
755-
dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret);
755+
dev_err(dev, "failed to request alarm irq: %d\n", ret);
756756
goto thermal_zone_unregister;
757757
}
758758

0 commit comments

Comments
 (0)