Re: linux 2.5 and ppa.c [PATCH]

From: derek@signalmarketing.com
Date: Wed Jan 16 2002 - 12:03:15 EST


Here's my attempt at updating the ppa.c driver for linux 2.5.x

(also, at the end of the patch are a couple of changes that are either bug
fixes, or newly introduced bugs. :)

--- ppa.c.orig Tue Dec 11 14:38:07 2001
+++ ppa.c Tue Dec 11 22:50:00 2001
@@ -119,7 +119,6 @@
      * unlock to allow the lowlevel parport driver to probe
      * the irqs
      */
- spin_unlock_irq(&io_request_lock);
     pb = parport_enumerate();

     printk("ppa: Version %s\n", PPA_VERSION);
@@ -128,7 +127,6 @@

     if (!pb) {
         printk("ppa: parport reports no devices.\n");
- spin_lock_irq(&io_request_lock);
         return 0;
     }
   retry_entry:
@@ -154,7 +152,6 @@
                       "pardevice is owning the port for too longtime!\n",
                            i);
                     parport_unregister_device(ppa_hosts[i].dev);
- spin_lock_irq(&io_request_lock);
                     return 0;
                 }
             }
@@ -223,13 +220,11 @@
             printk(" supported by the imm (ZIP Plus) driver. If the\n");
             printk(" cable is marked with \"AutoDetect\", this is what has\n");
             printk(" happened.\n");
- spin_lock_irq(&io_request_lock);
             return 0;
         }
         try_again = 1;
         goto retry_entry;
     } else {
- spin_lock_irq(&io_request_lock);
         return 1; /* return number of hosts detected */
     }
 }
@@ -740,7 +735,7 @@
             if (cmd->SCp.buffers_residual--) {
                 cmd->SCp.buffer++;
                 cmd->SCp.this_residual = cmd->SCp.buffer->length;
- cmd->SCp.ptr = cmd->SCp.buffer->address;
+ cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset;
             }
         }
         /* Now check to see if the drive is ready to comunicate */
@@ -794,6 +789,7 @@
 {
     ppa_struct *tmp = (ppa_struct *) data;
     Scsi_Cmnd *cmd = tmp->cur_cmd;
+ struct Scsi_Host *host = cmd->host;
     unsigned long flags;

     if (!cmd) {
@@ -845,11 +841,10 @@
     if (cmd->SCp.phase > 0)
         ppa_pb_release(cmd->host->unique_id);

+ spin_lock_irqsave(&host->host_lock, flags);
     tmp->cur_cmd = 0;
-
- spin_lock_irqsave(&io_request_lock, flags);
     cmd->scsi_done(cmd);
- spin_unlock_irqrestore(&io_request_lock, flags);
+ spin_unlock_irqrestore(&host->host_lock, flags);
     return;
 }

@@ -923,16 +918,16 @@
     case 4: /* Phase 4 - Setup scatter/gather buffers */
         if (cmd->use_sg) {
             /* if many buffers are available, start filling the first */
- cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer;
+ cmd->SCp.buffer = (struct scatterlist *) cmd->buffer;
             cmd->SCp.this_residual = cmd->SCp.buffer->length;
- cmd->SCp.ptr = cmd->SCp.buffer->address;
+ cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset;
         } else {
             /* else fill the only available buffer */
             cmd->SCp.buffer = NULL;
             cmd->SCp.this_residual = cmd->request_bufflen;
             cmd->SCp.ptr = cmd->request_buffer;
         }
- cmd->SCp.buffers_residual = cmd->use_sg;
+ cmd->SCp.buffers_residual = cmd->use_sg - 1;
         cmd->SCp.phase++;

     case 5: /* Phase 5 - Data transfer stage */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 23 2002 - 21:00:16 EST