Skip to contentSkip to conversation

leds: ledtrig-activity: use ktime_get_boot_ns()

PATCH Applied Arnd Bergmann 2 participants 2 messages Jun 19, 2018 LED

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 leds: ledtrig-activity: use ktime_get_boot_ns()

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

---
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(-)
drivers/leds/trigger/ledtrig-activity.c +1 -4
index 5081894082bd..6c6f8a9b8d9a 100644
@@ -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;
Signature · 1 line
2.9.0
#1 lore raw

Hi Arnd,

Thank you for the update.

Quoted 34 lines · Arnd Bergmann

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

---
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(-)
drivers/leds/trigger/ledtrig-activity.c +0 -3
index 5081894082bd..6c6f8a9b8d9a 100644
@@ -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;
 

drivers/leds/trigger/ledtrig-activity.c static void led_activity_function(struct timer_list *t) · line 79

Quoted 8 lines
drivers/leds/trigger/ledtrig-activity.c +1 -1
@@ -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.

Signature · 6 lines
Best regards,
Jacek Anaszewski
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038