SCSI: convert struct class_device to struct device

It's big, but there doesn't seem to be a way to split it up smaller...

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 574b201..794ad74 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -1,5 +1,5 @@
 /*
- * class_container.h - a generic container for all classes
+ * attribute_container.h - a generic container for all classes
  *
  * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
  *
@@ -18,7 +18,7 @@
 	struct klist		containers;
 	struct class		*class;
 	struct attribute_group	*grp;
-	struct class_device_attribute **attrs;
+	struct device_attribute **attrs;
 	int (*match)(struct attribute_container *, struct device *);
 #define	ATTRIBUTE_CONTAINER_NO_CLASSDEVS	0x01
 	unsigned long		flags;
@@ -41,31 +41,31 @@
 void attribute_container_create_device(struct device *dev,
 				       int (*fn)(struct attribute_container *,
 						 struct device *,
-						 struct class_device *));
+						 struct device *));
 void attribute_container_add_device(struct device *dev,
 				    int (*fn)(struct attribute_container *,
 					      struct device *,
-					      struct class_device *));
+					      struct device *));
 void attribute_container_remove_device(struct device *dev,
 				       void (*fn)(struct attribute_container *,
 						  struct device *,
-						  struct class_device *));
+						  struct device *));
 void attribute_container_device_trigger(struct device *dev, 
 					int (*fn)(struct attribute_container *,
 						  struct device *,
-						  struct class_device *));
+						  struct device *));
 void attribute_container_trigger(struct device *dev, 
 				 int (*fn)(struct attribute_container *,
 					   struct device *));
-int attribute_container_add_attrs(struct class_device *classdev);
-int attribute_container_add_class_device(struct class_device *classdev);
+int attribute_container_add_attrs(struct device *classdev);
+int attribute_container_add_class_device(struct device *classdev);
 int attribute_container_add_class_device_adapter(struct attribute_container *cont,
 						 struct device *dev,
-						 struct class_device *classdev);
-void attribute_container_remove_attrs(struct class_device *classdev);
-void attribute_container_class_device_del(struct class_device *classdev);
-struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
-struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
-struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
+						 struct device *classdev);
+void attribute_container_remove_attrs(struct device *classdev);
+void attribute_container_class_device_del(struct device *classdev);
+struct attribute_container *attribute_container_classdev_to_container(struct device *);
+struct device *attribute_container_find_class_device(struct attribute_container *, struct device *);
+struct device_attribute **attribute_container_classdev_to_attrs(const struct device *classdev);
 
 #endif
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 60e377b52..e8406c5 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -55,7 +55,7 @@
 
 #if defined(CONFIG_BLK_DEV_BSG)
 struct bsg_class_device {
-	struct class_device *class_dev;
+	struct device *class_dev;
 	struct device *dev;
 	int minor;
 	struct request_queue *queue;
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index a5978f1..4332442 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -82,7 +82,8 @@
 
 struct enclosure_component {
 	void *scratch;
-	struct class_device cdev;
+	struct device cdev;
+	struct device *dev;
 	enum enclosure_component_type type;
 	int number;
 	int fault;
@@ -94,20 +95,20 @@
 struct enclosure_device {
 	void *scratch;
 	struct list_head node;
-	struct class_device cdev;
+	struct device edev;
 	struct enclosure_component_callbacks *cb;
 	int components;
 	struct enclosure_component component[0];
 };
 
 static inline struct enclosure_device *
-to_enclosure_device(struct class_device *dev)
+to_enclosure_device(struct device *dev)
 {
-	return container_of(dev, struct enclosure_device, cdev);
+	return container_of(dev, struct enclosure_device, edev);
 }
 
 static inline struct enclosure_component *
-to_enclosure_component(struct class_device *dev)
+to_enclosure_component(struct device *dev)
 {
 	return container_of(dev, struct enclosure_component, cdev);
 }
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 165734a..07ed56f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -443,7 +443,7 @@
 	MAX_PERFORMANCE,
 	MEDIUM_POWER,
 };
-extern struct class_device_attribute class_device_attr_link_power_management_policy;
+extern struct device_attribute dev_attr_link_power_management_policy;
 
 #ifdef CONFIG_ATA_SFF
 struct ata_ioports {
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index d22ad39..6b537f1 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -53,20 +53,20 @@
 #define DEFINE_RAID_ATTRIBUTE(type, attr)				      \
 static inline void							      \
 raid_set_##attr(struct raid_template *r, struct device *dev, type value) {    \
-	struct class_device *cdev =					      \
+	struct device *device =						      \
 		attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
 	struct raid_data *rd;						      \
-	BUG_ON(!cdev);							      \
-	rd = class_get_devdata(cdev);					      \
+	BUG_ON(!device);						      \
+	rd = dev_get_drvdata(device);					      \
 	rd->attr = value;						      \
 }									      \
 static inline type							      \
 raid_get_##attr(struct raid_template *r, struct device *dev) {		      \
-	struct class_device *cdev =					      \
+	struct device *device =						      \
 		attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
 	struct raid_data *rd;						      \
-	BUG_ON(!cdev);							      \
-	rd = class_get_devdata(cdev);					      \
+	BUG_ON(!device);						      \
+	rd = dev_get_drvdata(device);					      \
 	return rd->attr;						      \
 }
 
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 6696cf7..eaec1ea 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -17,11 +17,11 @@
 struct transport_class {
 	struct class class;
 	int (*setup)(struct transport_container *, struct device *,
-		     struct class_device *);
+		     struct device *);
 	int (*configure)(struct transport_container *, struct device *,
-			 struct class_device *);
+			 struct device *);
 	int (*remove)(struct transport_container *, struct device *,
-		      struct class_device *);
+		      struct device *);
 };
 
 #define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg)			\
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index ab7acbe..b8b19e2 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -156,8 +156,8 @@
 
 	int timeout;
 
-	struct device		sdev_gendev;
-	struct class_device	sdev_classdev;
+	struct device		sdev_gendev,
+				sdev_dev;
 
 	struct execute_work	ew; /* used to get process context on put */
 
@@ -167,9 +167,9 @@
 #define	to_scsi_device(d)	\
 	container_of(d, struct scsi_device, sdev_gendev)
 #define	class_to_sdev(d)	\
-	container_of(d, struct scsi_device, sdev_classdev)
+	container_of(d, struct scsi_device, sdev_dev)
 #define transport_class_to_sdev(class_dev) \
-	to_scsi_device(class_dev->dev)
+	to_scsi_device(class_dev->parent)
 
 #define sdev_printk(prefix, sdev, fmt, a...)	\
 	dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
@@ -220,7 +220,7 @@
 	return to_scsi_target(sdev->sdev_gendev.parent);
 }
 #define transport_class_to_starget(class_dev) \
-	to_scsi_target(class_dev->dev)
+	to_scsi_target(class_dev->parent)
 
 #define starget_printk(prefix, starget, fmt, a...)	\
 	dev_printk(prefix, &(starget)->dev, fmt, ##a)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 4913286..d967d6d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -470,7 +470,7 @@
 	/*
 	 * Pointer to the sysfs class properties for this host, NULL terminated.
 	 */
-	struct class_device_attribute **shost_attrs;
+	struct device_attribute **shost_attrs;
 
 	/*
 	 * Pointer to the SCSI device properties for this host, NULL terminated.
@@ -655,8 +655,7 @@
 	enum scsi_host_state shost_state;
 
 	/* ldm bits */
-	struct device		shost_gendev;
-	struct class_device	shost_classdev;
+	struct device		shost_gendev, shost_dev;
 
 	/*
 	 * List of hosts per template.
@@ -683,7 +682,7 @@
 };
 
 #define		class_to_shost(d)	\
-	container_of(d, struct Scsi_Host, shost_classdev)
+	container_of(d, struct Scsi_Host, shost_dev)
 
 #define shost_printk(prefix, shost, fmt, a...)	\
 	dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 0dfef75..490bd13 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -80,7 +80,7 @@
 };
 
 #define transport_class_to_shost(tc) \
-	dev_to_shost((tc)->dev)
+	dev_to_shost((tc)->parent)
 
 
 /* Private area maintenance. The driver requested allocations come
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 4769efd..06f72ba 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -163,8 +163,8 @@
 
 
 /* Macro for use in defining Virtual Port attributes */
-#define FC_VPORT_ATTR(_name,_mode,_show,_store)				\
-struct class_device_attribute class_device_attr_vport_##_name = 	\
+#define FC_VPORT_ATTR(_name,_mode,_show,_store)		\
+struct device_attribute dev_attr_vport_##_name = 	\
 	__ATTR(_name,_mode,_show,_store)
 
 
@@ -234,8 +234,8 @@
 
 #define	dev_to_vport(d)				\
 	container_of(d, struct fc_vport, dev)
-#define transport_class_to_vport(classdev)	\
-	dev_to_vport(classdev->dev)
+#define transport_class_to_vport(dev)		\
+	dev_to_vport(dev->parent)
 #define vport_to_shost(v)			\
 	(v->shost)
 #define vport_to_shost_channel(v)		\
@@ -271,7 +271,7 @@
 
 /* Macro for use in defining Remote Port attributes */
 #define FC_RPORT_ATTR(_name,_mode,_show,_store)				\
-struct class_device_attribute class_device_attr_rport_##_name = 	\
+struct device_attribute dev_attr_rport_##_name = 	\
 	__ATTR(_name,_mode,_show,_store)
 
 
@@ -341,8 +341,8 @@
 
 #define	dev_to_rport(d)				\
 	container_of(d, struct fc_rport, dev)
-#define transport_class_to_rport(classdev)	\
-	dev_to_rport(classdev->dev)
+#define transport_class_to_rport(dev)	\
+	dev_to_rport(dev->parent)
 #define rport_to_shost(r)			\
 	dev_to_shost(r->dev.parent)
 
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 09125fa..61ad359 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -80,8 +80,8 @@
 
 #define dev_to_phy(d) \
 	container_of((d), struct sas_phy, dev)
-#define transport_class_to_phy(cdev) \
-	dev_to_phy((cdev)->dev)
+#define transport_class_to_phy(dev) \
+	dev_to_phy((dev)->parent)
 #define phy_to_shost(phy) \
 	dev_to_shost((phy)->dev.parent)
 
@@ -96,8 +96,8 @@
 
 #define dev_to_rphy(d) \
 	container_of((d), struct sas_rphy, dev)
-#define transport_class_to_rphy(cdev) \
-	dev_to_rphy((cdev)->dev)
+#define transport_class_to_rphy(dev) \
+	dev_to_rphy((dev)->parent)
 #define rphy_to_shost(rphy) \
 	dev_to_shost((rphy)->dev.parent)
 #define target_to_rphy(targ) \
@@ -152,8 +152,8 @@
 
 #define dev_to_sas_port(d) \
 	container_of((d), struct sas_port, dev)
-#define transport_class_to_sas_port(cdev) \
-	dev_to_sas_port((cdev)->dev)
+#define transport_class_to_sas_port(dev) \
+	dev_to_sas_port((dev)->parent)
 
 struct sas_phy_linkrates {
 	enum sas_linkrate maximum_linkrate;
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
index 8ea9f73..4f032d4 100644
--- a/include/scsi/sd.h
+++ b/include/scsi/sd.h
@@ -34,7 +34,7 @@
 struct scsi_disk {
 	struct scsi_driver *driver;	/* always &sd_template */
 	struct scsi_device *device;
-	struct class_device cdev;
+	struct device	dev;
 	struct gendisk	*disk;
 	unsigned int	openers;	/* protected by BKL for now, yuck */
 	sector_t	capacity;	/* size in 512-byte sectors */
@@ -46,7 +46,7 @@
 	unsigned	RCD : 1;	/* state of disk RCD bit, unused */
 	unsigned	DPOFUA : 1;	/* state of disk DPOFUA bit */
 };
-#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
+#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
 
 #define sd_printk(prefix, sdsk, fmt, a...)				\
         (sdsk)->disk ?							\