Skip to content

Commit fd972a1

Browse files
krzkdlezcano
authored andcommitted
thermal/drivers/broadcom: 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 e90c369 commit fd972a1

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

drivers/thermal/broadcom/bcm2835_thermal.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,19 @@ MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table);
163163

164164
static int bcm2835_thermal_probe(struct platform_device *pdev)
165165
{
166+
struct device *dev = &pdev->dev;
166167
const struct of_device_id *match;
167168
struct thermal_zone_device *tz;
168169
struct bcm2835_thermal_data *data;
169170
int err = 0;
170171
u32 val;
171172
unsigned long rate;
172173

173-
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
174+
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
174175
if (!data)
175176
return -ENOMEM;
176177

177-
match = of_match_device(bcm2835_thermal_of_match_table,
178-
&pdev->dev);
178+
match = of_match_device(bcm2835_thermal_of_match_table, dev);
179179
if (!match)
180180
return -EINVAL;
181181

@@ -185,28 +185,25 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
185185
return err;
186186
}
187187

188-
data->clk = devm_clk_get_enabled(&pdev->dev, NULL);
188+
data->clk = devm_clk_get_enabled(dev, NULL);
189189
if (IS_ERR(data->clk)) {
190190
err = PTR_ERR(data->clk);
191191
if (err != -EPROBE_DEFER)
192-
dev_err(&pdev->dev, "Could not get clk: %d\n", err);
192+
dev_err(dev, "Could not get clk: %d\n", err);
193193
return err;
194194
}
195195

196196
rate = clk_get_rate(data->clk);
197197
if ((rate < 1920000) || (rate > 5000000))
198-
dev_warn(&pdev->dev,
198+
dev_warn(dev,
199199
"Clock %pCn running at %lu Hz is outside of the recommended range: 1.92 to 5MHz\n",
200200
data->clk, rate);
201201

202202
/* register of thermal sensor and get info from DT */
203-
tz = devm_thermal_of_zone_register(&pdev->dev, 0, data,
204-
&bcm2835_thermal_ops);
203+
tz = devm_thermal_of_zone_register(dev, 0, data, &bcm2835_thermal_ops);
205204
if (IS_ERR(tz)) {
206205
err = PTR_ERR(tz);
207-
dev_err(&pdev->dev,
208-
"Failed to register the thermal device: %d\n",
209-
err);
206+
dev_err(dev, "Failed to register the thermal device: %d\n", err);
210207
return err;
211208
}
212209

@@ -229,9 +226,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
229226
*/
230227
err = thermal_zone_get_trip(tz, 0, &trip);
231228
if (err < 0) {
232-
dev_err(&pdev->dev,
233-
"Not able to read trip_temp: %d\n",
234-
err);
229+
dev_err(dev, "Not able to read trip_temp: %d\n", err);
235230
return err;
236231
}
237232

0 commit comments

Comments
 (0)