提交 34060104 编写于 作者: S Stephen Rothwell

powerpc: Add a shutdown member to vio_driver

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.

Original patch adjusted for different location of vio.c.
Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
上级 915124d8
...@@ -69,6 +69,16 @@ static int vio_bus_remove(struct device *dev) ...@@ -69,6 +69,16 @@ static int vio_bus_remove(struct device *dev)
return 1; 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);
if (viodrv->shutdown)
viodrv->shutdown(viodev);
}
/** /**
* vio_register_driver: - Register a new vio driver * vio_register_driver: - Register a new vio driver
* @drv: The vio_driver structure to be registered. * @drv: The vio_driver structure to be registered.
...@@ -82,6 +92,7 @@ int vio_register_driver(struct vio_driver *viodrv) ...@@ -82,6 +92,7 @@ int vio_register_driver(struct vio_driver *viodrv)
viodrv->driver.bus = &vio_bus_type; viodrv->driver.bus = &vio_bus_type;
viodrv->driver.probe = vio_bus_probe; viodrv->driver.probe = vio_bus_probe;
viodrv->driver.remove = vio_bus_remove; viodrv->driver.remove = vio_bus_remove;
viodrv->driver.shutdown = vio_bus_shutdown;
return driver_register(&viodrv->driver); return driver_register(&viodrv->driver);
} }
......
...@@ -58,6 +58,7 @@ struct vio_driver { ...@@ -58,6 +58,7 @@ struct vio_driver {
const struct vio_device_id *id_table; const struct vio_device_id *id_table;
int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
int (*remove)(struct vio_dev *dev); int (*remove)(struct vio_dev *dev);
void (*shutdown)(struct vio_dev *dev);
unsigned long driver_data; unsigned long driver_data;
struct device_driver driver; struct device_driver driver;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册