[PATCH 3/3] scsi: iscsi: let iface class declare its sysfs attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Have device_register() create the attributes for us automatically, before
the KOBJ_ADD uevent is raised.

Cc: Lee Duncan <lduncan@xxxxxxxx>
Cc: Chris Leech <cleech@xxxxxxxxxx>
Signed-off-by: Julian Wiedmann <jwi@xxxxxxxxxxxxx>
---
 drivers/scsi/scsi_transport_iscsi.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index e3d57ba7ca19..d467ae3e46ee 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -286,12 +286,6 @@ static void iscsi_iface_release(struct device *dev)
 	put_device(parent);
 }
 
-
-static struct class iscsi_iface_class = {
-	.name = "iscsi_iface",
-	.dev_release = iscsi_iface_release,
-};
-
 #define ISCSI_IFACE_ATTR(_prefix, _name, _mode, _show, _store)	\
 struct device_attribute dev_attr_##_prefix##_##_name =		\
 	__ATTR(_name, _mode, _show, _store)
@@ -689,6 +683,14 @@ static struct attribute_group iscsi_iface_group = {
 	.is_visible = iscsi_iface_attr_is_visible,
 };
 
+__ATTRIBUTE_GROUPS(iscsi_iface);
+
+static struct class iscsi_iface_class = {
+	.name = "iscsi_iface",
+	.dev_groups = iscsi_iface_groups,
+	.dev_release = iscsi_iface_release,
+};
+
 /* convert iscsi_ipaddress_state values to ascii string name */
 static const struct {
 	enum iscsi_ipaddress_state	value;
@@ -773,18 +775,10 @@ iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *transport,
 	if (err)
 		goto free_iface;
 
-	err = sysfs_create_group(&iface->dev.kobj, &iscsi_iface_group);
-	if (err)
-		goto unreg_iface;
-
 	if (dd_size)
 		iface->dd_data = &iface[1];
 	return iface;
 
-unreg_iface:
-	device_unregister(&iface->dev);
-	return NULL;
-
 free_iface:
 	put_device(iface->dev.parent);
 	kfree(iface);
@@ -794,7 +788,6 @@ EXPORT_SYMBOL_GPL(iscsi_create_iface);
 
 void iscsi_destroy_iface(struct iscsi_iface *iface)
 {
-	sysfs_remove_group(&iface->dev.kobj, &iscsi_iface_group);
 	device_unregister(&iface->dev);
 }
 EXPORT_SYMBOL_GPL(iscsi_destroy_iface);
-- 
2.17.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux