VMware Balloon driver
[safe/jmp/linux-2.6] / drivers / scsi / ps3rom.c
index d1e7845..92ffbb5 100644 (file)
 
 #include <linux/cdrom.h>
 #include <linux/highmem.h>
+#include <linux/slab.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_eh.h>
 
 #include <asm/lv1call.h>
 #include <asm/ps3stor.h>
@@ -289,16 +291,16 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data)
 
        if (tag != dev->tag)
                dev_err(&dev->sbd.core,
-                       "%s:%u: tag mismatch, got %lx, expected %lx\n",
+                       "%s:%u: tag mismatch, got %llx, expected %llx\n",
                        __func__, __LINE__, tag, dev->tag);
 
        if (res) {
-               dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n",
+               dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
                        __func__, __LINE__, res, status);
                return IRQ_HANDLED;
        }
 
-       host = dev->sbd.core.driver_data;
+       host = ps3_system_bus_get_drvdata(&dev->sbd);
        priv = shost_priv(host);
        cmd = priv->curr_cmd;
 
@@ -330,11 +332,7 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data)
                goto done;
        }
 
-       cmd->sense_buffer[0]  = 0x70;
-       cmd->sense_buffer[2]  = sense_key;
-       cmd->sense_buffer[7]  = 16 - 6;
-       cmd->sense_buffer[12] = asc;
-       cmd->sense_buffer[13] = ascq;
+       scsi_build_sense_buffer(0, cmd->sense_buffer, sense_key, asc, ascq);
        cmd->result = SAM_STAT_CHECK_CONDITION;
 
 done:
@@ -367,7 +365,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev)
 
        if (dev->blk_size != CD_FRAMESIZE) {
                dev_err(&dev->sbd.core,
-                       "%s:%u: cannot handle block size %lu\n", __func__,
+                       "%s:%u: cannot handle block size %llu\n", __func__,
                        __LINE__, dev->blk_size);
                return -EINVAL;
        }
@@ -390,7 +388,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev)
        }
 
        priv = shost_priv(host);
-       dev->sbd.core.driver_data = host;
+       ps3_system_bus_set_drvdata(&dev->sbd, host);
        priv->dev = dev;
 
        /* One device/LUN per SCSI bus */
@@ -410,7 +408,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev)
 
 fail_host_put:
        scsi_host_put(host);
-       dev->sbd.core.driver_data = NULL;
+       ps3_system_bus_set_drvdata(&dev->sbd, NULL);
 fail_teardown:
        ps3stor_teardown(dev);
 fail_free_bounce:
@@ -421,12 +419,12 @@ fail_free_bounce:
 static int ps3rom_remove(struct ps3_system_bus_device *_dev)
 {
        struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
-       struct Scsi_Host *host = dev->sbd.core.driver_data;
+       struct Scsi_Host *host = ps3_system_bus_get_drvdata(&dev->sbd);
 
        scsi_remove_host(host);
        ps3stor_teardown(dev);
        scsi_host_put(host);
-       dev->sbd.core.driver_data = NULL;
+       ps3_system_bus_set_drvdata(&dev->sbd, NULL);
        kfree(dev->bounce_buf);
        return 0;
 }