Skip to content

Commit 3de9e4d

Browse files
linuswEduardo Valentin
authored andcommitted
thermal: db8500: Use dev helper variable
The code gets easier to read like this. Cc: Vincent Guittot <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Eduardo Valentin <[email protected]>
1 parent cb063a8 commit 3de9e4d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

drivers/thermal/db8500_thermal.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,16 @@ static void db8500_thermal_work(struct work_struct *work)
313313
}
314314

315315
static struct db8500_thsens_platform_data*
316-
db8500_thermal_parse_dt(struct platform_device *pdev)
316+
db8500_thermal_parse_dt(struct device *dev)
317317
{
318318
struct db8500_thsens_platform_data *ptrips;
319-
struct device_node *np = pdev->dev.of_node;
319+
struct device_node *np = dev->of_node;
320320
char prop_name[32];
321321
const char *tmp_str;
322322
u32 tmp_data;
323323
int i, j;
324324

325-
ptrips = devm_kzalloc(&pdev->dev, sizeof(*ptrips), GFP_KERNEL);
325+
ptrips = devm_kzalloc(dev, sizeof(*ptrips), GFP_KERNEL);
326326
if (!ptrips)
327327
return NULL;
328328

@@ -377,26 +377,27 @@ static struct db8500_thsens_platform_data*
377377
return ptrips;
378378

379379
err_parse_dt:
380-
dev_err(&pdev->dev, "Parsing device tree data error.\n");
380+
dev_err(dev, "Parsing device tree data error.\n");
381381
return NULL;
382382
}
383383

384384
static int db8500_thermal_probe(struct platform_device *pdev)
385385
{
386386
struct db8500_thermal_zone *pzone = NULL;
387387
struct db8500_thsens_platform_data *ptrips = NULL;
388-
struct device_node *np = pdev->dev.of_node;
388+
struct device *dev = &pdev->dev;
389+
struct device_node *np = dev->of_node;
389390
int low_irq, high_irq, ret = 0;
390391
unsigned long dft_low, dft_high;
391392

392393
if (!np)
393394
return -EINVAL;
394395

395-
ptrips = db8500_thermal_parse_dt(pdev);
396+
ptrips = db8500_thermal_parse_dt(dev);
396397
if (!ptrips)
397398
return -EINVAL;
398399

399-
pzone = devm_kzalloc(&pdev->dev, sizeof(*pzone), GFP_KERNEL);
400+
pzone = devm_kzalloc(dev, sizeof(*pzone), GFP_KERNEL);
400401
if (!pzone)
401402
return -ENOMEM;
402403

@@ -410,43 +411,43 @@ static int db8500_thermal_probe(struct platform_device *pdev)
410411

411412
low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW");
412413
if (low_irq < 0) {
413-
dev_err(&pdev->dev, "Get IRQ_HOTMON_LOW failed.\n");
414+
dev_err(dev, "Get IRQ_HOTMON_LOW failed.\n");
414415
ret = low_irq;
415416
goto out_unlock;
416417
}
417418

418-
ret = devm_request_threaded_irq(&pdev->dev, low_irq, NULL,
419+
ret = devm_request_threaded_irq(dev, low_irq, NULL,
419420
prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
420421
"dbx500_temp_low", pzone);
421422
if (ret < 0) {
422-
dev_err(&pdev->dev, "Failed to allocate temp low irq.\n");
423+
dev_err(dev, "Failed to allocate temp low irq.\n");
423424
goto out_unlock;
424425
}
425426

426427
high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH");
427428
if (high_irq < 0) {
428-
dev_err(&pdev->dev, "Get IRQ_HOTMON_HIGH failed.\n");
429+
dev_err(dev, "Get IRQ_HOTMON_HIGH failed.\n");
429430
ret = high_irq;
430431
goto out_unlock;
431432
}
432433

433-
ret = devm_request_threaded_irq(&pdev->dev, high_irq, NULL,
434+
ret = devm_request_threaded_irq(dev, high_irq, NULL,
434435
prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
435436
"dbx500_temp_high", pzone);
436437
if (ret < 0) {
437-
dev_err(&pdev->dev, "Failed to allocate temp high irq.\n");
438+
dev_err(dev, "Failed to allocate temp high irq.\n");
438439
goto out_unlock;
439440
}
440441

441442
pzone->therm_dev = thermal_zone_device_register("db8500_thermal_zone",
442443
ptrips->num_trips, 0, pzone, &thdev_ops, NULL, 0, 0);
443444

444445
if (IS_ERR(pzone->therm_dev)) {
445-
dev_err(&pdev->dev, "Register thermal zone device failed.\n");
446+
dev_err(dev, "Register thermal zone device failed.\n");
446447
ret = PTR_ERR(pzone->therm_dev);
447448
goto out_unlock;
448449
}
449-
dev_info(&pdev->dev, "Thermal zone device registered.\n");
450+
dev_info(dev, "Thermal zone device registered.\n");
450451

451452
dft_low = PRCMU_DEFAULT_LOW_TEMP;
452453
dft_high = ptrips->trip_points[0].temp;

0 commit comments

Comments
 (0)