aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2007-06-20 07:53:23 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-07-10 02:03:34 -0400
commite654bc4393e85e326993256d80b9710a4d6411ff (patch)
treebf30413fd62f778e4c9abd8bc92e7a399ac37e53 /drivers
parent9cff3b383dad193b0762c27278a16237e10b53dc (diff)
[PATCH] fix request->cmd == INT cases
- I have unearthed very old bugs in stale drivers that still used request->cmd as a READ|WRITE int - This patch is maybe a proof that these drivers have not been used for a long time. Should they be removed completely? Drivers that currently do not work for sure: drivers/acorn/block/fd1772.c | 2 +- drivers/acorn/block/mfmhd.c | 8 ++++---- drivers/cdrom/aztcd.c | 2 +- drivers/cdrom/cm206.c | 2 +- drivers/cdrom/gscd.c | 2 +- drivers/cdrom/mcdx.c | 2 +- drivers/cdrom/optcd.c | 2 +- drivers/cdrom/sjcd.c | 2 +- Drivers with cosmetic fixes only: b/drivers/block/amiflop.c b/drivers/block/nbd.c b/drivers/ide/legacy/hd.c Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acorn/block/fd1772.c2
-rw-r--r--drivers/acorn/block/mfmhd.c13
-rw-r--r--drivers/block/amiflop.c2
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/cdrom/aztcd.c2
-rw-r--r--drivers/cdrom/cm206.c2
-rw-r--r--drivers/cdrom/gscd.c2
-rw-r--r--drivers/cdrom/mcdx.c2
-rw-r--r--drivers/cdrom/optcd.c2
-rw-r--r--drivers/cdrom/sjcd.c2
-rw-r--r--drivers/ide/legacy/hd.c3
11 files changed, 14 insertions, 20 deletions
diff --git a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
index 674bf81c6e66..423ed08fb6f7 100644
--- a/drivers/acorn/block/fd1772.c
+++ b/drivers/acorn/block/fd1772.c
@@ -1246,7 +1246,7 @@ repeat:
1246 del_timer(&motor_off_timer); 1246 del_timer(&motor_off_timer);
1247 1247
1248 ReqCnt = 0; 1248 ReqCnt = 0;
1249 ReqCmd = CURRENT->cmd; 1249 ReqCmd = rq_data_dir(CURRENT);
1250 ReqBlock = CURRENT->sector; 1250 ReqBlock = CURRENT->sector;
1251 ReqBuffer = CURRENT->buffer; 1251 ReqBuffer = CURRENT->buffer;
1252 setup_req_params(drive); 1252 setup_req_params(drive);
diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
index 689a4c3542ba..d85520f78e68 100644
--- a/drivers/acorn/block/mfmhd.c
+++ b/drivers/acorn/block/mfmhd.c
@@ -439,7 +439,7 @@ static void mfm_rw_intr(void)
439 a choice of command end or some data which is ready to be collected */ 439 a choice of command end or some data which is ready to be collected */
440 /* I think we have to transfer data while the interrupt line is on and its 440 /* I think we have to transfer data while the interrupt line is on and its
441 not any other type of interrupt */ 441 not any other type of interrupt */
442 if (CURRENT->cmd == WRITE) { 442 if (rq_data_dir(CURRENT) == WRITE) {
443 extern void hdc63463_writedma(void); 443 extern void hdc63463_writedma(void);
444 if ((hdc63463_dataleft <= 0) && (!(mfm_status & STAT_CED))) { 444 if ((hdc63463_dataleft <= 0) && (!(mfm_status & STAT_CED))) {
445 printk("mfm_rw_intr: Apparent DMA write request when no more to DMA\n"); 445 printk("mfm_rw_intr: Apparent DMA write request when no more to DMA\n");
@@ -799,7 +799,7 @@ static void issue_request(unsigned int block, unsigned int nsect,
799 raw_cmd.head = start_head; 799 raw_cmd.head = start_head;
800 raw_cmd.cylinder = track / p->heads; 800 raw_cmd.cylinder = track / p->heads;
801 raw_cmd.cmdtype = CURRENT->cmd; 801 raw_cmd.cmdtype = CURRENT->cmd;
802 raw_cmd.cmdcode = CURRENT->cmd == WRITE ? CMD_WD : CMD_RD; 802 raw_cmd.cmdcode = rq_data_dir(CURRENT) == WRITE ? CMD_WD : CMD_RD;
803 raw_cmd.cmddata[0] = dev + 1; /* DAG: +1 to get US */ 803 raw_cmd.cmddata[0] = dev + 1; /* DAG: +1 to get US */
804 raw_cmd.cmddata[1] = raw_cmd.head; 804 raw_cmd.cmddata[1] = raw_cmd.head;
805 raw_cmd.cmddata[2] = raw_cmd.cylinder >> 8; 805 raw_cmd.cmddata[2] = raw_cmd.cylinder >> 8;
@@ -830,7 +830,7 @@ static void issue_request(unsigned int block, unsigned int nsect,
830 hdc63463_dataleft = nsect * 256; /* Better way? */ 830 hdc63463_dataleft = nsect * 256; /* Better way? */
831 831
832 DBG("mfm%c: %sing: CHS=%d/%d/%d, sectors=%d, buffer=0x%08lx (%p)\n", 832 DBG("mfm%c: %sing: CHS=%d/%d/%d, sectors=%d, buffer=0x%08lx (%p)\n",
833 raw_cmd.dev + 'a', (CURRENT->cmd == READ) ? "read" : "writ", 833 raw_cmd.dev + 'a', rq_data_dir(CURRENT) == READ ? "read" : "writ",
834 raw_cmd.cylinder, 834 raw_cmd.cylinder,
835 raw_cmd.head, 835 raw_cmd.head,
836 raw_cmd.sector, nsect, (unsigned long) Copy_buffer, CURRENT); 836 raw_cmd.sector, nsect, (unsigned long) Copy_buffer, CURRENT);
@@ -917,13 +917,6 @@ static void mfm_request(void)
917 917
918 DBG("mfm_request: block after offset=%d\n", block); 918 DBG("mfm_request: block after offset=%d\n", block);
919 919
920 if (CURRENT->cmd != READ && CURRENT->cmd != WRITE) {
921 printk("unknown mfm-command %d\n", CURRENT->cmd);
922 end_request(CURRENT, 0);
923 Busy = 0;
924 printk("mfm: continue 4\n");
925 continue;
926 }
927 issue_request(block, nsect, CURRENT); 920 issue_request(block, nsect, CURRENT);
928 921
929 break; 922 break;
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 27a139025ced..6ce8b897e262 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1363,7 +1363,7 @@ static void redo_fd_request(void)
1363#ifdef DEBUG 1363#ifdef DEBUG
1364 printk("fd: sector %ld + %d requested for %s\n", 1364 printk("fd: sector %ld + %d requested for %s\n",
1365 CURRENT->sector,cnt, 1365 CURRENT->sector,cnt,
1366 (CURRENT->cmd==READ)?"read":"write"); 1366 (rq_data_dir(CURRENT) == READ) ? "read" : "write");
1367#endif 1367#endif
1368 block = CURRENT->sector + cnt; 1368 block = CURRENT->sector + cnt;
1369 if ((int)block > floppy->blocks) { 1369 if ((int)block > floppy->blocks) {
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 069ae39a9cd9..c575fb1d585f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -416,7 +416,7 @@ static void nbd_clear_que(struct nbd_device *lo)
416/* 416/*
417 * We always wait for result of write, for now. It would be nice to make it optional 417 * We always wait for result of write, for now. It would be nice to make it optional
418 * in future 418 * in future
419 * if ((req->cmd == WRITE) && (lo->flags & NBD_WRITE_NOCHK)) 419 * if ((rq_data_dir(req) == WRITE) && (lo->flags & NBD_WRITE_NOCHK))
420 * { printk( "Warning: Ignoring result!\n"); nbd_end_request( req ); } 420 * { printk( "Warning: Ignoring result!\n"); nbd_end_request( req ); }
421 */ 421 */
422 422
diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
index 1f9fb7a96703..d7fbfaae2449 100644
--- a/drivers/cdrom/aztcd.c
+++ b/drivers/cdrom/aztcd.c
@@ -229,7 +229,7 @@ static struct request_queue *azt_queue;
229static int current_valid(void) 229static int current_valid(void)
230{ 230{
231 return CURRENT && 231 return CURRENT &&
232 CURRENT->cmd == READ && 232 rq_data_dir(CURRENT) == READ &&
233 CURRENT->sector != -1; 233 CURRENT->sector != -1;
234} 234}
235 235
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c
index 230131163240..2f8fe3b6bbd0 100644
--- a/drivers/cdrom/cm206.c
+++ b/drivers/cdrom/cm206.c
@@ -851,7 +851,7 @@ static void do_cm206_request(request_queue_t * q)
851 if (!req) 851 if (!req)
852 return; 852 return;
853 853
854 if (req->cmd != READ) { 854 if (rq_data_dir(req) != READ) {
855 debug(("Non-read command %d on cdrom\n", req->cmd)); 855 debug(("Non-read command %d on cdrom\n", req->cmd));
856 end_request(req, 0); 856 end_request(req, 0);
857 continue; 857 continue;
diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c
index b3ab6e9b8df1..176742ed007b 100644
--- a/drivers/cdrom/gscd.c
+++ b/drivers/cdrom/gscd.c
@@ -264,7 +264,7 @@ repeat:
264 if (req->sector == -1) 264 if (req->sector == -1)
265 goto out; 265 goto out;
266 266
267 if (req->cmd != READ) { 267 if (rq_data_dir(req) != READ) {
268 printk("GSCD: bad cmd %u\n", rq_data_dir(req)); 268 printk("GSCD: bad cmd %u\n", rq_data_dir(req));
269 end_request(req, 0); 269 end_request(req, 0);
270 goto repeat; 270 goto repeat;
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index 4310cc84dfed..972ee9c8247c 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -596,7 +596,7 @@ static void do_mcdx_request(request_queue_t * q)
596 xtrace(REQUEST, "do_request() (%lu + %lu)\n", 596 xtrace(REQUEST, "do_request() (%lu + %lu)\n",
597 req->sector, req->nr_sectors); 597 req->sector, req->nr_sectors);
598 598
599 if (req->cmd != READ) { 599 if (rq_data_dir(req) != READ) {
600 xwarn("do_request(): non-read command to cd!!\n"); 600 xwarn("do_request(): non-read command to cd!!\n");
601 xtrace(REQUEST, "end_request(0): write\n"); 601 xtrace(REQUEST, "end_request(0): write\n");
602 end_request(req, 0); 602 end_request(req, 0);
diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c
index 3541690a77d4..efd619c0fe10 100644
--- a/drivers/cdrom/optcd.c
+++ b/drivers/cdrom/optcd.c
@@ -977,7 +977,7 @@ static int update_toc(void)
977static int current_valid(void) 977static int current_valid(void)
978{ 978{
979 return CURRENT && 979 return CURRENT &&
980 CURRENT->cmd == READ && 980 rq_data_dir(CURRENT) == READ &&
981 CURRENT->sector != -1; 981 CURRENT->sector != -1;
982} 982}
983 983
diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
index 5409fca5bbfc..76c24e679e68 100644
--- a/drivers/cdrom/sjcd.c
+++ b/drivers/cdrom/sjcd.c
@@ -1064,7 +1064,7 @@ static void sjcd_invalidate_buffers(void)
1064static int current_valid(void) 1064static int current_valid(void)
1065{ 1065{
1066 return CURRENT && 1066 return CURRENT &&
1067 CURRENT->cmd == READ && 1067 rq_data_dir(CURRENT) == READ &&
1068 CURRENT->sector != -1; 1068 CURRENT->sector != -1;
1069} 1069}
1070 1070
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
index 661c12f6dda6..7f4c0a5050a1 100644
--- a/drivers/ide/legacy/hd.c
+++ b/drivers/ide/legacy/hd.c
@@ -623,7 +623,8 @@ repeat:
623 cyl = track / disk->head; 623 cyl = track / disk->head;
624#ifdef DEBUG 624#ifdef DEBUG
625 printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n", 625 printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n",
626 req->rq_disk->disk_name, (req->cmd == READ)?"read":"writ", 626 req->rq_disk->disk_name,
627 req_data_dir(req) == READ ? "read" : "writ",
627 cyl, head, sec, nsect, req->buffer); 628 cyl, head, sec, nsect, req->buffer);
628#endif 629#endif
629 if (blk_fs_request(req)) { 630 if (blk_fs_request(req)) {