]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/hosts.c
slabinfo: fall back from /sys/kernel/slab to /sys/slab
[linux-2.6-omap-h63xx.git] / drivers / scsi / hosts.c
index f5d3fbb55717f61bc41b86bdc7a74dae38bf7193..880c78bff0e14a35e2ac6d6677b213946eca7ee8 100644 (file)
@@ -268,7 +268,6 @@ static void scsi_host_dev_release(struct device *dev)
        }
 
        scsi_destroy_command_freelist(shost);
-       scsi_destroy_command_sense_buffer(shost);
        if (shost->bqt)
                blk_free_tags(shost->bqt);
 
@@ -343,7 +342,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
        shost->use_clustering = sht->use_clustering;
        shost->ordered_tag = sht->ordered_tag;
        shost->active_mode = sht->supported_mode;
-       shost->use_sg_chaining = sht->use_sg_chaining;
 
        if (sht->supported_mode == MODE_UNKNOWN)
                /* means we didn't set it ... default to INITIATOR */
@@ -373,13 +371,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
        else
                shost->dma_boundary = 0xffffffff;
 
-       rval = scsi_setup_command_sense_buffer(shost);
-       if (rval)
-               goto fail_kfree;
-
        rval = scsi_setup_command_freelist(shost);
        if (rval)
-               goto fail_destroy_sense;
+               goto fail_kfree;
 
        device_initialize(&shost->shost_gendev);
        snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",
@@ -404,8 +398,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 
  fail_destroy_freelist:
        scsi_destroy_command_freelist(shost);
- fail_destroy_sense:
-       scsi_destroy_command_sense_buffer(shost);
  fail_kfree:
        kfree(shost);
        return NULL;
@@ -435,6 +427,15 @@ void scsi_unregister(struct Scsi_Host *shost)
 }
 EXPORT_SYMBOL(scsi_unregister);
 
+static int __scsi_host_match(struct class_device *cdev, void *data)
+{
+       struct Scsi_Host *p;
+       unsigned short *hostnum = (unsigned short *)data;
+
+       p = class_to_shost(cdev);
+       return p->host_no == *hostnum;
+}
+
 /**
  * scsi_host_lookup - get a reference to a Scsi_Host by host no
  * @hostnum:   host number to locate
@@ -444,19 +445,12 @@ EXPORT_SYMBOL(scsi_unregister);
  **/
 struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
 {
-       struct class *class = &shost_class;
        struct class_device *cdev;
-       struct Scsi_Host *shost = ERR_PTR(-ENXIO), *p;
+       struct Scsi_Host *shost = ERR_PTR(-ENXIO);
 
-       down(&class->sem);
-       list_for_each_entry(cdev, &class->children, node) {
-               p = class_to_shost(cdev);
-               if (p->host_no == hostnum) {
-                       shost = scsi_host_get(p);
-                       break;
-               }
-       }
-       up(&class->sem);
+       cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match);
+       if (cdev)
+               shost = scsi_host_get(class_to_shost(cdev));
 
        return shost;
 }