aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cpia_pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cpia_pp.c')
-rw-r--r--drivers/media/video/cpia_pp.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c
index ddf184f95d80..6861d408f1b3 100644
--- a/drivers/media/video/cpia_pp.c
+++ b/drivers/media/video/cpia_pp.c
@@ -170,16 +170,9 @@ static size_t cpia_read_nibble (struct parport *port,
170 /* Does the error line indicate end of data? */ 170 /* Does the error line indicate end of data? */
171 if (((i /*& 1*/) == 0) && 171 if (((i /*& 1*/) == 0) &&
172 (parport_read_status(port) & PARPORT_STATUS_ERROR)) { 172 (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
173 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 173 DBG("%s: No more nibble data (%d bytes)\n",
174 DBG("%s: No more nibble data (%d bytes)\n", 174 port->name, i/2);
175 port->name, i/2); 175 goto end_of_data;
176
177 /* Go to reverse idle phase. */
178 parport_frob_control (port,
179 PARPORT_CONTROL_AUTOFD,
180 PARPORT_CONTROL_AUTOFD);
181 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
182 break;
183 } 176 }
184 177
185 /* Event 7: Set nAutoFd low. */ 178 /* Event 7: Set nAutoFd low. */
@@ -227,18 +220,21 @@ static size_t cpia_read_nibble (struct parport *port,
227 byte = nibble; 220 byte = nibble;
228 } 221 }
229 222
230 i /= 2; /* i is now in bytes */
231
232 if (i == len) { 223 if (i == len) {
233 /* Read the last nibble without checking data avail. */ 224 /* Read the last nibble without checking data avail. */
234 port = port->physport; 225 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
235 if (parport_read_status (port) & PARPORT_STATUS_ERROR) 226 end_of_data:
236 port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 227 /* Go to reverse idle phase. */
228 parport_frob_control (port,
229 PARPORT_CONTROL_AUTOFD,
230 PARPORT_CONTROL_AUTOFD);
231 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
232 }
237 else 233 else
238 port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; 234 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
239 } 235 }
240 236
241 return i; 237 return i/2;
242} 238}
243 239
244/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) 240/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1)