[PATCH] remove struct vio_dev's driver_data

Stephen Rothwell sfr at canb.auug.org.au
Tue Jun 8 17:40:04 EST 2004


Hi Dave,

Next in the series ... This patch removes struct vio_dev's driver_data in
favour of using hte driver_data in hte embedded struct device.  This
simplifies some of the virtual scsi code a little and saves us yet more
room in strcut vio_dev.

Please review and apply to Ameslab if you thing it is OK.

This patch goes on top of the patch to remove archdata.
--
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
diff -ruN ppc64-linux-2.5.archdata/drivers/char/hvcs.c ppc64-linux-2.5.driver_data/drivers/char/hvcs.c
--- ppc64-linux-2.5.archdata/drivers/char/hvcs.c	2004-05-12 09:07:38.000000000 +1000
+++ ppc64-linux-2.5.driver_data/drivers/char/hvcs.c	2004-06-08 17:23:25.000000000 +1000
@@ -342,7 +342,7 @@
 	hvcsd->kobj.ktype = &hvcs_kobj_type;

 	hvcsd->vdev = dev;
-	dev->driver_data = hvcsd;
+	dev->dev.driver_data = hvcsd;
 	sprintf(hvcsd->name,"%X",dev->unit_address);

 	hvcsd->index = ++hvcs_struct_count;
@@ -377,7 +377,7 @@

 static int __devexit hvcs_remove(struct vio_dev *dev)
 {
-	struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev->driver_data;
+	struct hvcs_struct *hvcsd = dev->dev.driver_data;

 	if (!hvcsd)
 		return -ENODEV;
@@ -912,7 +912,7 @@

 static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod)
 {
-	return (struct hvcs_struct *)viod->driver_data;
+	return viod->dev.driver_data;
 }
 /* The sysfs interface for the driver and devices */

diff -ruN ppc64-linux-2.5.archdata/drivers/net/ibmveth.c ppc64-linux-2.5.driver_data/drivers/net/ibmveth.c
--- ppc64-linux-2.5.archdata/drivers/net/ibmveth.c	2004-05-28 11:04:34.000000000 +1000
+++ ppc64-linux-2.5.driver_data/drivers/net/ibmveth.c	2004-06-08 17:24:43.000000000 +1000
@@ -902,7 +902,7 @@

 	adapter = netdev->priv;
 	memset(adapter, 0, sizeof(adapter));
-	dev->driver_data = netdev;
+	dev->dev.driver_data = netdev;

 	adapter->vdev = dev;
 	adapter->netdev = netdev;
@@ -972,7 +972,7 @@

 static int __devexit ibmveth_remove(struct vio_dev *dev)
 {
-	struct net_device *netdev = dev->driver_data;
+	struct net_device *netdev = dev->dev.driver_data;
 	struct ibmveth_adapter *adapter = netdev->priv;

 	unregister_netdev(netdev);
diff -ruN ppc64-linux-2.5.archdata/drivers/scsi/ibmvscsi/ibmvscsis.c ppc64-linux-2.5.driver_data/drivers/scsi/ibmvscsi/ibmvscsis.c
--- ppc64-linux-2.5.archdata/drivers/scsi/ibmvscsi/ibmvscsis.c	2004-05-28 11:04:34.000000000 +1000
+++ ppc64-linux-2.5.driver_data/drivers/scsi/ibmvscsi/ibmvscsis.c	2004-06-08 17:31:01.000000000 +1000
@@ -2205,7 +2205,7 @@
 {
 	struct device *dev =
 		container_of(vbus->kobj.parent, struct device , kobj);
-	struct server_adapter *adapter = (struct server_adapter *)to_vio_dev(dev)->driver_data;
+	struct server_adapter *adapter = dev->driver_data;
 	int cur_num_targets = atomic_read(&vbus->num_targets);
 	unsigned long flags;

@@ -2257,7 +2257,7 @@

 static void set_num_buses(struct device *dev, long value)
 {
-	struct server_adapter *adapter = (struct server_adapter *)to_vio_dev(dev)->driver_data;
+	struct server_adapter *adapter = dev->driver_data;
 	int cur_num_buses = atomic_read(&adapter->num_buses);
 	unsigned long flags;

@@ -2329,7 +2329,7 @@
 {
 	struct vdev *vdev = container_of(kobj, struct vdev, kobj);
 	struct device *dev = container_of(kobj->parent->parent, struct device, kobj);
-	struct server_adapter *adapter = (struct server_adapter *)to_vio_dev(dev)->driver_data;
+	struct server_adapter *adapter = dev->driver_data;
 	unsigned long flags;
 	ssize_t returned;

@@ -2357,7 +2357,7 @@
 {
 	struct vdev *vdev = container_of(kobj, struct vdev, kobj);
 	struct device *dev = container_of(kobj->parent->parent, struct device, kobj);
-	struct server_adapter *adapter = (struct server_adapter *)to_vio_dev(dev)->driver_data;
+	struct server_adapter *adapter = dev->driver_data;
 	long flags;
 	long value = simple_strtol(buf, NULL, 10);

@@ -2474,7 +2474,7 @@
 /* Device attributes */
 static ssize_t vscsi_dev_bus_show(struct device * dev, char * buf)
 {
-	struct server_adapter *adapter = (struct server_adapter *)to_vio_dev(dev)->driver_data;
+	struct server_adapter *adapter = dev->driver_data;

 	return sprintf(buf, "%d\n", atomic_read(&adapter->num_buses));
 }
@@ -2578,7 +2578,7 @@
 	memset(adapter, 0x00, sizeof(*adapter));
 	adapter->dma_dev = dev;
 	adapter->dev = &dev->dev;
-	dev->driver_data = adapter;
+	dev->dev.driver_data = adapter;
 	sprintf(adapter->name, "%x", dev->unit_address);
 	adapter->lock = SPIN_LOCK_UNLOCKED;

@@ -2647,8 +2647,7 @@
 	int bus;
 	int target;
 	unsigned long flags;
-	struct server_adapter *adapter =
-	    (struct server_adapter *)dev->driver_data;
+	struct server_adapter *adapter = dev->dev.driver_data;

 	info("entering remove for UA 0x%x\n", dev->unit_address);

diff -ruN ppc64-linux-2.5.archdata/drivers/scsi/ibmvscsi/rpa_vscsi.c ppc64-linux-2.5.driver_data/drivers/scsi/ibmvscsi/rpa_vscsi.c
--- ppc64-linux-2.5.archdata/drivers/scsi/ibmvscsi/rpa_vscsi.c	2004-04-28 17:04:34.000000000 +1000
+++ ppc64-linux-2.5.driver_data/drivers/scsi/ibmvscsi/rpa_vscsi.c	2004-06-08 17:26:33.000000000 +1000
@@ -282,7 +282,7 @@
 {
 	struct ibmvscsi_host_data *hostdata = ibmvscsi_probe(&vdev->dev);
 	if (hostdata) {
-		vdev->driver_data = hostdata;
+		vdev->dev.driver_data = hostdata;
 		return 0;
 	} else {
 		return -1;
@@ -295,8 +295,7 @@
  */
 static int rpa_remove(struct vio_dev *vdev)
 {
-	struct ibmvscsi_host_data *hostdata =
-	    (struct ibmvscsi_host_data *)vdev->driver_data;
+	struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data;
 	ibmvscsi_remove(hostdata);
 	return 0;
 }
diff -ruN ppc64-linux-2.5.archdata/include/asm-ppc64/vio.h ppc64-linux-2.5.driver_data/include/asm-ppc64/vio.h
--- ppc64-linux-2.5.archdata/include/asm-ppc64/vio.h	2004-06-08 16:32:33.000000000 +1000
+++ ppc64-linux-2.5.driver_data/include/asm-ppc64/vio.h	2004-06-08 17:31:55.000000000 +1000
@@ -107,7 +107,6 @@
  * The vio_dev structure is used to describe virtual I/O devices.
  */
 struct vio_dev {
-	void *driver_data;              /* data private to the driver */
 	struct iommu_table *iommu_table;     /* vio_map_* uses this */
 	uint32_t unit_address;
 	unsigned int irq;


More information about the Linuxppc64-dev mailing list