提交 86b87cde 编写于 作者: S Stanislav Nijnikov 提交者: Martin K. Petersen

scsi: core: host template attribute groups

The patch introduces an additional field in the scsi_host_template
structure - struct attribute_group **sdev_group.  This field allows to
define groups of attributes. It will provide an ability to use binary
attributes as well as device attributes and to group them under
subfolders if necessary.
Signed-off-by: NStanislav Nijnikov <stanislav.nijnikov@wdc.com>
Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 2238d31c
...@@ -1310,6 +1310,13 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) ...@@ -1310,6 +1310,13 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
} }
} }
if (sdev->host->hostt->sdev_groups) {
error = sysfs_create_groups(&sdev->sdev_gendev.kobj,
sdev->host->hostt->sdev_groups);
if (error)
return error;
}
scsi_autopm_put_device(sdev); scsi_autopm_put_device(sdev);
return error; return error;
} }
...@@ -1349,6 +1356,10 @@ void __scsi_remove_device(struct scsi_device *sdev) ...@@ -1349,6 +1356,10 @@ void __scsi_remove_device(struct scsi_device *sdev)
if (res != 0) if (res != 0)
return; return;
if (sdev->host->hostt->sdev_groups)
sysfs_remove_groups(&sdev->sdev_gendev.kobj,
sdev->host->hostt->sdev_groups);
bsg_unregister_queue(sdev->request_queue); bsg_unregister_queue(sdev->request_queue);
device_unregister(&sdev->sdev_dev); device_unregister(&sdev->sdev_dev);
transport_remove_device(dev); transport_remove_device(dev);
......
...@@ -476,6 +476,12 @@ struct scsi_host_template { ...@@ -476,6 +476,12 @@ struct scsi_host_template {
*/ */
struct device_attribute **sdev_attrs; struct device_attribute **sdev_attrs;
/*
* Pointer to the SCSI device attribute groups for this host,
* NULL terminated.
*/
const struct attribute_group **sdev_groups;
/* /*
* List of hosts per template. * List of hosts per template.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册