All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Wiedmann <jwi@linux.ibm.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	Julian Wiedmann <jwi@linux.ibm.com>,
	Lee Duncan <lduncan@suse.com>, Chris Leech <cleech@redhat.com>
Subject: [PATCH 1/3] scsi: iscsi: let endpoint class declare its sysfs attributes
Date: Thu,  7 Jan 2021 17:02:29 +0100	[thread overview]
Message-ID: <20210107160231.101243-1-jwi@linux.ibm.com> (raw)

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


             reply	other threads:[~2021-01-07 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 16:02 Julian Wiedmann [this message]
2021-01-07 16:02 ` [PATCH 2/3] scsi: iscsi: let transport class declare its sysfs attributes Julian Wiedmann
2021-01-07 16:02 ` [PATCH 3/3] scsi: iscsi: let iface " Julian Wiedmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210107160231.101243-1-jwi@linux.ibm.com \
    --to=jwi@linux.ibm.com \
    --cc=cleech@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=lduncan@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.