Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
[safe/jmp/linux-2.6] / net / iucv / iucv.c
index 3973d0e..f28ad2c 100644 (file)
@@ -93,7 +93,7 @@ static int iucv_pm_freeze(struct device *);
 static int iucv_pm_thaw(struct device *);
 static int iucv_pm_restore(struct device *);
 
-static struct dev_pm_ops iucv_pm_ops = {
+static const struct dev_pm_ops iucv_pm_ops = {
        .prepare = iucv_pm_prepare,
        .complete = iucv_pm_complete,
        .freeze = iucv_pm_freeze,
@@ -632,13 +632,14 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
                iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
                                        GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
                if (!iucv_irq_data[cpu])
-                       return NOTIFY_BAD;
+                       return notifier_from_errno(-ENOMEM);
+
                iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
                                     GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
                if (!iucv_param[cpu]) {
                        kfree(iucv_irq_data[cpu]);
                        iucv_irq_data[cpu] = NULL;
-                       return NOTIFY_BAD;
+                       return notifier_from_errno(-ENOMEM);
                }
                iucv_param_irq[cpu] = kmalloc_node(sizeof(union iucv_param),
                                        GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
@@ -647,7 +648,7 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
                        iucv_param[cpu] = NULL;
                        kfree(iucv_irq_data[cpu]);
                        iucv_irq_data[cpu] = NULL;
-                       return NOTIFY_BAD;
+                       return notifier_from_errno(-ENOMEM);
                }
                break;
        case CPU_UP_CANCELED:
@@ -677,7 +678,7 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
                cpu_clear(cpu, cpumask);
                if (cpus_empty(cpumask))
                        /* Can't offline last IUCV enabled cpu. */
-                       return NOTIFY_BAD;
+                       return notifier_from_errno(-EINVAL);
                smp_call_function_single(cpu, iucv_retrieve_cpu, NULL, 1);
                if (cpus_empty(iucv_irq_cpumask))
                        smp_call_function_single(first_cpu(iucv_buffer_cpumask),
@@ -1768,7 +1769,6 @@ static void iucv_tasklet_fn(unsigned long ignored)
  */
 static void iucv_work_fn(struct work_struct *work)
 {
-       typedef void iucv_irq_fn(struct iucv_irq_data *);
        LIST_HEAD(work_queue);
        struct iucv_irq_list *p, *n;
 
@@ -1878,14 +1878,25 @@ int iucv_path_table_empty(void)
 static int iucv_pm_freeze(struct device *dev)
 {
        int cpu;
+       struct iucv_irq_list *p, *n;
        int rc = 0;
 
 #ifdef CONFIG_PM_DEBUG
        printk(KERN_WARNING "iucv_pm_freeze\n");
 #endif
+       if (iucv_pm_state != IUCV_PM_FREEZING) {
+               for_each_cpu_mask_nr(cpu, iucv_irq_cpumask)
+                       smp_call_function_single(cpu, iucv_block_cpu_almost,
+                                                NULL, 1);
+               cancel_work_sync(&iucv_work);
+               list_for_each_entry_safe(p, n, &iucv_work_queue, list) {
+                       list_del_init(&p->list);
+                       iucv_sever_pathid(p->data.ippathid,
+                                         iucv_error_no_listener);
+                       kfree(p);
+               }
+       }
        iucv_pm_state = IUCV_PM_FREEZING;
-       for_each_cpu_mask_nr(cpu, iucv_irq_cpumask)
-               smp_call_function_single(cpu, iucv_block_cpu_almost, NULL, 1);
        if (dev->driver && dev->driver->pm && dev->driver->pm->freeze)
                rc = dev->driver->pm->freeze(dev);
        if (iucv_path_table_empty())