Skip to contentSkip to conversation

parport: ip32: restore state on fast EPP timeout

PATCH New Avi Weiss 1 participant 1 message Oct 28 Parallel port

lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 parport: ip32: restore state on fast EPP timeout

parport_ip32_epp_read() and parport_ip32_epp_write() return -EIO on a fast EPP timeout without restoring PS/2 mode. The read path also leaves the data lines in reverse direction.

Restore the mode and data direction before returning the error, as in the non-fast timeout paths.

Fixes 8e75f744289f ("[PATCH] parport: add parallel port support for SGI O2")
---
 drivers/parport/parport_ip32.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/parport/parport_ip32.c +3 -0
index 14a4f4251d5cf..103a75a17eda0 100644
@@ -1109,6 +1109,8 @@ static size_t parport_ip32_epp_read(void __iomem *eppreg,
 		readsb(eppreg, buf, len);
 		if (readb(priv->regs.dsr) & DSR_TIMEOUT) {
 			parport_ip32_clear_epp_timeout(p);
+			parport_ip32_data_forward(p);
+			parport_ip32_set_mode(p, ECR_MODE_PS2);
 			return -EIO;
 		}
 		got = len;
@@ -1148,6 +1150,7 @@ static size_t parport_ip32_epp_write(void __iomem *eppreg,
 		writesb(eppreg, buf, len);
 		if (readb(priv->regs.dsr) & DSR_TIMEOUT) {
 			parport_ip32_clear_epp_timeout(p);
+			parport_ip32_set_mode(p, ECR_MODE_PS2);
 			return -EIO;
 		}
 		written = len;

base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d

Signature · 1 line
2.43.0