Skip to content

Commit e3e1143

Browse files
committed
Allow devicemodel built with Linux v6.11+
Since commit 0edb555 ("platform: Make platform_driver::remove() return void"), the original `platform_driver::remove()` function returned an integer value, usually an error code. This made driver developers think that errors were properly handled. However, the driver core does not stop the device removal process based on the error code, so the error code did not serve its intended purpose. Therefore, the return type was changed to `void` to avoid potential issues. Make the devicemodel example run successfully on Linux v6.11+. Testing detail: - Tested on Raspberry Pi 5B with Raspberry Pi OS (Debian 12, Linux version 6.12.1-v8-16k+) - Verified the devicemodel examples compile and load successfully
1 parent e442916 commit e3e1143

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/devicemodel.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/kernel.h>
55
#include <linux/module.h>
66
#include <linux/platform_device.h>
7+
#include <linux/version.h>
78

89
struct devicemodel_data {
910
char *greeting;
@@ -22,14 +23,18 @@ static int devicemodel_probe(struct platform_device *dev)
2223

2324
return 0;
2425
}
25-
26+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
2627
static int devicemodel_remove(struct platform_device *dev)
28+
#else
29+
static void devicemodel_remove(struct platform_device *dev)
30+
#endif
2731
{
2832
pr_info("devicemodel example removed\n");
2933

3034
/* Your device removal code */
31-
35+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
3236
return 0;
37+
#endif
3338
}
3439

3540
static int devicemodel_suspend(struct device *dev)

0 commit comments

Comments
 (0)