Commit 1843594c authored by Kees Cook's avatar Kees Cook Committed by Thomas Gleixner

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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Link: https://lkml.kernel.org/r/20171016215658.GA101965@beast
parent 3a29ddb1
...@@ -303,6 +303,7 @@ struct ahci_em_priv { ...@@ -303,6 +303,7 @@ struct ahci_em_priv {
unsigned long saved_activity; unsigned long saved_activity;
unsigned long activity; unsigned long activity;
unsigned long led_state; unsigned long led_state;
struct ata_link *link;
}; };
struct ahci_port_priv { struct ahci_port_priv {
......
...@@ -968,12 +968,12 @@ static void ahci_sw_activity(struct ata_link *link) ...@@ -968,12 +968,12 @@ static void ahci_sw_activity(struct ata_link *link)
mod_timer(&emp->timer, jiffies + msecs_to_jiffies(10)); mod_timer(&emp->timer, jiffies + msecs_to_jiffies(10));
} }
static void ahci_sw_activity_blink(unsigned long arg) static void ahci_sw_activity_blink(struct timer_list *t)
{ {
struct ata_link *link = (struct ata_link *)arg; struct ahci_em_priv *emp = from_timer(emp, t, timer);
struct ata_link *link = emp->link;
struct ata_port *ap = link->ap; struct ata_port *ap = link->ap;
struct ahci_port_priv *pp = ap->private_data;
struct ahci_em_priv *emp = &pp->em_priv[link->pmp];
unsigned long led_message = emp->led_state; unsigned long led_message = emp->led_state;
u32 activity_led_state; u32 activity_led_state;
unsigned long flags; unsigned long flags;
...@@ -1020,7 +1020,8 @@ static void ahci_init_sw_activity(struct ata_link *link) ...@@ -1020,7 +1020,8 @@ static void ahci_init_sw_activity(struct ata_link *link)
/* init activity stats, setup timer */ /* init activity stats, setup timer */
emp->saved_activity = emp->activity = 0; emp->saved_activity = emp->activity = 0;
setup_timer(&emp->timer, ahci_sw_activity_blink, (unsigned long)link); emp->link = link;
timer_setup(&emp->timer, ahci_sw_activity_blink, 0);
/* check our blink policy and set flag for link if it's enabled */ /* check our blink policy and set flag for link if it's enabled */
if (emp->blink_policy) if (emp->blink_policy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment