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 @@ -359,6 +359,12 @@ static void virtio_dev_shutdown(struct device *_d)
359359 if (!drv )
360360 return ;
361361
362+ /* If the driver has its own shutdown method, use that. */
363+ if (drv -> shutdown ) {
364+ drv -> shutdown (dev );
365+ return ;
366+ }
367+
362368 /*
363369 * Some devices get wedged if you kick them after they are
364370 * reset. Mark all vqs as broken to make sure we don't.
Original file line number Diff line number Diff line change @@ -178,6 +178,8 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev);
178178 * changes; may be called in interrupt context.
179179 * @freeze: optional function to call during suspend/hibernation.
180180 * @restore: optional function to call on resume.
181+ * @shutdown: synchronize with the device on shutdown. If provided, replaces
182+ * the virtio core implementation.
181183 */
182184struct virtio_driver {
183185 struct device_driver driver ;
@@ -195,6 +197,7 @@ struct virtio_driver {
195197 int (* freeze )(struct virtio_device * dev );
196198 int (* restore )(struct virtio_device * dev );
197199#endif
200+ void (* shutdown )(struct virtio_device * dev );
198201};
199202
200203static inline struct virtio_driver * drv_to_virtio (struct device_driver * drv )
You can’t perform that action at this time.
0 commit comments