Skip to contentSkip to conversation

consistand names for LDM-related struct members

PATCH New Christoph Hellwig 1 participant 1 message Jun 27, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 consistand names for LDM-related struct members

currently the embedded struct devices and class devices have totally irregular and sometimes confusing (sdev_driverfs_dev) names. Name them consistanly s{dev,host}_{class,gen}dev and move them to the front of the containing structures.

drivers/scsi/hosts.c +4 -4
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
@@ -283,8 +283,8 @@
  **/
 void scsi_host_get(struct Scsi_Host *shost)
 {
-	get_device(&shost->host_gendev);
-	class_device_get(&shost->class_dev);
+	get_device(&shost->shost_gendev);
+	class_device_get(&shost->shost_classdev);
 }
 
 /**
@@ -293,6 +293,6 @@
  **/
 void scsi_host_put(struct Scsi_Host *shost)
 {
-	class_device_put(&shost->class_dev);
-	put_device(&shost->host_gendev);
+	class_device_put(&shost->shost_classdev);
+	put_device(&shost->shost_gendev);
 }
drivers/scsi/scsi_scan.c +1 -2
diff -Nru a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
@@ -464,8 +464,7 @@
 	while (i >= 0 && type[i] == ' ')
 		type[i--] = '\0';
 
-	snprintf(sdev->sdev_driverfs_dev.name, DEVICE_NAME_SIZE, "SCSI %s",
-		 type);
+	snprintf(sdev->sdev_gendev.name, DEVICE_NAME_SIZE, "SCSI %s", type);
 }
 
 /**
drivers/scsi/scsi_sysfs.c +28 -28

122 lines not on this page · raw message

drivers/scsi/sd.c +1 -1
diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
@@ -1318,7 +1318,7 @@
 
 	sd_revalidate_disk(gd);
 
-	gd->driverfs_dev = &sdp->sdev_driverfs_dev;
+	gd->driverfs_dev = &sdp->sdev_gendev;
 	gd->flags = GENHD_FL_DRIVERFS;
 	if (sdp->removable)
 		gd->flags |= GENHD_FL_REMOVABLE;
drivers/scsi/sr.c +1 -1
diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
@@ -533,7 +533,7 @@
 
 	snprintf(disk->devfs_name, sizeof(disk->devfs_name),
 			"%s/cd", sdev->devfs_name);
-	disk->driverfs_dev = &sdev->sdev_driverfs_dev;
+	disk->driverfs_dev = &sdev->sdev_gendev;
 	register_cdrom(&cd->cdi);
 	set_capacity(disk, cd->capacity);
 	disk->private_data = &cd->driver;
include/scsi/scsi_device.h +2 -2
diff -Nru a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
@@ -11,6 +11,7 @@
 
 
 struct scsi_device {
+	struct device		sdev_gendev;
 	struct class_device	sdev_classdev;
 
 	struct list_head    siblings;   /* list of all devices on this host */
@@ -86,10 +87,9 @@
 	unsigned int max_device_blocked; /* what device_blocked counts down from  */
 #define SCSI_DEFAULT_DEVICE_BLOCKED	3
 
-	struct device sdev_driverfs_dev;
 };
 #define	to_scsi_device(d)	\
-	container_of(d, struct scsi_device, sdev_driverfs_dev)
+	container_of(d, struct scsi_device, sdev_gendev)
 
 extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
 		uint, uint, uint);
include/scsi/scsi_host.h +6 -10
diff -Nru a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
@@ -349,6 +349,8 @@
 };
 
 struct Scsi_Host {
+	struct device		shost_gendev;
+	struct class_device	shost_classdev;
 	struct list_head	my_devices;
 	struct scsi_host_cmd_pool *cmd_pool;
 	spinlock_t		free_list_lock;
@@ -442,12 +444,6 @@
 	 */
 	unsigned int max_host_blocked;
 
-	/* 
-	 * Support for sysfs
-	 */
-	struct device host_gendev;
-	struct class_device class_dev;
-
 	/* legacy crap */
 	unsigned long base;
 	unsigned long io_port;
@@ -474,9 +470,9 @@
 		__attribute__ ((aligned (sizeof(unsigned long))));
 };
 #define		dev_to_shost(d)		\
-	container_of(d, struct Scsi_Host, host_gendev)
+	container_of(d, struct Scsi_Host, shost_gendev)
 #define		class_to_shost(d)	\
-	container_of(d, struct Scsi_Host, class_dev)
+	container_of(d, struct Scsi_Host, shost_classdev)
 
 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
 extern int scsi_add_host(struct Scsi_Host *, struct device *);
@@ -495,12 +491,12 @@
 static inline void scsi_set_device(struct Scsi_Host *shost,
                                    struct device *dev)
 {
-        shost->host_gendev.parent = dev;
+        shost->shost_gendev.parent = dev;
 }
 
 static inline struct device *scsi_get_device(struct Scsi_Host *shost)
 {
-        return shost->host_gendev.parent;
+        return shost->shost_gendev.parent;
 }
 
 extern void scsi_sysfs_release_attributes(struct scsi_host_template *);