linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] leds: ledtrig-activity: use ktime_get_boot_ns()
@ 2018-06-19  8:18 Arnd Bergmann
  2018-06-19 20:42 ` Jacek Anaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-06-19  8:18 UTC (permalink / raw)
  To: Jacek Anaszewski, Pavel Machek
  Cc: y2038, Arnd Bergmann, Willy Tarreau, linux-leds, linux-kernel

get_monotonic_boottime() is deprecated, so let's convert this to
the simpler ktime_get_boot_ns().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: don't drop 'cpus' multiplication, as Pavel and Willy point out
    that needs to be kept
---
 drivers/leds/trigger/ledtrig-activity.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
index 5081894082bd..6c6f8a9b8d9a 100644
--- a/drivers/leds/trigger/ledtrig-activity.c
+++ b/drivers/leds/trigger/ledtrig-activity.c
@@ -37,7 +37,6 @@ static void led_activity_function(struct timer_list *t)
 	struct activity_data *activity_data = from_timer(activity_data, t,
 							 timer);
 	struct led_classdev *led_cdev = activity_data->led_cdev;
-	struct timespec boot_time;
 	unsigned int target;
 	unsigned int usage;
 	int delay;
@@ -57,8 +56,6 @@ static void led_activity_function(struct timer_list *t)
 		return;
 	}
 
-	get_monotonic_boottime(&boot_time);
-
 	cpus = 0;
 	curr_used = 0;
 
@@ -76,7 +73,7 @@ static void led_activity_function(struct timer_list *t)
 	 * down to 16us, ensuring we won't overflow 32-bit computations below
 	 * even up to 3k CPUs, while keeping divides cheap on smaller systems.
 	 */
-	curr_boot = timespec_to_ns(&boot_time) * cpus;
+	curr_boot = ktime_get_boot_ns() * cpus;
 	diff_boot = (curr_boot - activity_data->last_boot) >> 16;
 	diff_used = (curr_used - activity_data->last_used) >> 16;
 	activity_data->last_boot = curr_boot;
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [v2] leds: ledtrig-activity: use ktime_get_boot_ns()
  2018-06-19  8:18 [PATCH] [v2] leds: ledtrig-activity: use ktime_get_boot_ns() Arnd Bergmann
@ 2018-06-19 20:42 ` Jacek Anaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Jacek Anaszewski @ 2018-06-19 20:42 UTC (permalink / raw)
  To: Arnd Bergmann, Pavel Machek
  Cc: y2038, Willy Tarreau, linux-leds, linux-kernel

Hi Arnd,

Thank you for the update.

On 06/19/2018 10:18 AM, Arnd Bergmann wrote:
> get_monotonic_boottime() is deprecated, so let's convert this to
> the simpler ktime_get_boot_ns().
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: don't drop 'cpus' multiplication, as Pavel and Willy point out
>      that needs to be kept
> ---
>   drivers/leds/trigger/ledtrig-activity.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
> index 5081894082bd..6c6f8a9b8d9a 100644
> --- a/drivers/leds/trigger/ledtrig-activity.c
> +++ b/drivers/leds/trigger/ledtrig-activity.c
> @@ -37,7 +37,6 @@ static void led_activity_function(struct timer_list *t)
>   	struct activity_data *activity_data = from_timer(activity_data, t,
>   							 timer);
>   	struct led_classdev *led_cdev = activity_data->led_cdev;
> -	struct timespec boot_time;
>   	unsigned int target;
>   	unsigned int usage;
>   	int delay;
> @@ -57,8 +56,6 @@ static void led_activity_function(struct timer_list *t)
>   		return;
>   	}
>   
> -	get_monotonic_boottime(&boot_time);
> -
>   	cpus = 0;
>   	curr_used = 0;
>   
> @@ -76,7 +73,7 @@ static void led_activity_function(struct timer_list *t)
>   	 * down to 16us, ensuring we won't overflow 32-bit computations below
>   	 * even up to 3k CPUs, while keeping divides cheap on smaller systems.
>   	 */
> -	curr_boot = timespec_to_ns(&boot_time) * cpus;
> +	curr_boot = ktime_get_boot_ns() * cpus;
>   	diff_boot = (curr_boot - activity_data->last_boot) >> 16;
>   	diff_used = (curr_used - activity_data->last_used) >> 16;
>   	activity_data->last_boot = curr_boot;
> 

Applied.

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-19 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19  8:18 [PATCH] [v2] leds: ledtrig-activity: use ktime_get_boot_ns() Arnd Bergmann
2018-06-19 20:42 ` Jacek Anaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).