]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[PATCH] fix request->cmd == INT cases
authorBoaz Harrosh <bharrosh@panasas.com>
Wed, 20 Jun 2007 11:53:23 +0000 (13:53 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 10 Jul 2007 06:03:34 +0000 (08:03 +0200)
 - 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>
drivers/acorn/block/fd1772.c
drivers/acorn/block/mfmhd.c
drivers/block/amiflop.c
drivers/block/nbd.c
drivers/cdrom/aztcd.c
drivers/cdrom/cm206.c
drivers/cdrom/gscd.c
drivers/cdrom/mcdx.c
drivers/cdrom/optcd.c
drivers/cdrom/sjcd.c
drivers/ide/legacy/hd.c

index 674bf81c6e660040ab8d0136ecebd4e9f84aad66..423ed08fb6f74b8c8ac7c9c9c3d9fbcf22d380c0 100644 (file)
@@ -1246,7 +1246,7 @@ repeat:
        del_timer(&motor_off_timer);
 
        ReqCnt = 0;
-       ReqCmd = CURRENT->cmd;
+       ReqCmd = rq_data_dir(CURRENT);
        ReqBlock = CURRENT->sector;
        ReqBuffer = CURRENT->buffer;
        setup_req_params(drive);
index 689a4c3542babc00e385699fe1caf4b02c0f9103..d85520f78e68bcd7ce4c9df214493643cf171bf5 100644 (file)
@@ -439,7 +439,7 @@ static void mfm_rw_intr(void)
           a choice of command end or some data which is ready to be collected */
        /* I think we have to transfer data while the interrupt line is on and its
           not any other type of interrupt */
-       if (CURRENT->cmd == WRITE) {
+       if (rq_data_dir(CURRENT) == WRITE) {
                extern void hdc63463_writedma(void);
                if ((hdc63463_dataleft <= 0) && (!(mfm_status & STAT_CED))) {
                        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,
        raw_cmd.head = start_head;
        raw_cmd.cylinder = track / p->heads;
        raw_cmd.cmdtype = CURRENT->cmd;
-       raw_cmd.cmdcode = CURRENT->cmd == WRITE ? CMD_WD : CMD_RD;
+       raw_cmd.cmdcode = rq_data_dir(CURRENT) == WRITE ? CMD_WD : CMD_RD;
        raw_cmd.cmddata[0] = dev + 1;   /* DAG: +1 to get US */
        raw_cmd.cmddata[1] = raw_cmd.head;
        raw_cmd.cmddata[2] = raw_cmd.cylinder >> 8;
@@ -830,7 +830,7 @@ static void issue_request(unsigned int block, unsigned int nsect,
        hdc63463_dataleft = nsect * 256;        /* Better way? */
 
        DBG("mfm%c: %sing: CHS=%d/%d/%d, sectors=%d, buffer=0x%08lx (%p)\n",
-            raw_cmd.dev + 'a', (CURRENT->cmd == READ) ? "read" : "writ",
+            raw_cmd.dev + 'a', rq_data_dir(CURRENT) == READ ? "read" : "writ",
                       raw_cmd.cylinder,
                       raw_cmd.head,
            raw_cmd.sector, nsect, (unsigned long) Copy_buffer, CURRENT);
@@ -917,13 +917,6 @@ static void mfm_request(void)
 
                DBG("mfm_request: block after offset=%d\n", block);
 
-               if (CURRENT->cmd != READ && CURRENT->cmd != WRITE) {
-                       printk("unknown mfm-command %d\n", CURRENT->cmd);
-                       end_request(CURRENT, 0);
-                       Busy = 0;
-                       printk("mfm: continue 4\n");
-                       continue;
-               }
                issue_request(block, nsect, CURRENT);
 
                break;
index 27a139025cedaf677124a67d21a54447b621f500..6ce8b897e2623f025de20994a8f02a11eee2e8f2 100644 (file)
@@ -1363,7 +1363,7 @@ static void redo_fd_request(void)
 #ifdef DEBUG
                printk("fd: sector %ld + %d requested for %s\n",
                       CURRENT->sector,cnt,
-                      (CURRENT->cmd==READ)?"read":"write");
+                      (rq_data_dir(CURRENT) == READ) ? "read" : "write");
 #endif
                block = CURRENT->sector + cnt;
                if ((int)block > floppy->blocks) {
index 069ae39a9cd9023eb62d9115f2885383c2df86ef..c575fb1d585f1131714a6658cc1b823404140cfd 100644 (file)
@@ -416,7 +416,7 @@ static void nbd_clear_que(struct nbd_device *lo)
 /*
  * We always wait for result of write, for now. It would be nice to make it optional
  * in future
- * if ((req->cmd == WRITE) && (lo->flags & NBD_WRITE_NOCHK)) 
+ * if ((rq_data_dir(req) == WRITE) && (lo->flags & NBD_WRITE_NOCHK))
  *   { printk( "Warning: Ignoring result!\n"); nbd_end_request( req ); }
  */
 
index 1f9fb7a9670314403d6981166f2544e22ceac9a5..d7fbfaae2449e6fe07bea8bdc061d391f62d286a 100644 (file)
@@ -229,7 +229,7 @@ static struct request_queue *azt_queue;
 static int current_valid(void)
 {
         return CURRENT &&
-               CURRENT->cmd == READ &&
+               rq_data_dir(CURRENT) == READ &&
                CURRENT->sector != -1;
 }
 
index 230131163240532cdfa34f3861e74aef87531bdd..2f8fe3b6bbd0504a03b873ddc59cd855c627fe66 100644 (file)
@@ -851,7 +851,7 @@ static void do_cm206_request(request_queue_t * q)
                if (!req)
                        return;
 
-               if (req->cmd != READ) {
+               if (rq_data_dir(req) != READ) {
                        debug(("Non-read command %d on cdrom\n", req->cmd));
                        end_request(req, 0);
                        continue;
index b3ab6e9b8df182ac4017940140edc456cb029a25..176742ed007bca513a7f10a99cb4b092d208db0d 100644 (file)
@@ -264,7 +264,7 @@ repeat:
        if (req->sector == -1)
                goto out;
 
-       if (req->cmd != READ) {
+       if (rq_data_dir(req) != READ) {
                printk("GSCD: bad cmd %u\n", rq_data_dir(req));
                end_request(req, 0);
                goto repeat;
index 4310cc84dfedb4c3b59dc20751e91ed076ace202..972ee9c8247c34d6fdf4ffd5bb9a166ce124cc39 100644 (file)
@@ -596,7 +596,7 @@ static void do_mcdx_request(request_queue_t * q)
        xtrace(REQUEST, "do_request() (%lu + %lu)\n",
               req->sector, req->nr_sectors);
 
-       if (req->cmd != READ) {
+       if (rq_data_dir(req) != READ) {
                xwarn("do_request(): non-read command to cd!!\n");
                xtrace(REQUEST, "end_request(0): write\n");
                end_request(req, 0);
index 3541690a77d443932de3b2123ba677d491f729bb..efd619c0fe10fbfcc65192bb8672e1dfe933a78c 100644 (file)
@@ -977,7 +977,7 @@ static int update_toc(void)
 static int current_valid(void)
 {
         return CURRENT &&
-               CURRENT->cmd == READ &&
+               rq_data_dir(CURRENT) == READ &&
                CURRENT->sector != -1;
 }
 
index 5409fca5bbfcaa5fd346fd32428ae02e089806aa..76c24e679e68f920f58cc41237c724167e919e91 100644 (file)
@@ -1064,7 +1064,7 @@ static void sjcd_invalidate_buffers(void)
 static int current_valid(void)
 {
         return CURRENT &&
-               CURRENT->cmd == READ &&
+               rq_data_dir(CURRENT) == READ &&
                CURRENT->sector != -1;
 }
 
index 661c12f6dda6628f1eac7fd34826bf45c159564d..7f4c0a5050a1393e27e0c2ec3c9e7117d0546935 100644 (file)
@@ -623,7 +623,8 @@ repeat:
        cyl   = track / disk->head;
 #ifdef DEBUG
        printk("%s: %sing: CHS=%d/%d/%d, sectors=%d, buffer=%p\n",
-               req->rq_disk->disk_name, (req->cmd == READ)?"read":"writ",
+               req->rq_disk->disk_name,
+               req_data_dir(req) == READ ? "read" : "writ",
                cyl, head, sec, nsect, req->buffer);
 #endif
        if (blk_fs_request(req)) {