aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/paride
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/paride')
-rw-r--r--drivers/block/paride/pf.c25
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
493static void pf_lock(struct pf_unit *pf, int func) 491static 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
500static void pf_eject(struct pf_unit *pf) 498static 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
816static inline void next_request(int success) 819static inline void next_request(int success)