Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ahci: 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. Adds a pointer back to link
structure.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Link: https://lkml.kernel.org/r/20171016215658.GA101965@beast

authored by

Kees Cook and committed by
Thomas Gleixner
1843594c 3a29ddb1

+7 -5
+1
drivers/ata/ahci.h
··· 303 303 unsigned long saved_activity; 304 304 unsigned long activity; 305 305 unsigned long led_state; 306 + struct ata_link *link; 306 307 }; 307 308 308 309 struct ahci_port_priv {
+6 -5
drivers/ata/libahci.c
··· 968 968 mod_timer(&emp->timer, jiffies + msecs_to_jiffies(10)); 969 969 } 970 970 971 - static void ahci_sw_activity_blink(unsigned long arg) 971 + static void ahci_sw_activity_blink(struct timer_list *t) 972 972 { 973 - struct ata_link *link = (struct ata_link *)arg; 973 + struct ahci_em_priv *emp = from_timer(emp, t, timer); 974 + struct ata_link *link = emp->link; 974 975 struct ata_port *ap = link->ap; 975 - struct ahci_port_priv *pp = ap->private_data; 976 - struct ahci_em_priv *emp = &pp->em_priv[link->pmp]; 976 + 977 977 unsigned long led_message = emp->led_state; 978 978 u32 activity_led_state; 979 979 unsigned long flags; ··· 1020 1020 1021 1021 /* init activity stats, setup timer */ 1022 1022 emp->saved_activity = emp->activity = 0; 1023 - setup_timer(&emp->timer, ahci_sw_activity_blink, (unsigned long)link); 1023 + emp->link = link; 1024 + timer_setup(&emp->timer, ahci_sw_activity_blink, 0); 1024 1025 1025 1026 /* check our blink policy and set flag for link if it's enabled */ 1026 1027 if (emp->blink_policy)