From: Jan Kiszka <[email protected]>

In 4.15, of_overlay_create and of_overlay_destroy were refactored to
of_overlay_apply and of_overlay_remove, also changing the parameters and
return values. Prepare for this change while staying compatible with
older kernels.

Signed-off-by: Jan Kiszka <[email protected]>
---
 driver/pci.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/driver/pci.c b/driver/pci.c
index cc4d15bd..66e0acbc 100644
--- a/driver/pci.c
+++ b/driver/pci.c
@@ -19,6 +19,11 @@
 #include <linux/version.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
+#define of_overlay_apply(overlay, id)  (*id = of_overlay_create(overlay))
+#define of_overlay_remove(id)          of_overlay_destroy(*id)
+#endif
+
 #include "pci.h"
 
 struct claimed_dev {
@@ -345,8 +350,7 @@ static bool create_vpci_of_overlay(struct jailhouse_system 
*config)
        prop_val[4] = cpu_to_be32(base_addr);
        prop_val[6] = cpu_to_be32(count_ivshmem_devices(root_cell) * 0x2000);
 
-       overlay_id = of_overlay_create(overlay);
-       if (overlay_id < 0)
+       if (of_overlay_apply(overlay, &overlay_id) < 0)
                goto out;
 
        success = true;
@@ -364,7 +368,7 @@ out:
 static void destroy_vpci_of_overlay(void)
 {
        if (overlay_id >= 0)
-               of_overlay_destroy(overlay_id);
+               of_overlay_remove(&overlay_id);
 }
 #else /* !CONFIG_OF_OVERLAY */
 static bool create_vpci_of_overlay(struct jailhouse_system *config)
-- 
2.12.3

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to