All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH RFC 2/3] add fc transport events
Date: Thu, 27 May 2004 00:26:02 -0700	[thread overview]
Message-ID: <40B5980A.7060800@cs.wisc.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]


02-sdev-transport-kobj.patch - converts the transport class_device in the
scsi_device to a kobject.

  drivers/scsi/scsi_scan.c   |    7 +++----
  drivers/scsi/scsi_sysfs.c  |   22 +++++-----------------
  include/scsi/scsi_device.h |    6 +++---
  3 files changed, 11 insertions(+), 24 deletions(-)

[-- Attachment #2: 02-sdev-transport-kobj.patch --]
[-- Type: text/plain, Size: 3727 bytes --]

diff -aurp linux-2.6.7-rc1/drivers/scsi/scsi_scan.c linux-2.6.7-rc1-hotplug/drivers/scsi/scsi_scan.c
--- linux-2.6.7-rc1/drivers/scsi/scsi_scan.c	2004-05-26 22:47:18.000000000 -0700
+++ linux-2.6.7-rc1-hotplug/drivers/scsi/scsi_scan.c	2004-05-26 23:26:54.277965439 -0700
@@ -259,10 +259,9 @@ static struct scsi_device *scsi_alloc_sd
 			 "%d:%d:%d:%d", sdev->host->host_no,
 			 sdev->channel, sdev->id, sdev->lun);
 
-		class_device_initialize(&sdev->transport_classdev);
-		sdev->transport_classdev.dev = &sdev->sdev_gendev;
-		sdev->transport_classdev.class = sdev->host->transportt->class;
-		snprintf(sdev->transport_classdev.class_id, BUS_ID_SIZE,
+		kobject_init(&sdev->transport_kobj);
+		sdev->transport_kobj.parent = &sdev->host->transport_classdev.kobj;
+		snprintf(sdev->transport_kobj.name, KOBJ_NAME_LEN,
 			 "%d:%d:%d:%d", sdev->host->host_no,
 			 sdev->channel, sdev->id, sdev->lun);
 	} else
diff -aurp linux-2.6.7-rc1/drivers/scsi/scsi_sysfs.c linux-2.6.7-rc1-hotplug/drivers/scsi/scsi_sysfs.c
--- linux-2.6.7-rc1/drivers/scsi/scsi_sysfs.c	2004-05-26 22:47:18.000000000 -0700
+++ linux-2.6.7-rc1-hotplug/drivers/scsi/scsi_sysfs.c	2004-05-26 23:27:02.842773380 -0700
@@ -438,7 +438,6 @@ static int attr_add(struct device *dev, 
  **/
 int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 {
-	struct class_device_attribute **attrs;
 	int error, i;
 
 	if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
@@ -459,8 +458,9 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 	 * released by the sdev_class .release */
 	get_device(&sdev->sdev_gendev);
 
-	if (sdev->transport_classdev.class) {
-		error = class_device_add(&sdev->transport_classdev);
+	if (sdev->host->transportt->class) {
+		sdev->transport_kobj.ktype = sdev->host->transportt->sdev_attrs;
+		error = kobject_add(&sdev->transport_kobj);
 		if (error)
 			goto clean_device2;
 		/* take a reference for the transport_classdev; this
@@ -492,18 +492,6 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 		}
 	}
 
- 	if (sdev->transport_classdev.class) {
- 		attrs = sdev->host->transportt->attrs;
- 		for (i = 0; attrs[i]; i++) {
- 			error = class_device_create_file(&sdev->transport_classdev,
- 							 attrs[i]);
- 			if (error) {
- 				scsi_remove_device(sdev);
-				goto out;
-			}
- 		}
- 	}
-
  out:
 	return error;
 
@@ -528,8 +516,8 @@ void scsi_remove_device(struct scsi_devi
 		return;
 
 	class_device_unregister(&sdev->sdev_classdev);
-	if (sdev->transport_classdev.class)
-		class_device_unregister(&sdev->transport_classdev);
+	if (sdev->host->transportt->class)
+		kobject_unregister(&sdev->transport_kobj);
 	device_del(&sdev->sdev_gendev);
 	scsi_device_set_state(sdev, SDEV_DEL);
 	if (sdev->host->hostt->slave_destroy)
diff -aurp linux-2.6.7-rc1/include/scsi/scsi_device.h linux-2.6.7-rc1-hotplug/include/scsi/scsi_device.h
--- linux-2.6.7-rc1/include/scsi/scsi_device.h	2004-05-26 22:47:18.000000000 -0700
+++ linux-2.6.7-rc1-hotplug/include/scsi/scsi_device.h	2004-05-26 23:26:32.000000000 -0700
@@ -117,7 +117,7 @@ struct scsi_device {
 	struct device		sdev_gendev;
 	struct class_device	sdev_classdev;
 
-	struct class_device	transport_classdev;
+	struct kobject		transport_kobj;
 
 	enum scsi_device_state sdev_state;
 	unsigned long		transport_data[0];
@@ -126,8 +126,8 @@ struct scsi_device {
 	container_of(d, struct scsi_device, sdev_gendev)
 #define	class_to_sdev(d)	\
 	container_of(d, struct scsi_device, sdev_classdev)
-#define transport_class_to_sdev(class_dev) \
-	container_of(class_dev, struct scsi_device, transport_classdev)
+#define transport_class_to_sdev(_kobj) \
+	container_of(_kobj, struct scsi_device, transport_kobj)
 
 extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
 		uint, uint, uint);

                 reply	other threads:[~2004-05-27  7:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40B5980A.7060800@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=linux-scsi@vger.kernel.org \
    /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.