Commit 3691314a authored by Kees Cook's avatar Kees Cook Committed by Bjorn Helgaas

PCI: shpchp: 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.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Quentin Lambert <lambert.quentin@gmail.com>
Cc: Aleksandr Bezzubikov <zuban32s@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
parent 34d773f6
...@@ -229,14 +229,13 @@ static inline int shpc_indirect_read(struct controller *ctrl, int index, ...@@ -229,14 +229,13 @@ static inline int shpc_indirect_read(struct controller *ctrl, int index,
/* /*
* This is the interrupt polling timeout function. * This is the interrupt polling timeout function.
*/ */
static void int_poll_timeout(unsigned long data) static void int_poll_timeout(struct timer_list *t)
{ {
struct controller *ctrl = (struct controller *)data; struct controller *ctrl = from_timer(ctrl, t, poll_timer);
/* Poll for interrupt events. regs == NULL => polling */ /* Poll for interrupt events. regs == NULL => polling */
shpc_isr(0, ctrl); shpc_isr(0, ctrl);
init_timer(&ctrl->poll_timer);
if (!shpchp_poll_time) if (!shpchp_poll_time)
shpchp_poll_time = 2; /* default polling interval is 2 sec */ shpchp_poll_time = 2; /* default polling interval is 2 sec */
...@@ -252,8 +251,6 @@ static void start_int_poll_timer(struct controller *ctrl, int sec) ...@@ -252,8 +251,6 @@ static void start_int_poll_timer(struct controller *ctrl, int sec)
if ((sec <= 0) || (sec > 60)) if ((sec <= 0) || (sec > 60))
sec = 2; sec = 2;
ctrl->poll_timer.function = &int_poll_timeout;
ctrl->poll_timer.data = (unsigned long)ctrl;
ctrl->poll_timer.expires = jiffies + sec * HZ; ctrl->poll_timer.expires = jiffies + sec * HZ;
add_timer(&ctrl->poll_timer); add_timer(&ctrl->poll_timer);
} }
...@@ -1054,7 +1051,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1054,7 +1051,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
if (shpchp_poll_mode) { if (shpchp_poll_mode) {
/* Install interrupt polling timer. Start with 10 sec delay */ /* Install interrupt polling timer. Start with 10 sec delay */
init_timer(&ctrl->poll_timer); timer_setup(&ctrl->poll_timer, int_poll_timeout, 0);
start_int_poll_timer(ctrl, 10); start_int_poll_timer(ctrl, 10);
} else { } else {
/* Installs the interrupt handler */ /* Installs the interrupt handler */
......
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