Commit 1948d498 authored by Sumeet Pawnikar's avatar Sumeet Pawnikar Committed by Zhang Rui

thermal: intel: int340x: processor_thermal_device: simplify to get driver data

This simplifies getting the 'driver_data' from 'struct device' directly.
Going through platform_device or pci_dev is not required. Also removes
condition check as the private data stored with dev pointer, means
irrespective of enumeration mode, we can use dev_get_drvdata().
This removes the unnecessary step back and forth.
Signed-off-by: default avatarSumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 6eb61a93
......@@ -81,22 +81,13 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct pci_dev *pci_dev; \
struct platform_device *pdev; \
struct proc_thermal_device *proc_dev; \
struct proc_thermal_device *proc_dev = dev_get_drvdata(dev); \
\
if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \
dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \
return 0; \
} \
\
if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \
pdev = to_platform_device(dev); \
proc_dev = platform_get_drvdata(pdev); \
} else { \
pci_dev = to_pci_dev(dev); \
proc_dev = pci_get_drvdata(pci_dev); \
} \
return sprintf(buf, "%lu\n",\
(unsigned long)proc_dev->power_limits[index].suffix * 1000); \
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment