Skip to content

Commit 86cb100

Browse files
committed
thermal: intel: intel_pch: Eliminate device operations object
The same device operations object is pointed to by all of the board configurations in the driver, so effectively the same operations callbacks are used by all of them which only adds overhead (that can be significant due to retpolines) for no real purpose. For this reason, drop the device operations object and replace the respective callback invocations by direct calls to the specific functions that were previously pointed to by callback pointers. No intentional change in behavior. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Tested-by: Zhang Rui <[email protected]> Reviewed-by: Zhang Rui <[email protected]>
1 parent 1aa4f92 commit 86cb100

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

drivers/thermal/intel/intel_pch_thermal.c

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ static char driver_name[] = "Intel PCH thermal driver";
8282

8383
struct pch_thermal_device {
8484
void __iomem *hw_base;
85-
const struct pch_dev_ops *ops;
8685
struct pci_dev *pdev;
8786
struct thermal_zone_device *tzd;
8887
struct thermal_trip trips[PCH_MAX_TRIPS];
@@ -251,25 +250,11 @@ static int pch_resume(struct pch_thermal_device *ptd)
251250
return 0;
252251
}
253252

254-
struct pch_dev_ops {
255-
int (*hw_init)(struct pch_thermal_device *ptd);
256-
int (*get_temp)(struct pch_thermal_device *ptd);
257-
int (*suspend)(struct pch_thermal_device *ptd);
258-
int (*resume)(struct pch_thermal_device *ptd);
259-
};
260-
261-
static const struct pch_dev_ops pch_dev_ops = {
262-
.hw_init = pch_hw_init,
263-
.get_temp = pch_get_temp,
264-
.suspend = pch_suspend,
265-
.resume = pch_resume,
266-
};
267-
268253
static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp)
269254
{
270255
struct pch_thermal_device *ptd = tzd->devdata;
271256

272-
*temp = ptd->ops->get_temp(ptd);
257+
*temp = pch_get_temp(ptd);
273258
return 0;
274259
}
275260

@@ -295,35 +280,27 @@ enum board_ids {
295280

296281
static const struct board_info {
297282
const char *name;
298-
const struct pch_dev_ops *ops;
299283
} board_info[] = {
300284
[board_hsw] = {
301285
.name = "pch_haswell",
302-
.ops = &pch_dev_ops,
303286
},
304287
[board_wpt] = {
305288
.name = "pch_wildcat_point",
306-
.ops = &pch_dev_ops,
307289
},
308290
[board_skl] = {
309291
.name = "pch_skylake",
310-
.ops = &pch_dev_ops,
311292
},
312293
[board_cnl] = {
313294
.name = "pch_cannonlake",
314-
.ops = &pch_dev_ops,
315295
},
316296
[board_cml] = {
317297
.name = "pch_cometlake",
318-
.ops = &pch_dev_ops,
319298
},
320299
[board_lwb] = {
321300
.name = "pch_lewisburg",
322-
.ops = &pch_dev_ops,
323301
},
324302
[board_wbg] = {
325303
.name = "pch_wellsburg",
326-
.ops = &pch_dev_ops,
327304
},
328305
};
329306

@@ -340,8 +317,6 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev,
340317
if (!ptd)
341318
return -ENOMEM;
342319

343-
ptd->ops = bi->ops;
344-
345320
pci_set_drvdata(pdev, ptd);
346321
ptd->pdev = pdev;
347322

@@ -364,7 +339,7 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev,
364339
goto error_release;
365340
}
366341

367-
nr_trips = ptd->ops->hw_init(ptd);
342+
nr_trips = pch_hw_init(ptd);
368343
if (nr_trips < 0) {
369344
err = nr_trips;
370345
goto error_cleanup;
@@ -412,14 +387,14 @@ static int intel_pch_thermal_suspend_noirq(struct device *device)
412387
{
413388
struct pch_thermal_device *ptd = dev_get_drvdata(device);
414389

415-
return ptd->ops->suspend(ptd);
390+
return pch_suspend(ptd);
416391
}
417392

418393
static int intel_pch_thermal_resume(struct device *device)
419394
{
420395
struct pch_thermal_device *ptd = dev_get_drvdata(device);
421396

422-
return ptd->ops->resume(ptd);
397+
return pch_resume(ptd);
423398
}
424399

425400
static const struct pci_device_id intel_pch_thermal_id[] = {

0 commit comments

Comments
 (0)