scsi host sysfs support [4/4]
RFC 1/1 scsi host sysfs support [4/4]
-andmike
--
Michael Anderson
[email protected]
DESC
Create a scsi_host subsystem under the scsi subsystem. Modified scsi remove host cleanup.
EDESC
drivers/scsi/hosts.c | 24 +---- drivers/scsi/hosts.h | 11 +- drivers/scsi/scsi_scan.c | 4 drivers/scsi/scsi_sysfs.c | 200 +++++++++++++++++++++++++++++++++------------- 4 files changed, 160 insertions(+), 79 deletions(-)
drivers/scsi/hosts.c renamed from drivers/scsi/hosts.c~sysfs-scsi-hosts +5 -19
@@ -191,16 +191,6 @@ static int scsi_host_legacy_release(strureturn 0 ; } -static int scsi_remove_legacy_host (struct Scsi_Host *shost) -{ -int error; - - error =scsi_remove_host (shost); -if (!error) - (*shost->hostt->release)(shost); -return 0 ; -} -static int scsi_check_device_busy (struct scsi_device *sdev) {struct Scsi_Host *shost = sdev->host;
@@ -266,11 +256,8 @@ int scsi_remove_host(struct Scsi_Host *slist_for_each_entry (sdev, &shost->my_devices, siblings) sdev->online = FALSE; -list_for_each_entry (sdev, &shost->my_devices, siblings) -if (scsi_check_device_busy (sdev)) -return 1 ; -scsi_forget_host (shost); +scsi_sysfs_remove_host (shost);return 0 ; }
@@ -291,10 +278,9 @@ int scsi_add_host(struct Scsi_Host *shosprintk (KERN_INFO "scsi%d : %s\n" , shost->host_no, sht->info ? sht->info (shost) : sht->name); -if (dev) { - dev->class_data = shost; - shost->host_gendev = dev; - } + error =scsi_sysfs_add_host (shost, dev); +if (error) +return error;scsi_scan_host (shost);
@@ -523,7 +509,7 @@ out_of_space:**/ int scsi_unregister_host (Scsi_Host_Template *shost_tp) { -scsi_tp_for_each_host (shost_tp, scsi_remove_legacy_host); +scsi_tp_for_each_host (shost_tp, scsi_remove_host);return 0 ; }
drivers/scsi/hosts.h renamed from drivers/scsi/hosts.h~sysfs-scsi-hosts +8 -3
@@ -487,9 +487,10 @@ struct Scsi_Hostunsigned int max_host_blocked;/* -* Support for driverfs filesystem +* Support for sysfs */ struct device *host_gendev; +struct kobject kobj;/* * We should ensure that this is aligned, both for better performance
@@ -500,8 +501,9 @@ struct Scsi_Host __attribute__ ((aligned (sizeof(unsigned long)))); }; -#define to_scsi_host (d) d->class_data - +#define to_scsi_host (d) \ + container_of(d, struct Scsi_Host, kobj) +/* * These two functions are used to allocate and free a pseudo device * which will connect to the host adapter itself rather than any
@@ -537,6 +539,7 @@ static inline struct device *scsi_get_de*/ extern void scsi_scan_host (struct Scsi_Host *);extern void scsi_forget_host (struct Scsi_Host *); +extern void scsi_free_sdev (struct scsi_device *);struct Scsi_Device_Template
@@ -611,6 +614,8 @@ static inline Scsi_Device *scsi_find_dev*/ extern int scsi_upper_driver_register (struct Scsi_Device_Template *);extern void scsi_upper_driver_unregister (struct Scsi_Device_Template *); +extern int scsi_sysfs_add_host (struct Scsi_Host *,struct device *); +extern void scsi_sysfs_remove_host (struct Scsi_Host *);#endif
drivers/scsi/scsi_sysfs.c renamed from drivers/scsi/scsi_sysfs.c~sysfs-scsi-hosts +146 -54
252 lines not on this page · raw message
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c~sysfs-scsi-hosts +1 -3
@@ -489,7 +489,7 @@ out:* Undo the actions in scsi_alloc_sdev, including removing @sdev from * the list, and freeing @sdev. **/ -static void scsi_free_sdev (struct scsi_device *sdev) +void scsi_free_sdev (struct scsi_device *sdev) {list_del (&sdev->siblings);list_del (&sdev->same_target_siblings);
@@ -1706,8 +1706,6 @@ int scsi_remove_device(struct scsi_devicdevfs_unregister (sdev->de);scsi_device_unregister (sdev); - -scsi_free_sdev (sdev);return 0 ; }
_
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel