summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Dengler <dengler@linux.ibm.com>2024-03-08 17:23:25 +0100
committerAlexander Gordeev <agordeev@linux.ibm.com>2024-04-09 17:29:55 +0200
commit3c7a377324cf9f248041c0e7295728eebd6c9b14 (patch)
tree411a7c9d3c15400d99a62cabf58bf8a91571ed37
parent170660ccf8806742052028093fb45872d2be4775 (diff)
s390/ap: swap IRQ and bus/device registration
The IRQ handler may rely on the bus or the root device. Register the adapter IRQ after setting up the bus and the root device to avoid any race conditions. Signed-off-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-rw-r--r--drivers/s390/crypto/ap_bus.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index aabaf93004bc..cdfaa321b44e 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -2400,15 +2400,10 @@ static int __init ap_module_init(void)
ap_domain_index = -1;
}
- /* enable interrupts if available */
- rc = ap_irq_init();
- if (rc)
- goto out;
-
/* Create /sys/bus/ap. */
rc = bus_register(&ap_bus_type);
if (rc)
- goto out_irq;
+ goto out;
/* Create /sys/devices/ap. */
ap_root_device = root_device_register("ap");
@@ -2417,19 +2412,24 @@ static int __init ap_module_init(void)
goto out_bus;
ap_root_device->bus = &ap_bus_type;
+ /* enable interrupts if available */
+ rc = ap_irq_init();
+ if (rc)
+ goto out_device;
+
/* Setup asynchronous work (timers, workqueue, etc). */
rc = ap_async_init();
if (rc)
- goto out_device;
+ goto out_irq;
return 0;
+out_irq:
+ ap_irq_exit();
out_device:
root_device_unregister(ap_root_device);
out_bus:
bus_unregister(&ap_bus_type);
-out_irq:
- ap_irq_exit();
out:
ap_debug_exit();
return rc;