[Linux-parport] [PATCH -FIXED REPOST] parport: parport_daisy_select return value fix

Marko Kohtala marko.kohtala at gmail.com
Tue Nov 8 16:08:20 EST 2005


parport_daisy_select returned wrong status that is read at wrong time
during daisy command execution.

Signed-off-by: Marko Kohtala <marko.kohtala at gmail.com>
---
Sorry for the last mailing which got munged. I hope this works.

This goes with parport-daisy-chain-device-id-reading-fix.patch which
was incomplete and passed earlier tests only because the false return
code just had happened to be what was required.


 drivers/parport/daisy.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

Index: linux-dvb/drivers/parport/daisy.c
===================================================================
--- linux-dvb.orig/drivers/parport/daisy.c	2005-11-06 14:33:02.000000000 +0200
+++ linux-dvb/drivers/parport/daisy.c	2005-11-06 15:00:59.000000000 +0200
@@ -344,9 +344,9 @@ static int cpp_daisy (struct parport *po
 			      PARPORT_CONTROL_STROBE,
 			      PARPORT_CONTROL_STROBE);
 	udelay (1);
+	s = parport_read_status (port);
 	parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
 	udelay (1);
-	s = parport_read_status (port);
 	parport_write_data (port, 0xff); udelay (2);
 
 	return s;
@@ -395,15 +395,15 @@ int parport_daisy_select (struct parport
 		case IEEE1284_MODE_EPP:
 		case IEEE1284_MODE_EPPSL:
 		case IEEE1284_MODE_EPPSWE:
-			return (cpp_daisy (port, 0x20 + daisy) &
-				PARPORT_STATUS_ERROR);
+			return !(cpp_daisy (port, 0x20 + daisy) &
+				 PARPORT_STATUS_ERROR);
 
 		// For these modes we should switch to ECP mode:
 		case IEEE1284_MODE_ECP:
 		case IEEE1284_MODE_ECPRLE:
 		case IEEE1284_MODE_ECPSWE: 
-			return (cpp_daisy (port, 0xd0 + daisy) &
-				PARPORT_STATUS_ERROR);
+			return !(cpp_daisy (port, 0xd0 + daisy) &
+				 PARPORT_STATUS_ERROR);
 
 		// Nothing was told for BECP in Daisy chain specification.
 		// May be it's wise to use ECP?
@@ -413,8 +413,8 @@ int parport_daisy_select (struct parport
 		case IEEE1284_MODE_BYTE:
 		case IEEE1284_MODE_COMPAT:
 		default:
-			return (cpp_daisy (port, 0xe0 + daisy) &
-				PARPORT_STATUS_ERROR);
+			return !(cpp_daisy (port, 0xe0 + daisy) &
+				 PARPORT_STATUS_ERROR);
 	}
 }
 

--



More information about the Linux-parport mailing list