patch-2.4.11-dontuse linux/drivers/s390/char/hwc_cpi.c

Next file: linux/drivers/s390/char/hwc_rw.c
Previous file: linux/drivers/s390/char/ctrlchar.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.10/linux/drivers/s390/char/hwc_cpi.c linux/drivers/s390/char/hwc_cpi.c
@@ -16,6 +16,9 @@
 #include "hwc_rw.h"
 #include "hwc.h"
 
+#define CPI_RETRIES		3
+#define CPI_SLEEP_TICKS		50
+
 #define CPI_LENGTH_SYSTEM_TYPE	8
 #define CPI_LENGTH_SYSTEM_NAME	8
 #define CPI_LENGTH_SYSPLEX_NAME	8
@@ -84,6 +87,7 @@
 	int system_type_length;
 	int system_name_length;
 	int sysplex_name_length = 0;
+	int retries;
 
 	if (!MACHINE_HAS_HWC) {
 		printk ("cpi: bug: hardware console not present\n");
@@ -163,21 +167,29 @@
 	cpi_request.word = HWC_CMDW_WRITEDATA;
 	cpi_request.callback = cpi_callback;
 
-	retval = hwc_send (&cpi_request);
-	if (retval) {
-		printk ("cpi: failed (%i)\n", retval);
-		goto free;
-	}
-	down (&sem);
-
-	switch (cpi_hwcb->response_code) {
-	case 0x0020:
-		printk ("cpi: succeeded\n");
-		break;
-	default:
-		printk ("cpi: failed with response code 0x%x\n",
-			cpi_hwcb->response_code);
+	for (retries = CPI_RETRIES; retries; retries--) {
+		retval = hwc_send (&cpi_request);
+		if (retval) {
+
+			set_current_state (TASK_INTERRUPTIBLE);
+			schedule_timeout (CPI_SLEEP_TICKS);
+		} else {
+
+			down (&sem);
+
+			switch (cpi_hwcb->response_code) {
+			case 0x0020:
+				printk ("cpi: succeeded\n");
+				break;
+			default:
+				printk ("cpi: failed with response code 0x%x\n",
+					cpi_hwcb->response_code);
+			}
+			goto free;
+		}
 	}
+
+	printk ("cpi: failed (%i)\n", retval);
 
       free:
 	kfree (cpi_hwcb);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)