@@ -335,6 +335,14 @@ static void virtcrypto_del_vqs(struct virtio_crypto *vcrypto)
335
335
virtcrypto_free_queues (vcrypto );
336
336
}
337
337
338
+ static void vcrypto_config_changed_work (struct work_struct * work )
339
+ {
340
+ struct virtio_crypto * vcrypto =
341
+ container_of (work , struct virtio_crypto , config_work );
342
+
343
+ virtcrypto_update_status (vcrypto );
344
+ }
345
+
338
346
static int virtcrypto_probe (struct virtio_device * vdev )
339
347
{
340
348
int err = - EFAULT ;
@@ -454,6 +462,8 @@ static int virtcrypto_probe(struct virtio_device *vdev)
454
462
if (err )
455
463
goto free_engines ;
456
464
465
+ INIT_WORK (& vcrypto -> config_work , vcrypto_config_changed_work );
466
+
457
467
return 0 ;
458
468
459
469
free_engines :
@@ -490,6 +500,7 @@ static void virtcrypto_remove(struct virtio_device *vdev)
490
500
491
501
dev_info (& vdev -> dev , "Start virtcrypto_remove.\n" );
492
502
503
+ flush_work (& vcrypto -> config_work );
493
504
if (virtcrypto_dev_started (vcrypto ))
494
505
virtcrypto_dev_stop (vcrypto );
495
506
virtio_reset_device (vdev );
@@ -504,14 +515,15 @@ static void virtcrypto_config_changed(struct virtio_device *vdev)
504
515
{
505
516
struct virtio_crypto * vcrypto = vdev -> priv ;
506
517
507
- virtcrypto_update_status ( vcrypto );
518
+ schedule_work ( & vcrypto -> config_work );
508
519
}
509
520
510
521
#ifdef CONFIG_PM_SLEEP
511
522
static int virtcrypto_freeze (struct virtio_device * vdev )
512
523
{
513
524
struct virtio_crypto * vcrypto = vdev -> priv ;
514
525
526
+ flush_work (& vcrypto -> config_work );
515
527
virtio_reset_device (vdev );
516
528
virtcrypto_free_unused_reqs (vcrypto );
517
529
if (virtcrypto_dev_started (vcrypto ))
0 commit comments