Skip to contentSkip to conversation

ACPI / APEI: Convert timers to use timer_setup()

PATCH In review Kees Cook 2 participants 2 messages Oct 16, 2017 – Oct 17, 2017

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 ACPI / APEI: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Len Brown <[email protected]>
Cc Tony Luck <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Tyler Baicar <[email protected]>
Cc Will Deacon <[email protected]>
Cc James Morse <[email protected]>
Cc "Jonathan (Zhixiong) Zhang" <[email protected]>
Cc Shiju Jose <[email protected]>
---
 drivers/acpi/apei/ghes.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/apei/ghes.c +3 -4
index 3c3a37b8503b..ebaa51ba8a22 100644
@@ -774,9 +774,9 @@ static void ghes_add_timer(struct ghes *ghes)
 	add_timer(&ghes->timer);
 }
 
-static void ghes_poll_func(unsigned long data)
+static void ghes_poll_func(struct timer_list *t)
 {
-	struct ghes *ghes = (void *)data;
+	struct ghes *ghes = from_timer(ghes, t, timer);
 
 	ghes_proc(ghes);
 	if (!(ghes->flags & GHES_EXITING))
@@ -1147,8 +1147,7 @@ static int ghes_probe(struct platform_device *ghes_dev)
 
 	switch (generic->notify.type) {
 	case ACPI_HEST_NOTIFY_POLLED:
-		setup_deferrable_timer(&ghes->timer, ghes_poll_func,
-				       (unsigned long)ghes);
+		timer_setup(&ghes->timer, ghes_poll_func, TIMER_DEFERRABLE);
 		ghes_add_timer(ghes);
 		break;
 	case ACPI_HEST_NOTIFY_EXTERNAL:
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
Tested-by on v1 1/1
#1 lore raw
Quoted 4 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Quoted 11 lines
Cc "Rafael J. Wysocki" <[email protected]>
Cc Len Brown <[email protected]>
Cc Tony Luck <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Tyler Baicar <[email protected]>
Cc Will Deacon <[email protected]>
Cc James Morse <[email protected]>
Cc "Jonathan (Zhixiong) Zhang" <[email protected]>
Cc Shiju Jose <[email protected]>

Verified that the polled error sources still work with this timer setup.

Thanks,
Tyler

Quoted 30 lines
---
  drivers/acpi/apei/ghes.c | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/apei/ghes.c +3 -4
index 3c3a37b8503b..ebaa51ba8a22 100644
@@ -774,9 +774,9 @@ static void ghes_add_timer(struct ghes *ghes)
  	add_timer(&ghes->timer);
  }
 
-static void ghes_poll_func(unsigned long data)
+static void ghes_poll_func(struct timer_list *t)
  {
-	struct ghes *ghes = (void *)data;
+	struct ghes *ghes = from_timer(ghes, t, timer);
 
  	ghes_proc(ghes);
  	if (!(ghes->flags & GHES_EXITING))
@@ -1147,8 +1147,7 @@ static int ghes_probe(struct platform_device *ghes_dev)
 
  	switch (generic->notify.type) {
  	case ACPI_HEST_NOTIFY_POLLED:
-		setup_deferrable_timer(&ghes->timer, ghes_poll_func,
-				       (unsigned long)ghes);
+		timer_setup(&ghes->timer, ghes_poll_func, TIMER_DEFERRABLE);
  		ghes_add_timer(ghes);
  		break;
  	case ACPI_HEST_NOTIFY_EXTERNAL: