Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit f637bfe

Browse files
krzkdlezcano
authored andcommitted
thermal/drivers/generic-adc: Simplify probe() with local dev variable
Simplify the probe() function by using local 'dev' instead of &pdev->dev. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240709-thermal-probe-v1-11-241644e2b6e0@linaro.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent bc55630 commit f637bfe

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

drivers/thermal/thermal-generic-adc.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,44 +117,45 @@ static int gadc_thermal_read_linear_lookup_table(struct device *dev,
117117

118118
static int gadc_thermal_probe(struct platform_device *pdev)
119119
{
120+
struct device *dev = &pdev->dev;
120121
struct gadc_thermal_info *gti;
121122
int ret;
122123

123-
if (!pdev->dev.of_node) {
124-
dev_err(&pdev->dev, "Only DT based supported\n");
124+
if (!dev->of_node) {
125+
dev_err(dev, "Only DT based supported\n");
125126
return -ENODEV;
126127
}
127128

128-
gti = devm_kzalloc(&pdev->dev, sizeof(*gti), GFP_KERNEL);
129+
gti = devm_kzalloc(dev, sizeof(*gti), GFP_KERNEL);
129130
if (!gti)
130131
return -ENOMEM;
131132

132-
gti->channel = devm_iio_channel_get(&pdev->dev, "sensor-channel");
133+
gti->channel = devm_iio_channel_get(dev, "sensor-channel");
133134
if (IS_ERR(gti->channel)) {
134135
ret = PTR_ERR(gti->channel);
135136
if (ret != -EPROBE_DEFER)
136-
dev_err(&pdev->dev, "IIO channel not found: %d\n", ret);
137+
dev_err(dev, "IIO channel not found: %d\n", ret);
137138
return ret;
138139
}
139140

140-
ret = gadc_thermal_read_linear_lookup_table(&pdev->dev, gti);
141+
ret = gadc_thermal_read_linear_lookup_table(dev, gti);
141142
if (ret < 0)
142143
return ret;
143144

144-
gti->dev = &pdev->dev;
145+
gti->dev = dev;
145146

146-
gti->tz_dev = devm_thermal_of_zone_register(&pdev->dev, 0, gti,
147+
gti->tz_dev = devm_thermal_of_zone_register(dev, 0, gti,
147148
&gadc_thermal_ops);
148149
if (IS_ERR(gti->tz_dev)) {
149150
ret = PTR_ERR(gti->tz_dev);
150151
if (ret != -EPROBE_DEFER)
151-
dev_err(&pdev->dev,
152+
dev_err(dev,
152153
"Thermal zone sensor register failed: %d\n",
153154
ret);
154155
return ret;
155156
}
156157

157-
devm_thermal_add_hwmon_sysfs(&pdev->dev, gti->tz_dev);
158+
devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev);
158159

159160
return 0;
160161
}

0 commit comments

Comments
 (0)