Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c9cc3be authored by Marko Kohtala's avatar Marko Kohtala Committed by Linus Torvalds
Browse files

[PATCH] parport: parport_daisy_select return value fix



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

Signed-off-by: default avatarMarko Kohtala <marko.kohtala@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c29a75ed
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -344,9 +344,9 @@ static int cpp_daisy (struct parport *port, int cmd)
			      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,14 +395,14 @@ int parport_daisy_select (struct parport *port, int daisy, int mode)
		case IEEE1284_MODE_EPP:
		case IEEE1284_MODE_EPPSL:
		case IEEE1284_MODE_EPPSWE:
			return (cpp_daisy (port, 0x20 + daisy) &
			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) &
			return !(cpp_daisy (port, 0xd0 + daisy) &
				 PARPORT_STATUS_ERROR);

		// Nothing was told for BECP in Daisy chain specification.
@@ -413,7 +413,7 @@ int parport_daisy_select (struct parport *port, int daisy, int mode)
		case IEEE1284_MODE_BYTE:
		case IEEE1284_MODE_COMPAT:
		default:
			return (cpp_daisy (port, 0xe0 + daisy) &
			return !(cpp_daisy (port, 0xe0 + daisy) &
				 PARPORT_STATUS_ERROR);
	}
}