[PATCH 1/3] scsi: iscsi: let endpoint 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 | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 2e68c0a87698..c18d01e178b2 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -174,11 +174,6 @@ static void iscsi_endpoint_release(struct device *dev)
 	kfree(ep);
 }
 
-static struct class iscsi_endpoint_class = {
-	.name = "iscsi_endpoint",
-	.dev_release = iscsi_endpoint_release,
-};
-
 static ssize_t
 show_ep_handle(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -192,8 +187,12 @@ static struct attribute *iscsi_endpoint_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group iscsi_endpoint_group = {
-	.attrs = iscsi_endpoint_attrs,
+ATTRIBUTE_GROUPS(iscsi_endpoint);
+
+static struct class iscsi_endpoint_class = {
+	.name = "iscsi_endpoint",
+	.dev_groups = iscsi_endpoint_groups,
+	.dev_release = iscsi_endpoint_release,
 };
 
 #define ISCSI_MAX_EPID -1
@@ -239,18 +238,10 @@ iscsi_create_endpoint(int dd_size)
         if (err)
                 goto free_ep;
 
-	err = sysfs_create_group(&ep->dev.kobj, &iscsi_endpoint_group);
-	if (err)
-		goto unregister_dev;
-
 	if (dd_size)
 		ep->dd_data = &ep[1];
 	return ep;
 
-unregister_dev:
-	device_unregister(&ep->dev);
-	return NULL;
-
 free_ep:
 	kfree(ep);
 	return NULL;
@@ -259,7 +250,6 @@ EXPORT_SYMBOL_GPL(iscsi_create_endpoint);
 
 void iscsi_destroy_endpoint(struct iscsi_endpoint *ep)
 {
-	sysfs_remove_group(&ep->dev.kobj, &iscsi_endpoint_group);
 	device_unregister(&ep->dev);
 }
 EXPORT_SYMBOL_GPL(iscsi_destroy_endpoint);
-- 
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