diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2007-11-14 19:59:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:39 -0500 |
commit | e62aa046e1748b8ea0354951685478030392cf56 (patch) | |
tree | 075f0698a025da5518d70ad90336d42aa09ffb52 /drivers/block | |
parent | ba0a7f39ce8cd54a1b2f3adb03509ff251a91bde (diff) |
paride: pf driver fixes
The pf driver for parallel port floppy drives seems to be broken. At least
with Imation SuperDisk with EPAT chip, the driver calls pi_connect() and
pi_disconnect after each transferred sector. At least with EPAT, this
operation is very expensive - causes drive recalibration. Thus, transferring
even a single byte (dd if=/dev/pf0 of=/dev/null bs=1 count=1) takes 20
seconds, making the driver useless.
The pf_next_buf() function seems to be broken as it returns 1 always (except
when pf_run is non-zero), causing the loop in do_pf_read_drq (and
do_pf_write_drq) to be executed only once.
The following patch fixes this problem. It also fixes swapped descriptions in
pf_lock() function and removes DBMSG macro, which seems useless.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/paride/pf.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index ceffa6034e20..e7fe6ca97dd8 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -488,13 +488,11 @@ static int pf_atapi(struct pf_unit *pf, char *cmd, int dlen, char *buf, char *fu | |||
488 | return r; | 488 | return r; |
489 | } | 489 | } |
490 | 490 | ||
491 | #define DBMSG(msg) ((verbose>1)?(msg):NULL) | ||
492 | |||
493 | static void pf_lock(struct pf_unit *pf, int func) | 491 | static void pf_lock(struct pf_unit *pf, int func) |
494 | { | 492 | { |
495 | char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; | 493 | char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; |
496 | 494 | ||
497 | pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "unlock" : "lock"); | 495 | pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "lock" : "unlock"); |
498 | } | 496 | } |
499 | 497 | ||
500 | static void pf_eject(struct pf_unit *pf) | 498 | static void pf_eject(struct pf_unit *pf) |
@@ -555,7 +553,7 @@ static void pf_mode_sense(struct pf_unit *pf) | |||
555 | { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; | 553 | { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; |
556 | char buf[8]; | 554 | char buf[8]; |
557 | 555 | ||
558 | pf_atapi(pf, ms_cmd, 8, buf, DBMSG("mode sense")); | 556 | pf_atapi(pf, ms_cmd, 8, buf, "mode sense"); |
559 | pf->media_status = PF_RW; | 557 | pf->media_status = PF_RW; |
560 | if (buf[3] & 0x80) | 558 | if (buf[3] & 0x80) |
561 | pf->media_status = PF_RO; | 559 | pf->media_status = PF_RO; |
@@ -591,7 +589,7 @@ static void pf_get_capacity(struct pf_unit *pf) | |||
591 | char buf[8]; | 589 | char buf[8]; |
592 | int bs; | 590 | int bs; |
593 | 591 | ||
594 | if (pf_atapi(pf, rc_cmd, 8, buf, DBMSG("get capacity"))) { | 592 | if (pf_atapi(pf, rc_cmd, 8, buf, "get capacity")) { |
595 | pf->media_status = PF_NM; | 593 | pf->media_status = PF_NM; |
596 | return; | 594 | return; |
597 | } | 595 | } |
@@ -804,13 +802,18 @@ static int pf_next_buf(void) | |||
804 | pf_buf += 512; | 802 | pf_buf += 512; |
805 | pf_block++; | 803 | pf_block++; |
806 | if (!pf_run) | 804 | if (!pf_run) |
807 | return 0; | ||
808 | if (!pf_count) | ||
809 | return 1; | 805 | return 1; |
810 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 806 | if (!pf_count) { |
811 | pf_end_request(1); | 807 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
812 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 808 | pf_end_request(1); |
813 | return 1; | 809 | pf_req = elv_next_request(pf_queue); |
810 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | ||
811 | if (!pf_req) | ||
812 | return 1; | ||
813 | pf_count = pf_req->current_nr_sectors; | ||
814 | pf_buf = pf_req->buffer; | ||
815 | } | ||
816 | return 0; | ||
814 | } | 817 | } |
815 | 818 | ||
816 | static inline void next_request(int success) | 819 | static inline void next_request(int success) |