From dcedd5fc061fdb40b515abb744afbaeea1619824 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 17 Jul 2008 12:11:58 +0000 Subject: [PATCH] Added an explanatory comment for the device_create() compatibility stuff. --- include/linux/device.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 5b4b2368..4ee44548 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -25,6 +25,22 @@ #include +/* + * Notes: + * + * The 'struct device *' returned by the device_create() compatibility + * functions (assuming the return value is not an error pointer for which + * 'IS_ERR(ptr)' is true) is not really a 'struct device *' and should not + * be treated as such. For kernel versions 2.5.0 to 2.6.17, the return + * value is actually a 'struct class_device *' in disguise and we assume + * the 'parent' parameter of device_create() is also a 'struct class_device *' + * in disguise from a previous call to device_create(). + * + * The main limitation is that we cannot use a *real* 'struct device *' as + * the parent parameter of device_create(), only a pointer from a previous + * call to device_create(). + */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include -- 2.26.2