aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/i2o/i2o_scsi.c
diff options
context:
space:
mode:
authorMarkus Lidel <Markus.Lidel@shadowconnect.com>2005-06-24 01:02:14 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:28 -0400
commitf88e119c4b824a5017456fa094950d0f4092d96c (patch)
tree7a0fea02c195732e299a576fd22fd439fbc38bdd /drivers/message/i2o/i2o_scsi.c
parent61fbfa8129c1771061a0e9f47747854293081c5b (diff)
[PATCH] I2O: first code cleanup of spare warnings and unused functions
Changes: - Removed unnecessary checking of NULL before calling kfree() - Make some functions static - Changed pr_debug() into osm_debug() - Use i2o_msg_in_to_virt() for getting a pointer to the message frame - Cleaned up some comments - Changed some le32_to_cpu() into readl() where necessary - Make error messages of OSM's look the same - Cleaned up error handling in i2o_block_end_request() - Removed unused error handling of failed messages in Block-OSM, which are not allowed by the I2O spec - Corrected the blocksize detection in i2o_block - Added hrt and lct sysfs-attribute to controller - Call done() function in SCSI-OSM after freeing DMA buffers - Removed unneeded variable for message size calculation in i2o_scsi_queuecommand() - Make some changes to remove sparse warnings - Reordered some functions - Cleaned up controller initialization - Replaced some magic numbers by defines - Removed unnecessary dma_sync_single_for_cpu() call on coherent DMA - Removed some unused fields in i2o_controller and removed some unused functions Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/message/i2o/i2o_scsi.c')
-rw-r--r--drivers/message/i2o/i2o_scsi.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index af40f1c1ec77..812c29ec86d3 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -40,6 +40,7 @@
40 * Fix the resource management problems. 40 * Fix the resource management problems.
41 */ 41 */
42 42
43#define DEBUG 1
43#include <linux/module.h> 44#include <linux/module.h>
44#include <linux/kernel.h> 45#include <linux/kernel.h>
45#include <linux/types.h> 46#include <linux/types.h>
@@ -179,6 +180,8 @@ static int i2o_scsi_remove(struct device *dev)
179 struct i2o_scsi_host *i2o_shost; 180 struct i2o_scsi_host *i2o_shost;
180 struct scsi_device *scsi_dev; 181 struct scsi_device *scsi_dev;
181 182
183 osm_info("device removed (TID: %03x)\n", i2o_dev->lct_data.tid);
184
182 i2o_shost = i2o_scsi_get_host(c); 185 i2o_shost = i2o_scsi_get_host(c);
183 186
184 shost_for_each_device(scsi_dev, i2o_shost->scsi_host) 187 shost_for_each_device(scsi_dev, i2o_shost->scsi_host)
@@ -262,8 +265,8 @@ static int i2o_scsi_probe(struct device *dev)
262 return -EFAULT; 265 return -EFAULT;
263 } 266 }
264 267
265 osm_debug("added new SCSI device %03x (cannel: %d, id: %d, lun: %d)\n", 268 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %d\n",
266 i2o_dev->lct_data.tid, channel, id, (unsigned int)lun); 269 i2o_dev->lct_data.tid, channel, id, (unsigned int)lun);
267 270
268 return 0; 271 return 0;
269}; 272};
@@ -439,8 +442,6 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
439 442
440 cmd->result = DID_OK << 16 | ds; 443 cmd->result = DID_OK << 16 | ds;
441 444
442 cmd->scsi_done(cmd);
443
444 dev = &c->pdev->dev; 445 dev = &c->pdev->dev;
445 if (cmd->use_sg) 446 if (cmd->use_sg)
446 dma_unmap_sg(dev, (struct scatterlist *)cmd->buffer, 447 dma_unmap_sg(dev, (struct scatterlist *)cmd->buffer,
@@ -449,6 +450,8 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
449 dma_unmap_single(dev, (dma_addr_t) ((long)cmd->SCp.ptr), 450 dma_unmap_single(dev, (dma_addr_t) ((long)cmd->SCp.ptr),
450 cmd->request_bufflen, cmd->sc_data_direction); 451 cmd->request_bufflen, cmd->sc_data_direction);
451 452
453 cmd->scsi_done(cmd);
454
452 return 1; 455 return 1;
453}; 456};
454 457
@@ -502,7 +505,7 @@ static void i2o_scsi_notify_controller_remove(struct i2o_controller *c)
502 505
503 scsi_remove_host(i2o_shost->scsi_host); 506 scsi_remove_host(i2o_shost->scsi_host);
504 scsi_host_put(i2o_shost->scsi_host); 507 scsi_host_put(i2o_shost->scsi_host);
505 pr_info("I2O SCSI host removed\n"); 508 osm_debug("I2O SCSI host removed\n");
506}; 509};
507 510
508/* SCSI OSM driver struct */ 511/* SCSI OSM driver struct */
@@ -545,7 +548,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
545 u32 scsi_flags, sg_flags; 548 u32 scsi_flags, sg_flags;
546 u32 __iomem *mptr; 549 u32 __iomem *mptr;
547 u32 __iomem *lenptr; 550 u32 __iomem *lenptr;
548 u32 len, reqlen; 551 u32 len;
549 int i; 552 int i;
550 553
551 /* 554 /*
@@ -580,12 +583,12 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
580 if (m == I2O_QUEUE_EMPTY) 583 if (m == I2O_QUEUE_EMPTY)
581 return SCSI_MLQUEUE_HOST_BUSY; 584 return SCSI_MLQUEUE_HOST_BUSY;
582 585
586 mptr = &msg->body[0];
587
583 /* 588 /*
584 * Put together a scsi execscb message 589 * Put together a scsi execscb message
585 */ 590 */
586 591
587 len = SCpnt->request_bufflen;
588
589 switch (SCpnt->sc_data_direction) { 592 switch (SCpnt->sc_data_direction) {
590 case PCI_DMA_NONE: 593 case PCI_DMA_NONE:
591 scsi_flags = 0x00000000; // DATA NO XFER 594 scsi_flags = 0x00000000; // DATA NO XFER
@@ -637,17 +640,13 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
637 */ 640 */
638 641
639 /* Direction, disconnect ok, tag, CDBLen */ 642 /* Direction, disconnect ok, tag, CDBLen */
640 writel(scsi_flags | 0x20200000 | SCpnt->cmd_len, &msg->body[0]); 643 writel(scsi_flags | 0x20200000 | SCpnt->cmd_len, mptr ++);
641
642 mptr = &msg->body[1];
643 644
644 /* Write SCSI command into the message - always 16 byte block */ 645 /* Write SCSI command into the message - always 16 byte block */
645 memcpy_toio(mptr, SCpnt->cmnd, 16); 646 memcpy_toio(mptr, SCpnt->cmnd, 16);
646 mptr += 4; 647 mptr += 4;
647 lenptr = mptr++; /* Remember me - fill in when we know */ 648 lenptr = mptr++; /* Remember me - fill in when we know */
648 649
649 reqlen = 12; // SINGLE SGE
650
651 /* Now fill in the SGList and command */ 650 /* Now fill in the SGList and command */
652 if (SCpnt->use_sg) { 651 if (SCpnt->use_sg) {
653 struct scatterlist *sg; 652 struct scatterlist *sg;
@@ -671,7 +670,6 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
671 sg++; 670 sg++;
672 } 671 }
673 672
674 reqlen = mptr - &msg->u.head[0];
675 writel(len, lenptr); 673 writel(len, lenptr);
676 } else { 674 } else {
677 len = SCpnt->request_bufflen; 675 len = SCpnt->request_bufflen;
@@ -691,12 +689,11 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
691 sg_flags |= 0xC0000000; 689 sg_flags |= 0xC0000000;
692 writel(sg_flags | SCpnt->request_bufflen, mptr++); 690 writel(sg_flags | SCpnt->request_bufflen, mptr++);
693 writel(dma_addr, mptr++); 691 writel(dma_addr, mptr++);
694 } else 692 }
695 reqlen = 9;
696 } 693 }
697 694
698 /* Stick the headers on */ 695 /* Stick the headers on */
699 writel(reqlen << 16 | SGL_OFFSET_10, &msg->u.head[0]); 696 writel((mptr - &msg->u.head[0]) << 16 | SGL_OFFSET_10, &msg->u.head[0]);
700 697
701 /* Queue the message */ 698 /* Queue the message */
702 i2o_msg_post(c, m); 699 i2o_msg_post(c, m);