All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 2/3] add fc transport events
@ 2004-05-27  7:26 Mike Christie
  0 siblings, 0 replies; only message in thread
From: Mike Christie @ 2004-05-27  7:26 UTC (permalink / raw)
  To: SCSI Mailing List

[-- 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-27  7:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-27  7:26 [PATCH RFC 2/3] add fc transport events Mike Christie

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.