aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/ap_bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/crypto/ap_bus.c')
-rw-r--r--drivers/s390/crypto/ap_bus.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 181b51772b1b..a817dade37c0 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -757,10 +757,16 @@ static void ap_scan_bus(struct work_struct *unused)
757 (void *)(unsigned long)qid, 757 (void *)(unsigned long)qid,
758 __ap_scan_bus); 758 __ap_scan_bus);
759 rc = ap_query_queue(qid, &queue_depth, &device_type); 759 rc = ap_query_queue(qid, &queue_depth, &device_type);
760 if (dev && rc) { 760 if (dev) {
761 put_device(dev); 761 ap_dev = to_ap_dev(dev);
762 device_unregister(dev); 762 spin_lock_bh(&ap_dev->lock);
763 continue; 763 if (rc || ap_dev->unregistered) {
764 spin_unlock_bh(&ap_dev->lock);
765 put_device(dev);
766 device_unregister(dev);
767 continue;
768 } else
769 spin_unlock_bh(&ap_dev->lock);
764 } 770 }
765 if (dev) { 771 if (dev) {
766 put_device(dev); 772 put_device(dev);
@@ -994,7 +1000,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
994 ap_dev->unregistered = 1; 1000 ap_dev->unregistered = 1;
995 } else { 1001 } else {
996 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); 1002 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV));
997 rc = 0; 1003 rc = -ENODEV;
998 } 1004 }
999 spin_unlock_bh(&ap_dev->lock); 1005 spin_unlock_bh(&ap_dev->lock);
1000 if (rc == -ENODEV) 1006 if (rc == -ENODEV)
@@ -1044,18 +1050,12 @@ static void ap_poll_timeout(unsigned long unused)
1044 */ 1050 */
1045static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags) 1051static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
1046{ 1052{
1047 int rc;
1048
1049 spin_lock(&ap_dev->lock); 1053 spin_lock(&ap_dev->lock);
1050 if (!ap_dev->unregistered) { 1054 if (!ap_dev->unregistered) {
1051 rc = ap_poll_queue(ap_dev, flags); 1055 if (ap_poll_queue(ap_dev, flags))
1052 if (rc)
1053 ap_dev->unregistered = 1; 1056 ap_dev->unregistered = 1;
1054 } else 1057 }
1055 rc = 0;
1056 spin_unlock(&ap_dev->lock); 1058 spin_unlock(&ap_dev->lock);
1057 if (rc)
1058 device_unregister(&ap_dev->device);
1059 return 0; 1059 return 0;
1060} 1060}
1061 1061