[PATCH 1/3] ppc64: Add a shutdown member to vio_driver

Michael Ellerman michael at ellerman.id.au
Thu Aug 4 17:14:58 EST 2005


Add a shutdown member to struct vio_driver. We also need vio_bus_shutdown()
which converts from struct device to struct vio_dev and knows how to extract
the struct vio_driver.

Cleanup the vio_driver definition to fit 80 columns while we're there.

Signed-off-by: Michael Ellerman <michael at ellerman.id.au>

 arch/ppc64/kernel/vio.c |   13 +++++++++++++
 include/asm-ppc64/vio.h |   16 +++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

Index: kexec/arch/ppc64/kernel/vio.c
===================================================================
--- kexec.orig/arch/ppc64/kernel/vio.c
+++ kexec/arch/ppc64/kernel/vio.c
@@ -105,6 +105,18 @@ static int vio_bus_remove(struct device 
 	return 1;
 }
 
+/* convert from struct device to struct vio_dev and pass to driver. */
+static void vio_bus_shutdown(struct device *dev)
+{
+	struct vio_dev *viodev = to_vio_dev(dev);
+	struct vio_driver *viodrv = to_vio_driver(dev->driver);
+
+	DBGENTER();
+
+	if (viodrv->shutdown)
+		viodrv->shutdown(viodev);
+}
+
 /**
  * vio_register_driver: - Register a new vio driver
  * @drv:	The vio_driver structure to be registered.
@@ -119,6 +131,7 @@ int vio_register_driver(struct vio_drive
 	viodrv->driver.bus = &vio_bus_type;
 	viodrv->driver.probe = vio_bus_probe;
 	viodrv->driver.remove = vio_bus_remove;
+	viodrv->driver.shutdown = vio_bus_shutdown;
 
 	return driver_register(&viodrv->driver);
 }
Index: kexec/include/asm-ppc64/vio.h
===================================================================
--- kexec.orig/include/asm-ppc64/vio.h
+++ kexec/include/asm-ppc64/vio.h
@@ -69,9 +69,19 @@ struct vio_device_id {
 struct vio_driver {
 	struct list_head node;
 	char *name;
-	const struct vio_device_id *id_table;	/* NULL if wants all devices */
-	int  (*probe)  (struct vio_dev *dev, const struct vio_device_id *id);	/* New device inserted */
-	int (*remove) (struct vio_dev *dev);	/* Device removed (NULL if not a hot-plug capable driver) */
+
+	/* NULL if wants all devices */
+	const struct vio_device_id *id_table;
+
+	/* New device inserted */
+	int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
+
+	/* Device removed (NULL if not a hot-plug capable driver) */
+	int (*remove) (struct vio_dev *dev);
+
+	/* Shutdown the device (NULL if no action required) */
+	void (*shutdown) (struct vio_dev *dev);
+
 	unsigned long driver_data;
 
 	struct device_driver driver;



More information about the Linuxppc64-dev mailing list