m68k: Mac II ADB fixes
[powerpc.git] / drivers / macintosh / windfarm_core.c
index 6c0ba04..94c117e 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <linux/mutex.h>
+#include <linux/freezer.h>
 
 #include <asm/prom.h>
 
@@ -52,7 +53,7 @@
 static LIST_HEAD(wf_controls);
 static LIST_HEAD(wf_sensors);
 static DEFINE_MUTEX(wf_lock);
-static struct notifier_block *wf_client_list;
+static BLOCKING_NOTIFIER_HEAD(wf_client_list);
 static int wf_client_count;
 static unsigned int wf_overtemp;
 static unsigned int wf_overtemp_counter;
@@ -68,7 +69,7 @@ static struct platform_device wf_platform_device = {
 
 static inline void wf_notify(int event, void *param)
 {
-       notifier_call_chain(&wf_client_list, event, param);
+       blocking_notifier_call_chain(&wf_client_list, event, param);
 }
 
 int wf_critical_overtemp(void)
@@ -93,8 +94,6 @@ static int wf_thread_func(void *data)
        DBG("wf: thread started\n");
 
        while(!kthread_should_stop()) {
-               try_to_freeze();
-
                if (time_after_eq(jiffies, next)) {
                        wf_notify(WF_EVENT_TICK, NULL);
                        if (wf_overtemp) {
@@ -117,8 +116,8 @@ static int wf_thread_func(void *data)
                if (delay <= HZ)
                        schedule_timeout_interruptible(delay);
 
-               /* there should be no signal, but oh well */
-               if (signal_pending(current)) {
+               /* there should be no non-suspend signal, but oh well */
+               if (signal_pending(current) && !try_to_freeze()) {
                        printk(KERN_WARNING "windfarm: thread got sigl !\n");
                        break;
                }
@@ -398,7 +397,7 @@ int wf_register_client(struct notifier_block *nb)
        struct wf_sensor *sr;
 
        mutex_lock(&wf_lock);
-       rc = notifier_chain_register(&wf_client_list, nb);
+       rc = blocking_notifier_chain_register(&wf_client_list, nb);
        if (rc != 0)
                goto bail;
        wf_client_count++;
@@ -417,7 +416,7 @@ EXPORT_SYMBOL_GPL(wf_register_client);
 int wf_unregister_client(struct notifier_block *nb)
 {
        mutex_lock(&wf_lock);
-       notifier_chain_unregister(&wf_client_list, nb);
+       blocking_notifier_chain_unregister(&wf_client_list, nb);
        wf_client_count++;
        if (wf_client_count == 0)
                wf_stop_thread();