All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] scsi: iscsi: let endpoint class declare its sysfs attributes
@ 2021-01-07 16:02 Julian Wiedmann
  2021-01-07 16:02 ` [PATCH 2/3] scsi: iscsi: let transport " Julian Wiedmann
  2021-01-07 16:02 ` [PATCH 3/3] scsi: iscsi: let iface " Julian Wiedmann
  0 siblings, 2 replies; 3+ messages in thread
From: Julian Wiedmann @ 2021-01-07 16:02 UTC (permalink / raw)
  To: Martin K. Petersen, James E.J. Bottomley
  Cc: linux-scsi, Julian Wiedmann, Lee Duncan, Chris Leech

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

Cc: Lee Duncan <lduncan@suse.com>
Cc: Chris Leech <cleech@redhat.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-07 16:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-07 16:02 [PATCH 1/3] scsi: iscsi: let endpoint class declare its sysfs attributes Julian Wiedmann
2021-01-07 16:02 ` [PATCH 2/3] scsi: iscsi: let transport " Julian Wiedmann
2021-01-07 16:02 ` [PATCH 3/3] scsi: iscsi: let iface " Julian Wiedmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.