1DEVICE_CREATE(9) Device drivers infrastructure DEVICE_CREATE(9)
2
3
4
6 device_create - creates a device and registers it with sysfs
7
9 struct device * device_create(struct class * class,
10 struct device * parent, dev_t devt,
11 void * drvdata, const char * fmt, ...);
12
14 class
15 pointer to the struct class that this device should be registered
16 to
17
18 parent
19 pointer to the parent struct device of this new device, if any
20
21 devt
22 the dev_t for the char device to be added
23
24 drvdata
25 the data to be added to the device for callbacks
26
27 fmt
28 string for the device's name
29
30 ...
31 variable arguments
32
34 This function can be used by char device classes. A struct device will
35 be created in sysfs, registered to the specified class.
36
37 A “dev” file will be created, showing the dev_t for the device, if the
38 dev_t is not 0,0. If a pointer to a parent struct device is passed in,
39 the newly created struct device will be a child of that device in
40 sysfs. The pointer to the struct device will be returned from the call.
41 Any further sysfs files that might be required can be created using
42 this pointer.
43
44 Returns struct device pointer on success, or ERR_PTR on error.
45
47 the struct class passed to this function must have previously been
48 created with a call to class_create.
49
51Kernel Hackers Manual 2.6. November 2011 DEVICE_CREATE(9)