]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
PCI: cpqphp: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Mon, 16 Oct 2017 23:18:02 +0000 (16:18 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 7 Nov 2017 00:48:57 +0000 (18:48 -0600)
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.  This has the result of fixing
pushbutton_helper_thread(), which was truncating the event pointer to 32
bits.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Bjorn 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>
drivers/pci/hotplug/cpqphp.h
drivers/pci/hotplug/cpqphp_core.c
drivers/pci/hotplug/cpqphp_ctrl.c

index 48c8a066a6b78fadd6cb3569036e26dcce47fee7..c2bbe6b65d06e444f60fb11ffd1fde4e6cd2753f 100644 (file)
@@ -410,7 +410,7 @@ void cpqhp_create_debugfs_files(struct controller *ctrl);
 void cpqhp_remove_debugfs_files(struct controller *ctrl);
 
 /* controller functions */
-void cpqhp_pushbutton_thread(unsigned long event_pointer);
+void cpqhp_pushbutton_thread(struct timer_list *t);
 irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data);
 int cpqhp_find_available_resources(struct controller *ctrl,
                                   void __iomem *rom_start);
index 4d06b84612559218233749d772d4c53dc1f0aaec..70967ac75265471dacc098abebd319b2699ecef4 100644 (file)
@@ -661,9 +661,8 @@ static int ctrl_slot_setup(struct controller *ctrl,
 
                slot->p_sm_slot = slot_entry;
 
-               init_timer(&slot->task_event);
+               timer_setup(&slot->task_event, cpqhp_pushbutton_thread, 0);
                slot->task_event.expires = jiffies + 5 * HZ;
-               slot->task_event.function = cpqhp_pushbutton_thread;
 
                /*FIXME: these capabilities aren't used but if they are
                 *       they need to be correctly implemented
index a55653b54eeddc5b53ac33bbd03f6e7d3f7dac79..a93069e739cb4d579f0a7aa14832529c0f023c7f 100644 (file)
@@ -47,7 +47,7 @@ static void interrupt_event_handler(struct controller *ctrl);
 
 
 static struct task_struct *cpqhp_event_thread;
-static unsigned long pushbutton_pending;       /* = 0 */
+static struct timer_list *pushbutton_pending;  /* = NULL */
 
 /* delay is in jiffies to wait for */
 static void long_delay(int delay)
@@ -1732,9 +1732,10 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll
        return 0;
 }
 
-static void pushbutton_helper_thread(unsigned long data)
+static void pushbutton_helper_thread(struct timer_list *t)
 {
-       pushbutton_pending = data;
+       pushbutton_pending = t;
+
        wake_up_process(cpqhp_event_thread);
 }
 
@@ -1883,13 +1884,13 @@ static void interrupt_event_handler(struct controller *ctrl)
                                        wait_for_ctrl_irq(ctrl);
 
                                        mutex_unlock(&ctrl->crit_sect);
-                                       init_timer(&p_slot->task_event);
+                                       timer_setup(&p_slot->task_event,
+                                                   pushbutton_helper_thread,
+                                                   0);
                                        p_slot->hp_slot = hp_slot;
                                        p_slot->ctrl = ctrl;
 /*                                     p_slot->physical_slot = physical_slot; */
                                        p_slot->task_event.expires = jiffies + 5 * HZ;   /* 5 second delay */
-                                       p_slot->task_event.function = pushbutton_helper_thread;
-                                       p_slot->task_event.data = (u32) p_slot;
 
                                        dbg("add_timer p_slot = %p\n", p_slot);
                                        add_timer(&p_slot->task_event);
@@ -1920,15 +1921,15 @@ static void interrupt_event_handler(struct controller *ctrl)
  * Scheduled procedure to handle blocking stuff for the pushbuttons.
  * Handles all pending events and exits.
  */
-void cpqhp_pushbutton_thread(unsigned long slot)
+void cpqhp_pushbutton_thread(struct timer_list *t)
 {
        u8 hp_slot;
        u8 device;
        struct pci_func *func;
-       struct slot *p_slot = (struct slot *) slot;
+       struct slot *p_slot = from_timer(p_slot, t, task_event);
        struct controller *ctrl = (struct controller *) p_slot->ctrl;
 
-       pushbutton_pending = 0;
+       pushbutton_pending = NULL;
        hp_slot = p_slot->hp_slot;
 
        device = p_slot->device;