diff options
Diffstat (limited to 'net/iucv/iucv.c')
-rw-r--r-- | net/iucv/iucv.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c index c833481d32e3..3973d0e61e56 100644 --- a/net/iucv/iucv.c +++ b/net/iucv/iucv.c | |||
@@ -79,6 +79,14 @@ static int iucv_bus_match(struct device *dev, struct device_driver *drv) | |||
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | enum iucv_pm_states { | ||
83 | IUCV_PM_INITIAL = 0, | ||
84 | IUCV_PM_FREEZING = 1, | ||
85 | IUCV_PM_THAWING = 2, | ||
86 | IUCV_PM_RESTORING = 3, | ||
87 | }; | ||
88 | static enum iucv_pm_states iucv_pm_state; | ||
89 | |||
82 | static int iucv_pm_prepare(struct device *); | 90 | static int iucv_pm_prepare(struct device *); |
83 | static void iucv_pm_complete(struct device *); | 91 | static void iucv_pm_complete(struct device *); |
84 | static int iucv_pm_freeze(struct device *); | 92 | static int iucv_pm_freeze(struct device *); |
@@ -354,7 +362,7 @@ static int iucv_query_maxconn(void) | |||
354 | " srl %0,28\n" | 362 | " srl %0,28\n" |
355 | : "=d" (ccode), "+d" (reg0), "+d" (reg1) : : "cc"); | 363 | : "=d" (ccode), "+d" (reg0), "+d" (reg1) : : "cc"); |
356 | if (ccode == 0) | 364 | if (ccode == 0) |
357 | iucv_max_pathid = reg0; | 365 | iucv_max_pathid = reg1; |
358 | kfree(param); | 366 | kfree(param); |
359 | return ccode ? -EPERM : 0; | 367 | return ccode ? -EPERM : 0; |
360 | } | 368 | } |
@@ -856,7 +864,7 @@ int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler, | |||
856 | int rc; | 864 | int rc; |
857 | 865 | ||
858 | local_bh_disable(); | 866 | local_bh_disable(); |
859 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 867 | if (cpus_empty(iucv_buffer_cpumask)) { |
860 | rc = -EIO; | 868 | rc = -EIO; |
861 | goto out; | 869 | goto out; |
862 | } | 870 | } |
@@ -905,7 +913,7 @@ int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler, | |||
905 | 913 | ||
906 | spin_lock_bh(&iucv_table_lock); | 914 | spin_lock_bh(&iucv_table_lock); |
907 | iucv_cleanup_queue(); | 915 | iucv_cleanup_queue(); |
908 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 916 | if (cpus_empty(iucv_buffer_cpumask)) { |
909 | rc = -EIO; | 917 | rc = -EIO; |
910 | goto out; | 918 | goto out; |
911 | } | 919 | } |
@@ -965,7 +973,7 @@ int iucv_path_quiesce(struct iucv_path *path, u8 userdata[16]) | |||
965 | int rc; | 973 | int rc; |
966 | 974 | ||
967 | local_bh_disable(); | 975 | local_bh_disable(); |
968 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 976 | if (cpus_empty(iucv_buffer_cpumask)) { |
969 | rc = -EIO; | 977 | rc = -EIO; |
970 | goto out; | 978 | goto out; |
971 | } | 979 | } |
@@ -997,7 +1005,7 @@ int iucv_path_resume(struct iucv_path *path, u8 userdata[16]) | |||
997 | int rc; | 1005 | int rc; |
998 | 1006 | ||
999 | local_bh_disable(); | 1007 | local_bh_disable(); |
1000 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1008 | if (cpus_empty(iucv_buffer_cpumask)) { |
1001 | rc = -EIO; | 1009 | rc = -EIO; |
1002 | goto out; | 1010 | goto out; |
1003 | } | 1011 | } |
@@ -1026,7 +1034,7 @@ int iucv_path_sever(struct iucv_path *path, u8 userdata[16]) | |||
1026 | int rc; | 1034 | int rc; |
1027 | 1035 | ||
1028 | preempt_disable(); | 1036 | preempt_disable(); |
1029 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1037 | if (cpus_empty(iucv_buffer_cpumask)) { |
1030 | rc = -EIO; | 1038 | rc = -EIO; |
1031 | goto out; | 1039 | goto out; |
1032 | } | 1040 | } |
@@ -1060,7 +1068,7 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg, | |||
1060 | int rc; | 1068 | int rc; |
1061 | 1069 | ||
1062 | local_bh_disable(); | 1070 | local_bh_disable(); |
1063 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1071 | if (cpus_empty(iucv_buffer_cpumask)) { |
1064 | rc = -EIO; | 1072 | rc = -EIO; |
1065 | goto out; | 1073 | goto out; |
1066 | } | 1074 | } |
@@ -1152,7 +1160,7 @@ int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg, | |||
1152 | if (msg->flags & IUCV_IPRMDATA) | 1160 | if (msg->flags & IUCV_IPRMDATA) |
1153 | return iucv_message_receive_iprmdata(path, msg, flags, | 1161 | return iucv_message_receive_iprmdata(path, msg, flags, |
1154 | buffer, size, residual); | 1162 | buffer, size, residual); |
1155 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1163 | if (cpus_empty(iucv_buffer_cpumask)) { |
1156 | rc = -EIO; | 1164 | rc = -EIO; |
1157 | goto out; | 1165 | goto out; |
1158 | } | 1166 | } |
@@ -1225,7 +1233,7 @@ int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg) | |||
1225 | int rc; | 1233 | int rc; |
1226 | 1234 | ||
1227 | local_bh_disable(); | 1235 | local_bh_disable(); |
1228 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1236 | if (cpus_empty(iucv_buffer_cpumask)) { |
1229 | rc = -EIO; | 1237 | rc = -EIO; |
1230 | goto out; | 1238 | goto out; |
1231 | } | 1239 | } |
@@ -1264,7 +1272,7 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg, | |||
1264 | int rc; | 1272 | int rc; |
1265 | 1273 | ||
1266 | local_bh_disable(); | 1274 | local_bh_disable(); |
1267 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1275 | if (cpus_empty(iucv_buffer_cpumask)) { |
1268 | rc = -EIO; | 1276 | rc = -EIO; |
1269 | goto out; | 1277 | goto out; |
1270 | } | 1278 | } |
@@ -1314,7 +1322,7 @@ int __iucv_message_send(struct iucv_path *path, struct iucv_message *msg, | |||
1314 | union iucv_param *parm; | 1322 | union iucv_param *parm; |
1315 | int rc; | 1323 | int rc; |
1316 | 1324 | ||
1317 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1325 | if (cpus_empty(iucv_buffer_cpumask)) { |
1318 | rc = -EIO; | 1326 | rc = -EIO; |
1319 | goto out; | 1327 | goto out; |
1320 | } | 1328 | } |
@@ -1401,7 +1409,7 @@ int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg, | |||
1401 | int rc; | 1409 | int rc; |
1402 | 1410 | ||
1403 | local_bh_disable(); | 1411 | local_bh_disable(); |
1404 | if (!cpu_isset(smp_processor_id(), iucv_buffer_cpumask)) { | 1412 | if (cpus_empty(iucv_buffer_cpumask)) { |
1405 | rc = -EIO; | 1413 | rc = -EIO; |
1406 | goto out; | 1414 | goto out; |
1407 | } | 1415 | } |
@@ -1875,6 +1883,7 @@ static int iucv_pm_freeze(struct device *dev) | |||
1875 | #ifdef CONFIG_PM_DEBUG | 1883 | #ifdef CONFIG_PM_DEBUG |
1876 | printk(KERN_WARNING "iucv_pm_freeze\n"); | 1884 | printk(KERN_WARNING "iucv_pm_freeze\n"); |
1877 | #endif | 1885 | #endif |
1886 | iucv_pm_state = IUCV_PM_FREEZING; | ||
1878 | for_each_cpu_mask_nr(cpu, iucv_irq_cpumask) | 1887 | for_each_cpu_mask_nr(cpu, iucv_irq_cpumask) |
1879 | smp_call_function_single(cpu, iucv_block_cpu_almost, NULL, 1); | 1888 | smp_call_function_single(cpu, iucv_block_cpu_almost, NULL, 1); |
1880 | if (dev->driver && dev->driver->pm && dev->driver->pm->freeze) | 1889 | if (dev->driver && dev->driver->pm && dev->driver->pm->freeze) |
@@ -1899,6 +1908,7 @@ static int iucv_pm_thaw(struct device *dev) | |||
1899 | #ifdef CONFIG_PM_DEBUG | 1908 | #ifdef CONFIG_PM_DEBUG |
1900 | printk(KERN_WARNING "iucv_pm_thaw\n"); | 1909 | printk(KERN_WARNING "iucv_pm_thaw\n"); |
1901 | #endif | 1910 | #endif |
1911 | iucv_pm_state = IUCV_PM_THAWING; | ||
1902 | if (!iucv_path_table) { | 1912 | if (!iucv_path_table) { |
1903 | rc = iucv_enable(); | 1913 | rc = iucv_enable(); |
1904 | if (rc) | 1914 | if (rc) |
@@ -1933,6 +1943,10 @@ static int iucv_pm_restore(struct device *dev) | |||
1933 | #ifdef CONFIG_PM_DEBUG | 1943 | #ifdef CONFIG_PM_DEBUG |
1934 | printk(KERN_WARNING "iucv_pm_restore %p\n", iucv_path_table); | 1944 | printk(KERN_WARNING "iucv_pm_restore %p\n", iucv_path_table); |
1935 | #endif | 1945 | #endif |
1946 | if ((iucv_pm_state != IUCV_PM_RESTORING) && iucv_path_table) | ||
1947 | pr_warning("Suspending Linux did not completely close all IUCV " | ||
1948 | "connections\n"); | ||
1949 | iucv_pm_state = IUCV_PM_RESTORING; | ||
1936 | if (cpus_empty(iucv_irq_cpumask)) { | 1950 | if (cpus_empty(iucv_irq_cpumask)) { |
1937 | rc = iucv_query_maxconn(); | 1951 | rc = iucv_query_maxconn(); |
1938 | rc = iucv_enable(); | 1952 | rc = iucv_enable(); |