--- a/ubootenv-nvram.c
+++ b/ubootenv-nvram.c
@@ -13,6 +13,7 @@
 #include <linux/of.h>
 #include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
+#include <linux/version.h>
 
 #define NAME "ubootenv"
 
@@ -132,18 +133,30 @@ static int ubootenv_probe(struct platfor
 	return misc_register(&data->misc);
 }
 
-static int ubootenv_remove(struct platform_device *pdev)
+static
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
+int
+#else
+void
+#endif
+ubootenv_remove(struct platform_device *pdev)
 {
 	struct ubootenv_drvdata *data = platform_get_drvdata(pdev);
 
 	data->env = NULL;
 	misc_deregister(&data->misc);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
 	return 0;
+#endif
 }
 
 static struct platform_driver ubootenv_driver = {
 	.probe = ubootenv_probe,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
 	.remove = ubootenv_remove,
+#else
+	.remove_new = ubootenv_remove,
+#endif
 	.driver = {
 		.name           = NAME,
 		.owner          = THIS_MODULE,
