X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fscsi%2Fppa.c;h=f655ae320b483cfc418a30691b601f23a271b328;hb=b312bf359e20cc39c00d480fd40a24c245d80bf7;hp=584ba4d6e0389d277c10422bcfb3d3183ff695e2;hpb=463e7c7cf9aaf95dd05e97e1a47854fdf5454cdc;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 584ba4d6e03..f655ae320b4 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -129,11 +129,11 @@ static inline int ppa_proc_write(ppa_struct *dev, char *buffer, int length) if ((length > 10) && (strncmp(buffer, "recon_tmo=", 10) == 0)) { x = simple_strtoul(buffer + 10, NULL, 0); dev->recon_tmo = x; - printk("ppa: recon_tmo set to %ld\n", x); + printk(KERN_INFO "ppa: recon_tmo set to %ld\n", x); return length; } - printk("ppa /proc: invalid variable\n"); - return (-EINVAL); + printk(KERN_WARNING "ppa /proc: invalid variable\n"); + return -EINVAL; } static int ppa_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) @@ -216,7 +216,7 @@ static unsigned char ppa_wait(ppa_struct *dev) /* Counter expired - Time out occurred */ ppa_fail(dev, DID_TIME_OUT); - printk("ppa timeout in ppa_wait\n"); + printk(KERN_WARNING "ppa timeout in ppa_wait\n"); return 0; /* command timed out */ } @@ -248,7 +248,7 @@ static inline void ecp_sync(ppa_struct *dev) return; udelay(5); } - printk("ppa: ECP sync failed as data still present in FIFO.\n"); + printk(KERN_WARNING "ppa: ECP sync failed as data still present in FIFO.\n"); } } @@ -328,7 +328,7 @@ static int ppa_out(ppa_struct *dev, char *buffer, int len) break; default: - printk("PPA: bug in ppa_out()\n"); + printk(KERN_ERR "PPA: bug in ppa_out()\n"); r = 0; } return r; @@ -381,7 +381,7 @@ static int ppa_in(ppa_struct *dev, char *buffer, int len) break; default: - printk("PPA: bug in ppa_ins()\n"); + printk(KERN_ERR "PPA: bug in ppa_ins()\n"); r = 0; break; } @@ -608,9 +608,7 @@ static int ppa_completion(struct scsi_cmnd *cmd) cmd->SCp.buffer++; cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr = - page_address(cmd->SCp.buffer->page) + - cmd->SCp.buffer->offset; + cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); } } /* Now check to see if the drive is ready to comunicate */ @@ -633,7 +631,7 @@ static void ppa_interrupt(struct work_struct *work) struct scsi_cmnd *cmd = dev->cur_cmd; if (!cmd) { - printk("PPA: bug in ppa_interrupt\n"); + printk(KERN_ERR "PPA: bug in ppa_interrupt\n"); return; } if (ppa_engine(dev, cmd)) { @@ -646,31 +644,31 @@ static void ppa_interrupt(struct work_struct *work) case DID_OK: break; case DID_NO_CONNECT: - printk("ppa: no device at SCSI ID %i\n", cmd->device->target); + printk(KERN_DEBUG "ppa: no device at SCSI ID %i\n", cmd->device->target); break; case DID_BUS_BUSY: - printk("ppa: BUS BUSY - EPP timeout detected\n"); + printk(KERN_DEBUG "ppa: BUS BUSY - EPP timeout detected\n"); break; case DID_TIME_OUT: - printk("ppa: unknown timeout\n"); + printk(KERN_DEBUG "ppa: unknown timeout\n"); break; case DID_ABORT: - printk("ppa: told to abort\n"); + printk(KERN_DEBUG "ppa: told to abort\n"); break; case DID_PARITY: - printk("ppa: parity error (???)\n"); + printk(KERN_DEBUG "ppa: parity error (???)\n"); break; case DID_ERROR: - printk("ppa: internal driver error\n"); + printk(KERN_DEBUG "ppa: internal driver error\n"); break; case DID_RESET: - printk("ppa: told to reset device\n"); + printk(KERN_DEBUG "ppa: told to reset device\n"); break; case DID_BAD_INTR: - printk("ppa: bad interrupt (???)\n"); + printk(KERN_WARNING "ppa: bad interrupt (???)\n"); break; default: - printk("ppa: bad return code (%02x)\n", + printk(KERN_WARNING "ppa: bad return code (%02x)\n", (cmd->result >> 16) & 0xff); } #endif @@ -724,8 +722,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) if (retv) { if (time_after(jiffies, dev->jstart + (1 * HZ))) { - printk - ("ppa: Parallel port cable is unplugged!!\n"); + printk(KERN_ERR "ppa: Parallel port cable is unplugged.\n"); ppa_fail(dev, DID_BUS_BUSY); return 0; } else { @@ -753,21 +750,16 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) cmd->SCp.phase++; 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; + if (scsi_bufflen(cmd)) { + cmd->SCp.buffer = scsi_sglist(cmd); cmd->SCp.this_residual = cmd->SCp.buffer->length; - cmd->SCp.ptr = - page_address(cmd->SCp.buffer->page) + - cmd->SCp.buffer->offset; + cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); } 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.this_residual = 0; + cmd->SCp.ptr = NULL; } - cmd->SCp.buffers_residual = cmd->use_sg - 1; + cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; cmd->SCp.phase++; case 5: /* Phase 5 - Data transfer stage */ @@ -800,7 +792,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) break; default: - printk("ppa: Invalid scsi phase\n"); + printk(KERN_ERR "ppa: Invalid scsi phase\n"); } return 0; } @@ -811,7 +803,7 @@ static int ppa_queuecommand(struct scsi_cmnd *cmd, ppa_struct *dev = ppa_dev(cmd->device->host); if (dev->cur_cmd) { - printk("PPA: bug in ppa_queuecommand\n"); + printk(KERN_ERR "PPA: bug in ppa_queuecommand\n"); return 0; } dev->failed = 0; @@ -899,7 +891,7 @@ static int device_check(ppa_struct *dev) /* This routine looks for a device and then attempts to use EPP to send a command. If all goes as planned then EPP is available. */ - static char cmd[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + static u8 cmd[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; int loop, old_mode, status, k, ppb = dev->base; unsigned char l; @@ -909,14 +901,14 @@ static int device_check(ppa_struct *dev) if ((ppb & 0x0007) == 0x0000) dev->mode = PPA_EPP_32; - second_pass: +second_pass: ppa_connect(dev, CONNECT_EPP_MAYBE); /* Select SCSI device */ if (!ppa_select(dev, loop)) { ppa_disconnect(dev); continue; } - printk("ppa: Found device at ID %i, Attempting to use %s\n", + printk(KERN_INFO "ppa: Found device at ID %i, Attempting to use %s\n", loop, PPA_MODE_STRING[dev->mode]); /* Send SCSI command */ @@ -965,7 +957,7 @@ static int device_check(ppa_struct *dev) return -EIO; } ppa_disconnect(dev); - printk("ppa: Communication established with ID %i using %s\n", + printk(KERN_INFO "ppa: Communication established with ID %i using %s\n", loop, PPA_MODE_STRING[dev->mode]); ppa_connect(dev, CONNECT_EPP_MAYBE); ppa_reset_pulse(ppb); @@ -1017,10 +1009,9 @@ static int __ppa_attach(struct parport *pb) int modes, ppb, ppb_hi; int err = -ENOMEM; - dev = kmalloc(sizeof(ppa_struct), GFP_KERNEL); + dev = kzalloc(sizeof(ppa_struct), GFP_KERNEL); if (!dev) return -ENOMEM; - memset(dev, 0, sizeof(ppa_struct)); dev->base = -1; dev->mode = PPA_AUTODETECT; dev->recon_tmo = PPA_RECON_TMO; @@ -1140,7 +1131,7 @@ static struct parport_driver ppa_driver = { static int __init ppa_driver_init(void) { - printk("ppa: Version %s\n", PPA_VERSION); + printk(KERN_INFO "ppa: Version %s\n", PPA_VERSION); return parport_register_driver(&ppa_driver); }