]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/message/i2o/i2o_scsi.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
[linux-2.6-omap-h63xx.git] / drivers / message / i2o / i2o_scsi.c
index c08ddac3717d8fb129da204b8f955fee38ea890d..aa6fb9429d58a06f84621324d682c7b25f9edf36 100644 (file)
@@ -65,9 +65,7 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_request.h>
 #include <scsi/sg.h>
-#include <scsi/sg_request.h>
 
 #define OSM_NAME       "scsi-osm"
 #define OSM_VERSION    "1.316"
@@ -222,7 +220,7 @@ static int i2o_scsi_probe(struct device *dev)
        u32 id = -1;
        u64 lun = -1;
        int channel = -1;
-       int i;
+       int i, rc;
 
        i2o_shost = i2o_scsi_get_host(c);
        if (!i2o_shost)
@@ -306,14 +304,20 @@ static int i2o_scsi_probe(struct device *dev)
                return PTR_ERR(scsi_dev);
        }
 
-       sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj,
-                         "scsi");
+       rc = sysfs_create_link(&i2o_dev->device.kobj,
+                              &scsi_dev->sdev_gendev.kobj, "scsi");
+       if (rc)
+               goto err;
 
        osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n",
                 i2o_dev->lct_data.tid, channel, le32_to_cpu(id),
                 (long unsigned int)le64_to_cpu(lun));
 
        return 0;
+
+err:
+       scsi_remove_device(scsi_dev);
+       return rc;
 };
 
 static const char *i2o_scsi_info(struct Scsi_Host *SChost)
@@ -373,12 +377,8 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
                osm_err("SCSI error %08x\n", error);
 
        dev = &c->pdev->dev;
-       if (cmd->use_sg)
-               dma_unmap_sg(dev, cmd->request_buffer, cmd->use_sg,
-                            cmd->sc_data_direction);
-       else if (cmd->SCp.dma_handle)
-               dma_unmap_single(dev, cmd->SCp.dma_handle, cmd->request_bufflen,
-                                cmd->sc_data_direction);
+
+       scsi_dma_unmap(cmd);
 
        cmd->scsi_done(cmd);
 
@@ -407,8 +407,7 @@ static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev)
 };
 
 /**
- *     i2o_scsi_notify_device_remove - Retrieve notifications of removed
- *                                     devices
+ *     i2o_scsi_notify_device_remove - Retrieve notifications of removed devices
  *     @i2o_dev: the I2O device which was removed
  *
  *     If a I2O device is removed, we catch the notification to remove the
@@ -428,8 +427,7 @@ static void i2o_scsi_notify_device_remove(struct i2o_device *i2o_dev)
 };
 
 /**
- *     i2o_scsi_notify_controller_add - Retrieve notifications of added
- *                                      controllers
+ *     i2o_scsi_notify_controller_add - Retrieve notifications of added controllers
  *     @c: the controller which was added
  *
  *     If a I2O controller is added, we catch the notification to add a
@@ -459,8 +457,7 @@ static void i2o_scsi_notify_controller_add(struct i2o_controller *c)
 };
 
 /**
- *     i2o_scsi_notify_controller_remove - Retrieve notifications of removed
- *                                         controllers
+ *     i2o_scsi_notify_controller_remove - Retrieve notifications of removed controllers
  *     @c: the controller which was removed
  *
  *     If a I2O controller is removed, we catch the notification to remove the
@@ -588,6 +585,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
 
        mptr = &msg->body[0];
 
+#if 0 /* this code can't work */
 #ifdef CONFIG_I2O_EXT_ADAPTEC
        if (c->adaptec) {
                u32 adpt_flags = 0;
@@ -624,6 +622,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
                *mptr++ = cpu_to_le32(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC);
                *mptr++ = cpu_to_le32(adpt_flags | tid);
        }
+#endif
 #endif
 
        msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid);
@@ -661,21 +660,15 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
 
        if (sgl_offset != SGL_OFFSET_0) {
                /* write size of data addressed by SGL */
-               *mptr++ = cpu_to_le32(SCpnt->request_bufflen);
+               *mptr++ = cpu_to_le32(scsi_bufflen(SCpnt));
 
                /* Now fill in the SGList and command */
-               if (SCpnt->use_sg) {
-                       if (!i2o_dma_map_sg(c, SCpnt->request_buffer,
-                                           SCpnt->use_sg,
+
+               if (scsi_sg_count(SCpnt)) {
+                       if (!i2o_dma_map_sg(c, scsi_sglist(SCpnt),
+                                           scsi_sg_count(SCpnt),
                                            SCpnt->sc_data_direction, &mptr))
                                goto nomem;
-               } else {
-                       SCpnt->SCp.dma_handle =
-                           i2o_dma_map_single(c, SCpnt->request_buffer,
-                                              SCpnt->request_bufflen,
-                                              SCpnt->sc_data_direction, &mptr);
-                       if (dma_mapping_error(SCpnt->SCp.dma_handle))
-                               goto nomem;
                }
        }
 
@@ -745,7 +738,7 @@ static int i2o_scsi_abort(struct scsi_cmnd *SCpnt)
  *     @capacity: size in sectors
  *     @ip: geometry array
  *
- *     This is anyones guess quite frankly. We use the same rules everyone
+ *     This is anyone's guess quite frankly. We use the same rules everyone
  *     else appears to and hope. It seems to work.
  */