aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b98cb1416a2d..aac91e89d6af 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -523,11 +523,16 @@ static void klist_children_put(struct klist_node *n)
523 * device_initialize - init device structure. 523 * device_initialize - init device structure.
524 * @dev: device. 524 * @dev: device.
525 * 525 *
526 * This prepares the device for use by other layers, 526 * This prepares the device for use by other layers by initializing
527 * including adding it to the device hierarchy. 527 * its fields.
528 * It is the first half of device_register(), if called by 528 * It is the first half of device_register(), if called by
529 * that, though it can also be called separately, so one 529 * that function, though it can also be called separately, so one
530 * may use @dev's fields (e.g. the refcount). 530 * may use @dev's fields. In particular, get_device()/put_device()
531 * may be used for reference counting of @dev after calling this
532 * function.
533 *
534 * NOTE: Use put_device() to give up your reference instead of freeing
535 * @dev directly once you have called this function.
531 */ 536 */
532void device_initialize(struct device *dev) 537void device_initialize(struct device *dev)
533{ 538{
@@ -835,9 +840,13 @@ static void device_remove_sys_dev_entry(struct device *dev)
835 * This is part 2 of device_register(), though may be called 840 * This is part 2 of device_register(), though may be called
836 * separately _iff_ device_initialize() has been called separately. 841 * separately _iff_ device_initialize() has been called separately.
837 * 842 *
838 * This adds it to the kobject hierarchy via kobject_add(), adds it 843 * This adds @dev to the kobject hierarchy via kobject_add(), adds it
839 * to the global and sibling lists for the device, then 844 * to the global and sibling lists for the device, then
840 * adds it to the other relevant subsystems of the driver model. 845 * adds it to the other relevant subsystems of the driver model.
846 *
847 * NOTE: _Never_ directly free @dev after calling this function, even
848 * if it returned an error! Always use put_device() to give up your
849 * reference instead.
841 */ 850 */
842int device_add(struct device *dev) 851int device_add(struct device *dev)
843{ 852{
@@ -965,6 +974,10 @@ done:
965 * I.e. you should only call the two helpers separately if 974 * I.e. you should only call the two helpers separately if
966 * have a clearly defined need to use and refcount the device 975 * have a clearly defined need to use and refcount the device
967 * before it is added to the hierarchy. 976 * before it is added to the hierarchy.
977 *
978 * NOTE: _Never_ directly free @dev after calling this function, even
979 * if it returned an error! Always use put_device() to give up the
980 * reference initialized in this function instead.
968 */ 981 */
969int device_register(struct device *dev) 982int device_register(struct device *dev)
970{ 983{