1DEVICE_ADD(9) Device drivers infrastructure DEVICE_ADD(9)
2
3
4
6 device_add - add device to device hierarchy.
7
9 int device_add(struct device * dev);
10
12 dev
13 device.
14
16 This is part 2 of device_register, though may be called separately
17 _iff_ device_initialize has been called separately.
18
19 This adds dev to the kobject hierarchy via kobject_add, adds it to the
20 global and sibling lists for the device, then adds it to the other
21 relevant subsystems of the driver model.
22
23 Do not call this routine or device_register more than once for any
24 device structure. The driver model core is not designed to work with
25 devices that get unregistered and then spring back to life. (Among
26 other things, it's very hard to guarantee that all references to the
27 previous incarnation of dev have been dropped.) Allocate and register a
28 fresh new struct device instead.
29
31 _Never_ directly free dev after calling this function, even if it
32 returned an error! Always use put_device to give up your reference
33 instead.
34
36Kernel Hackers Manual 3.10 June 2019 DEVICE_ADD(9)