Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175809735
D45844.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45844.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/platform_device.h b/sys/compat/linuxkpi/common/include/linux/platform_device.h
--- a/sys/compat/linuxkpi/common/include/linux/platform_device.h
+++ b/sys/compat/linuxkpi/common/include/linux/platform_device.h
@@ -29,6 +29,7 @@
#define _LINUXKPI_LINUX_PLATFORM_DEVICE_H
#include <linux/kernel.h>
+#include <linux/build_bug.h>
#include <linux/device.h>
struct platform_device {
@@ -36,6 +37,7 @@
int id;
bool id_auto;
struct device dev;
+ char _name[];
};
struct platform_driver {
@@ -79,6 +81,23 @@
return;
}
+static __inline struct platform_device *
+platform_device_alloc(const char *name, int id)
+{
+ struct platform_device *pdev;
+
+ pdev = kzalloc(offsetof(struct platform_device, _name) +
+ strlen(name) + 1, GFP_KERNEL);
+ if (pdev != NULL)
+ return (NULL);
+
+ strcpy(pdev->_name, name);
+ pdev->name = pdev->_name;
+ pdev->id = id;
+
+ return (pdev);
+}
+
static __inline int
platform_device_register(struct platform_device *pdev)
{
@@ -86,12 +105,15 @@
return (0);
}
+#define platform_device_register_simple(name, id, res, num) ({ \
+ BUILD_BUG_ON(num != 0); \
+ platform_device_alloc(name, id); \
+})
+
static __inline void
platform_device_unregister(struct platform_device *pdev)
{
-
- pr_debug("%s: TODO\n", __func__);
- return;
+ kfree(pdev);
}
#endif /* _LINUXKPI_LINUX_PLATFORM_DEVICE_H */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 14, 1:22 PM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40802651
Default Alt Text
D45844.diff (1 KB)
Attached To
Mode
D45844: LinuxKPI: Add platform_device_register_simple
Attached
Detach File
Event Timeline
Log In to Comment