File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,14 @@ static void virtio_gpu_remove(struct virtio_device *vdev)
128128 drm_dev_put (dev );
129129}
130130
131+ static void virtio_gpu_shutdown (struct virtio_device * vdev )
132+ {
133+ /*
134+ * drm does its own synchronization on shutdown.
135+ * Do nothing here, opt out of device reset.
136+ */
137+ }
138+
131139static void virtio_gpu_config_changed (struct virtio_device * vdev )
132140{
133141 struct drm_device * dev = vdev -> priv ;
@@ -162,6 +170,7 @@ static struct virtio_driver virtio_gpu_driver = {
162170 .id_table = id_table ,
163171 .probe = virtio_gpu_probe ,
164172 .remove = virtio_gpu_remove ,
173+ .shutdown = virtio_gpu_shutdown ,
165174 .config_changed = virtio_gpu_config_changed
166175};
167176
Original file line number Diff line number Diff line change @@ -407,6 +407,12 @@ static void virtio_dev_shutdown(struct device *_d)
407407 if (!drv )
408408 return ;
409409
410+ /* If the driver has its own shutdown method, use that. */
411+ if (drv -> shutdown ) {
412+ drv -> shutdown (dev );
413+ return ;
414+ }
415+
410416 /*
411417 * Some devices get wedged if you kick them after they are
412418 * reset. Mark all vqs as broken to make sure we don't.
Original file line number Diff line number Diff line change @@ -220,6 +220,8 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);
220220 * occurs.
221221 * @reset_done: optional function to call after transport specific reset
222222 * operation has finished.
223+ * @shutdown: synchronize with the device on shutdown. If provided, replaces
224+ * the virtio core implementation.
223225 */
224226struct virtio_driver {
225227 struct device_driver driver ;
@@ -237,6 +239,7 @@ struct virtio_driver {
237239 int (* restore )(struct virtio_device * dev );
238240 int (* reset_prepare )(struct virtio_device * dev );
239241 int (* reset_done )(struct virtio_device * dev );
242+ void (* shutdown )(struct virtio_device * dev );
240243};
241244
242245#define drv_to_virtio (__drv ) container_of_const(__drv, struct virtio_driver, driver)
You can’t perform that action at this time.
0 commit comments