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 @@ -123,6 +123,14 @@ static void virtio_gpu_remove(struct virtio_device *vdev)
123123 drm_dev_put (dev );
124124}
125125
126+ static void virtio_gpu_shutdown (struct virtio_device * vdev )
127+ {
128+ /*
129+ * drm does its own synchronization on shutdown.
130+ * Do nothing here, opt out of device reset.
131+ */
132+ }
133+
126134static void virtio_gpu_config_changed (struct virtio_device * vdev )
127135{
128136 struct drm_device * dev = vdev -> priv ;
@@ -157,6 +165,7 @@ static struct virtio_driver virtio_gpu_driver = {
157165 .id_table = id_table ,
158166 .probe = virtio_gpu_probe ,
159167 .remove = virtio_gpu_remove ,
168+ .shutdown = virtio_gpu_shutdown ,
160169 .config_changed = virtio_gpu_config_changed
161170};
162171
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 @@ -205,6 +205,8 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);
205205 * changes; may be called in interrupt context.
206206 * @freeze: optional function to call during suspend/hibernation.
207207 * @restore: optional function to call on resume.
208+ * @shutdown: synchronize with the device on shutdown. If provided, replaces
209+ * the virtio core implementation.
208210 */
209211struct virtio_driver {
210212 struct device_driver driver ;
@@ -220,6 +222,7 @@ struct virtio_driver {
220222 void (* config_changed )(struct virtio_device * dev );
221223 int (* freeze )(struct virtio_device * dev );
222224 int (* restore )(struct virtio_device * dev );
225+ void (* shutdown )(struct virtio_device * dev );
223226};
224227
225228#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