X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fhosts.c;h=c264a8c5f01e1f362284476f1513a38f38b56ed1;hb=607d1cb1042657177bf72247eeb85c0d8416bd51;hp=880c78bff0e14a35e2ac6d6677b213946eca7ee8;hpb=94ed294c20ef07fffa40817c68155fba35dd67f1;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 880c78bff0e..c264a8c5f01 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -43,14 +43,14 @@ static int scsi_host_next_hn; /* host_no for next new host */ -static void scsi_host_cls_release(struct class_device *class_dev) +static void scsi_host_cls_release(struct device *dev) { - put_device(&class_to_shost(class_dev)->shost_gendev); + put_device(&class_to_shost(dev)->shost_gendev); } static struct class shost_class = { .name = "scsi_host", - .release = scsi_host_cls_release, + .dev_release = scsi_host_cls_release, }; /** @@ -174,7 +174,7 @@ void scsi_remove_host(struct Scsi_Host *shost) spin_unlock_irqrestore(shost->host_lock, flags); transport_unregister_device(&shost->shost_gendev); - class_device_unregister(&shost->shost_classdev); + device_unregister(&shost->shost_dev); device_del(&shost->shost_gendev); scsi_proc_hostdir_rm(shost->hostt); } @@ -212,24 +212,30 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) scsi_host_set_state(shost, SHOST_RUNNING); get_device(shost->shost_gendev.parent); - error = class_device_add(&shost->shost_classdev); + error = device_add(&shost->shost_dev); if (error) goto out_del_gendev; get_device(&shost->shost_gendev); - if (shost->transportt->host_size && - (shost->shost_data = kzalloc(shost->transportt->host_size, - GFP_KERNEL)) == NULL) - goto out_del_classdev; + if (shost->transportt->host_size) { + shost->shost_data = kzalloc(shost->transportt->host_size, + GFP_KERNEL); + if (shost->shost_data == NULL) { + error = -ENOMEM; + goto out_del_dev; + } + } if (shost->transportt->create_work_queue) { snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d", shost->host_no); shost->work_q = create_singlethread_workqueue( shost->work_q_name); - if (!shost->work_q) + if (!shost->work_q) { + error = -EINVAL; goto out_free_shost_data; + } } error = scsi_sysfs_add_host(shost); @@ -244,8 +250,8 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) destroy_workqueue(shost->work_q); out_free_shost_data: kfree(shost->shost_data); - out_del_classdev: - class_device_del(&shost->shost_classdev); + out_del_dev: + device_del(&shost->shost_dev); out_del_gendev: device_del(&shost->shost_gendev); out: @@ -341,7 +347,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; - shost->active_mode = sht->supported_mode; if (sht->supported_mode == MODE_UNKNOWN) /* means we didn't set it ... default to INITIATOR */ @@ -380,11 +385,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->host_no); shost->shost_gendev.release = scsi_host_dev_release; - class_device_initialize(&shost->shost_classdev); - shost->shost_classdev.dev = &shost->shost_gendev; - shost->shost_classdev.class = &shost_class; - snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d", - shost->host_no); + device_initialize(&shost->shost_dev); + shost->shost_dev.parent = &shost->shost_gendev; + shost->shost_dev.class = &shost_class; + snprintf(shost->shost_dev.bus_id, BUS_ID_SIZE, "host%d", + shost->host_no); shost->ehandler = kthread_run(scsi_error_handler, shost, "scsi_eh_%d", shost->host_no); @@ -427,12 +432,12 @@ void scsi_unregister(struct Scsi_Host *shost) } EXPORT_SYMBOL(scsi_unregister); -static int __scsi_host_match(struct class_device *cdev, void *data) +static int __scsi_host_match(struct device *dev, void *data) { struct Scsi_Host *p; unsigned short *hostnum = (unsigned short *)data; - p = class_to_shost(cdev); + p = class_to_shost(dev); return p->host_no == *hostnum; } @@ -445,10 +450,10 @@ static int __scsi_host_match(struct class_device *cdev, void *data) **/ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) { - struct class_device *cdev; + struct device *cdev; struct Scsi_Host *shost = ERR_PTR(-ENXIO); - cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match); + cdev = class_find_device(&shost_class, &hostnum, __scsi_host_match); if (cdev) shost = scsi_host_get(class_to_shost(cdev));