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: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
6eb61a9361
commit
1948d498dc
|
@ -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); \
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue