Commit 558718f4 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

thermal: intel: intel_pch: Eliminate redundant return pointers

Both pch_wpt_init() and pch_wpt_get_temp() can return the proper
result via their return values, so they do not need to use return
pointers.

Modify them accordingly.

No intentional functional impact.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: default avatarZhang Rui <rui.zhang@intel.com>
Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 2cee7356
...@@ -118,12 +118,11 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip) ...@@ -118,12 +118,11 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip)
} }
#endif #endif
static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips) static int pch_wpt_init(struct pch_thermal_device *ptd)
{ {
u8 tsel; int nr_trips = 0;
u16 trip_temp; u16 trip_temp;
u8 tsel;
*nr_trips = 0;
/* Check if BIOS has already enabled thermal sensor */ /* Check if BIOS has already enabled thermal sensor */
if (WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL)) { if (WPT_TSEL_ETS & readb(ptd->hw_base + WPT_TSEL)) {
...@@ -151,29 +150,23 @@ static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips) ...@@ -151,29 +150,23 @@ static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips)
trip_temp = readw(ptd->hw_base + WPT_CTT); trip_temp = readw(ptd->hw_base + WPT_CTT);
trip_temp &= 0x1FF; trip_temp &= 0x1FF;
if (trip_temp) { if (trip_temp) {
ptd->trips[*nr_trips].temperature = GET_WPT_TEMP(trip_temp); ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp);
ptd->trips[*nr_trips].type = THERMAL_TRIP_CRITICAL; ptd->trips[nr_trips++].type = THERMAL_TRIP_CRITICAL;
++(*nr_trips);
} }
trip_temp = readw(ptd->hw_base + WPT_PHL); trip_temp = readw(ptd->hw_base + WPT_PHL);
trip_temp &= 0x1FF; trip_temp &= 0x1FF;
if (trip_temp) { if (trip_temp) {
ptd->trips[*nr_trips].temperature = GET_WPT_TEMP(trip_temp); ptd->trips[nr_trips].temperature = GET_WPT_TEMP(trip_temp);
ptd->trips[*nr_trips].type = THERMAL_TRIP_HOT; ptd->trips[nr_trips++].type = THERMAL_TRIP_HOT;
++(*nr_trips);
} }
*nr_trips += pch_wpt_add_acpi_psv_trip(ptd, *nr_trips); return nr_trips + pch_wpt_add_acpi_psv_trip(ptd, nr_trips);
return 0;
} }
static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp) static int pch_wpt_get_temp(struct pch_thermal_device *ptd)
{ {
*temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); return GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP));
return 0;
} }
/* Cool the PCH when it's overheat in .suspend_noirq phase */ /* Cool the PCH when it's overheat in .suspend_noirq phase */
...@@ -259,8 +252,8 @@ static int pch_wpt_resume(struct pch_thermal_device *ptd) ...@@ -259,8 +252,8 @@ static int pch_wpt_resume(struct pch_thermal_device *ptd)
} }
struct pch_dev_ops { struct pch_dev_ops {
int (*hw_init)(struct pch_thermal_device *ptd, int *nr_trips); int (*hw_init)(struct pch_thermal_device *ptd);
int (*get_temp)(struct pch_thermal_device *ptd, int *temp); int (*get_temp)(struct pch_thermal_device *ptd);
int (*suspend)(struct pch_thermal_device *ptd); int (*suspend)(struct pch_thermal_device *ptd);
int (*resume)(struct pch_thermal_device *ptd); int (*resume)(struct pch_thermal_device *ptd);
}; };
...@@ -278,7 +271,8 @@ static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) ...@@ -278,7 +271,8 @@ static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp)
{ {
struct pch_thermal_device *ptd = tzd->devdata; struct pch_thermal_device *ptd = tzd->devdata;
return ptd->ops->get_temp(ptd, temp); *temp = ptd->ops->get_temp(ptd);
return 0;
} }
static void pch_critical(struct thermal_zone_device *tzd) static void pch_critical(struct thermal_zone_device *tzd)
...@@ -372,9 +366,11 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, ...@@ -372,9 +366,11 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev,
goto error_release; goto error_release;
} }
err = ptd->ops->hw_init(ptd, &nr_trips); nr_trips = ptd->ops->hw_init(ptd);
if (err) if (nr_trips < 0) {
err = nr_trips;
goto error_cleanup; goto error_cleanup;
}
ptd->tzd = thermal_zone_device_register_with_trips(bi->name, ptd->trips, ptd->tzd = thermal_zone_device_register_with_trips(bi->name, ptd->trips,
nr_trips, 0, ptd, nr_trips, 0, ptd,
......
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