Re: [PATCH v3 06/12] thermal/core: Move thermal_set_delay_jiffies to static

Lukasz Luba
2022-07-04T08:05:36Z

On 7/3/22 19:30, Daniel Lezcano wrote:
> The function 'thermal_set_delay_jiffies' is only used in
> thermal_core.c but it is defined and implemented in a separate
> file. Move the function to thermal_core.c and make it static.
>
> Cc: Alexandre Bailon <abailon@baylibre.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc; Eduardo Valentin <eduval@amazon.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> ---
> drivers/thermal/thermal_core.c | 7 +++++++
> drivers/thermal/thermal_core.h | 1 -
> drivers/thermal/thermal_helpers.c | 7 -------
> 3 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index e22e7d939c54..a8b1628937c6 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1159,6 +1159,13 @@ static void bind_tz(struct thermal_zone_device *tz)
> mutex_unlock(&thermal_list_lock);
> }
>
> +static void thermal_set_delay_jiffies(unsigned long *delay_jiffies, int delay_ms)
> +{
> + *delay_jiffies = msecs_to_jiffies(delay_ms);
> + if (delay_ms > 1000)
> + *delay_jiffies = round_jiffies(*delay_jiffies);
> +}
> +
> /**
> * thermal_zone_device_register() - register a new thermal zone device
> * @type: the thermal zone device type
> diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
> index 60844e2d59bb..c991bb290512 100644
> --- a/drivers/thermal/thermal_core.h
> +++ b/drivers/thermal/thermal_core.h
> @@ -112,7 +112,6 @@ int thermal_build_list_of_policies(char *buf);
>
> /* Helpers */
> void thermal_zone_set_trips(struct thermal_zone_device *tz);
> -void thermal_set_delay_jiffies(unsigned long *delay_jiffies, int delay_ms);
>
> /* sysfs I/F */
> int thermal_zone_create_device_groups(struct thermal_zone_device *, int);
> diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
> index f4c1e87ef040..60bfda1a1db7 100644
> --- a/drivers/thermal/thermal_helpers.c
> +++ b/drivers/thermal/thermal_helpers.c
> @@ -174,13 +174,6 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz)
> mutex_unlock(&tz->lock);
> }
>
> -void thermal_set_delay_jiffies(unsigned long *delay_jiffies, int delay_ms)
> -{
> - *delay_jiffies = msecs_to_jiffies(delay_ms);
> - if (delay_ms > 1000)
> - *delay_jiffies = round_jiffies(*delay_jiffies);
> -}
> -
> static void thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev,
> int target)
> {

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>