[SCSI] add scsi_host and scsi_target to scsi_bus
This patch implements scsi_host and scsi_target device types and adds both to the scsi_bus. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:

committed by
James Bottomley

parent
cb6b7f4063
commit
b0ed43360f
@@ -284,6 +284,11 @@ static void scsi_host_dev_release(struct device *dev)
|
||||
kfree(shost);
|
||||
}
|
||||
|
||||
struct device_type scsi_host_type = {
|
||||
.name = "scsi_host",
|
||||
.release = scsi_host_dev_release,
|
||||
};
|
||||
|
||||
/**
|
||||
* scsi_host_alloc - register a scsi host adapter instance.
|
||||
* @sht: pointer to scsi host template
|
||||
@@ -383,7 +388,10 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
|
||||
device_initialize(&shost->shost_gendev);
|
||||
snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",
|
||||
shost->host_no);
|
||||
shost->shost_gendev.release = scsi_host_dev_release;
|
||||
#ifndef CONFIG_SYSFS_DEPRECATED
|
||||
shost->shost_gendev.bus = &scsi_bus_type;
|
||||
#endif
|
||||
shost->shost_gendev.type = &scsi_host_type;
|
||||
|
||||
device_initialize(&shost->shost_dev);
|
||||
shost->shost_dev.parent = &shost->shost_gendev;
|
||||
@@ -496,7 +504,7 @@ void scsi_exit_hosts(void)
|
||||
|
||||
int scsi_is_host_device(const struct device *dev)
|
||||
{
|
||||
return dev->release == scsi_host_dev_release;
|
||||
return dev->type == &scsi_host_type;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_is_host_device);
|
||||
|
||||
|
Reference in New Issue
Block a user