|
@@ -710,31 +710,29 @@ static void hpet_work(struct work_struct *w)
|
|
|
complete(&hpet_work->complete);
|
|
|
}
|
|
|
|
|
|
-static int hpet_cpuhp_notify(struct notifier_block *n,
|
|
|
- unsigned long action, void *hcpu)
|
|
|
+static int hpet_cpuhp_online(unsigned int cpu)
|
|
|
{
|
|
|
- unsigned long cpu = (unsigned long)hcpu;
|
|
|
struct hpet_work_struct work;
|
|
|
+
|
|
|
+ INIT_DELAYED_WORK_ONSTACK(&work.work, hpet_work);
|
|
|
+ init_completion(&work.complete);
|
|
|
+ /* FIXME: add schedule_work_on() */
|
|
|
+ schedule_delayed_work_on(cpu, &work.work, 0);
|
|
|
+ wait_for_completion(&work.complete);
|
|
|
+ destroy_delayed_work_on_stack(&work.work);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int hpet_cpuhp_dead(unsigned int cpu)
|
|
|
+{
|
|
|
struct hpet_dev *hdev = per_cpu(cpu_hpet_dev, cpu);
|
|
|
|
|
|
- switch (action & ~CPU_TASKS_FROZEN) {
|
|
|
- case CPU_ONLINE:
|
|
|
- INIT_DELAYED_WORK_ONSTACK(&work.work, hpet_work);
|
|
|
- init_completion(&work.complete);
|
|
|
- /* FIXME: add schedule_work_on() */
|
|
|
- schedule_delayed_work_on(cpu, &work.work, 0);
|
|
|
- wait_for_completion(&work.complete);
|
|
|
- destroy_delayed_work_on_stack(&work.work);
|
|
|
- break;
|
|
|
- case CPU_DEAD:
|
|
|
- if (hdev) {
|
|
|
- free_irq(hdev->irq, hdev);
|
|
|
- hdev->flags &= ~HPET_DEV_USED;
|
|
|
- per_cpu(cpu_hpet_dev, cpu) = NULL;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- return NOTIFY_OK;
|
|
|
+ if (!hdev)
|
|
|
+ return 0;
|
|
|
+ free_irq(hdev->irq, hdev);
|
|
|
+ hdev->flags &= ~HPET_DEV_USED;
|
|
|
+ per_cpu(cpu_hpet_dev, cpu) = NULL;
|
|
|
+ return 0;
|
|
|
}
|
|
|
#else
|
|
|
|
|
@@ -750,11 +748,8 @@ static void hpet_reserve_msi_timers(struct hpet_data *hd)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-static int hpet_cpuhp_notify(struct notifier_block *n,
|
|
|
- unsigned long action, void *hcpu)
|
|
|
-{
|
|
|
- return NOTIFY_OK;
|
|
|
-}
|
|
|
+#define hpet_cpuhp_online NULL
|
|
|
+#define hpet_cpuhp_dead NULL
|
|
|
|
|
|
#endif
|
|
|
|
|
@@ -931,7 +926,7 @@ out_nohpet:
|
|
|
*/
|
|
|
static __init int hpet_late_init(void)
|
|
|
{
|
|
|
- int cpu;
|
|
|
+ int ret;
|
|
|
|
|
|
if (boot_hpet_disable)
|
|
|
return -ENODEV;
|
|
@@ -961,16 +956,20 @@ static __init int hpet_late_init(void)
|
|
|
if (boot_cpu_has(X86_FEATURE_ARAT))
|
|
|
return 0;
|
|
|
|
|
|
- cpu_notifier_register_begin();
|
|
|
- for_each_online_cpu(cpu) {
|
|
|
- hpet_cpuhp_notify(NULL, CPU_ONLINE, (void *)(long)cpu);
|
|
|
- }
|
|
|
-
|
|
|
/* This notifier should be called after workqueue is ready */
|
|
|
- __hotcpu_notifier(hpet_cpuhp_notify, -20);
|
|
|
- cpu_notifier_register_done();
|
|
|
-
|
|
|
+ ret = cpuhp_setup_state(CPUHP_AP_X86_HPET_ONLINE, "AP_X86_HPET_ONLINE",
|
|
|
+ hpet_cpuhp_online, NULL);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+ ret = cpuhp_setup_state(CPUHP_X86_HPET_DEAD, "X86_HPET_DEAD", NULL,
|
|
|
+ hpet_cpuhp_dead);
|
|
|
+ if (ret)
|
|
|
+ goto err_cpuhp;
|
|
|
return 0;
|
|
|
+
|
|
|
+err_cpuhp:
|
|
|
+ cpuhp_remove_state(CPUHP_AP_X86_HPET_ONLINE);
|
|
|
+ return ret;
|
|
|
}
|
|
|
fs_initcall(hpet_late_init);
|
|
|
|