Browse Source

Merge pull request #321 from EricccTaiwan/example-refactor

examples: Refactor device model with version-based split
Jim Huang 1 week ago
parent
commit
801600124c
1 changed files with 6 additions and 4 deletions
  1. 6 4
      examples/devicemodel.c

+ 6 - 4
examples/devicemodel.c

@@ -23,19 +23,21 @@ static int devicemodel_probe(struct platform_device *dev)
 
     return 0;
 }
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
 static void devicemodel_remove(struct platform_device *dev)
+{
+    pr_info("devicemodel example removed\n");
+    /* Your device removal code */
+}
 #else
 static int devicemodel_remove(struct platform_device *dev)
-#endif
 {
     pr_info("devicemodel example removed\n");
-
     /* Your device removal code */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
     return 0;
-#endif
 }
+#endif
 
 static int devicemodel_suspend(struct device *dev)
 {