diff options
Diffstat (limited to 'drivers/s390/crypto/ap_bus.c')
-rw-r--r-- | drivers/s390/crypto/ap_bus.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 7e9a72eb2fe0..cd2103c1d915 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -836,12 +836,12 @@ static void __ap_flush_queue(struct ap_device *ap_dev) | |||
836 | list_for_each_entry_safe(ap_msg, next, &ap_dev->pendingq, list) { | 836 | list_for_each_entry_safe(ap_msg, next, &ap_dev->pendingq, list) { |
837 | list_del_init(&ap_msg->list); | 837 | list_del_init(&ap_msg->list); |
838 | ap_dev->pendingq_count--; | 838 | ap_dev->pendingq_count--; |
839 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); | 839 | ap_msg->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); |
840 | } | 840 | } |
841 | list_for_each_entry_safe(ap_msg, next, &ap_dev->requestq, list) { | 841 | list_for_each_entry_safe(ap_msg, next, &ap_dev->requestq, list) { |
842 | list_del_init(&ap_msg->list); | 842 | list_del_init(&ap_msg->list); |
843 | ap_dev->requestq_count--; | 843 | ap_dev->requestq_count--; |
844 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); | 844 | ap_msg->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); |
845 | } | 845 | } |
846 | } | 846 | } |
847 | 847 | ||
@@ -1329,7 +1329,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags) | |||
1329 | continue; | 1329 | continue; |
1330 | list_del_init(&ap_msg->list); | 1330 | list_del_init(&ap_msg->list); |
1331 | ap_dev->pendingq_count--; | 1331 | ap_dev->pendingq_count--; |
1332 | ap_dev->drv->receive(ap_dev, ap_msg, ap_dev->reply); | 1332 | ap_msg->receive(ap_dev, ap_msg, ap_dev->reply); |
1333 | break; | 1333 | break; |
1334 | } | 1334 | } |
1335 | if (ap_dev->queue_count > 0) | 1335 | if (ap_dev->queue_count > 0) |
@@ -1450,10 +1450,10 @@ static int __ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_ms | |||
1450 | return -EBUSY; | 1450 | return -EBUSY; |
1451 | case AP_RESPONSE_REQ_FAC_NOT_INST: | 1451 | case AP_RESPONSE_REQ_FAC_NOT_INST: |
1452 | case AP_RESPONSE_MESSAGE_TOO_BIG: | 1452 | case AP_RESPONSE_MESSAGE_TOO_BIG: |
1453 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-EINVAL)); | 1453 | ap_msg->receive(ap_dev, ap_msg, ERR_PTR(-EINVAL)); |
1454 | return -EINVAL; | 1454 | return -EINVAL; |
1455 | default: /* Device is gone. */ | 1455 | default: /* Device is gone. */ |
1456 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); | 1456 | ap_msg->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); |
1457 | return -ENODEV; | 1457 | return -ENODEV; |
1458 | } | 1458 | } |
1459 | } else { | 1459 | } else { |
@@ -1471,6 +1471,10 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg) | |||
1471 | unsigned long flags; | 1471 | unsigned long flags; |
1472 | int rc; | 1472 | int rc; |
1473 | 1473 | ||
1474 | /* For asynchronous message handling a valid receive-callback | ||
1475 | * is required. */ | ||
1476 | BUG_ON(!ap_msg->receive); | ||
1477 | |||
1474 | spin_lock_bh(&ap_dev->lock); | 1478 | spin_lock_bh(&ap_dev->lock); |
1475 | if (!ap_dev->unregistered) { | 1479 | if (!ap_dev->unregistered) { |
1476 | /* Make room on the queue by polling for finished requests. */ | 1480 | /* Make room on the queue by polling for finished requests. */ |
@@ -1482,7 +1486,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg) | |||
1482 | if (rc == -ENODEV) | 1486 | if (rc == -ENODEV) |
1483 | ap_dev->unregistered = 1; | 1487 | ap_dev->unregistered = 1; |
1484 | } else { | 1488 | } else { |
1485 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); | 1489 | ap_msg->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); |
1486 | rc = -ENODEV; | 1490 | rc = -ENODEV; |
1487 | } | 1491 | } |
1488 | spin_unlock_bh(&ap_dev->lock); | 1492 | spin_unlock_bh(&ap_dev->lock); |