diff options
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 4a67cc0c8b37..74dda4f697f9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -632,6 +632,11 @@ static void klist_children_put(struct klist_node *n) | |||
632 | * may be used for reference counting of @dev after calling this | 632 | * may be used for reference counting of @dev after calling this |
633 | * function. | 633 | * function. |
634 | * | 634 | * |
635 | * All fields in @dev must be initialized by the caller to 0, except | ||
636 | * for those explicitly set to some other value. The simplest | ||
637 | * approach is to use kzalloc() to allocate the structure containing | ||
638 | * @dev. | ||
639 | * | ||
635 | * NOTE: Use put_device() to give up your reference instead of freeing | 640 | * NOTE: Use put_device() to give up your reference instead of freeing |
636 | * @dev directly once you have called this function. | 641 | * @dev directly once you have called this function. |
637 | */ | 642 | */ |
@@ -930,6 +935,13 @@ int device_private_init(struct device *dev) | |||
930 | * to the global and sibling lists for the device, then | 935 | * to the global and sibling lists for the device, then |
931 | * adds it to the other relevant subsystems of the driver model. | 936 | * adds it to the other relevant subsystems of the driver model. |
932 | * | 937 | * |
938 | * Do not call this routine or device_register() more than once for | ||
939 | * any device structure. The driver model core is not designed to work | ||
940 | * with devices that get unregistered and then spring back to life. | ||
941 | * (Among other things, it's very hard to guarantee that all references | ||
942 | * to the previous incarnation of @dev have been dropped.) Allocate | ||
943 | * and register a fresh new struct device instead. | ||
944 | * | ||
933 | * NOTE: _Never_ directly free @dev after calling this function, even | 945 | * NOTE: _Never_ directly free @dev after calling this function, even |
934 | * if it returned an error! Always use put_device() to give up your | 946 | * if it returned an error! Always use put_device() to give up your |
935 | * reference instead. | 947 | * reference instead. |
@@ -1022,7 +1034,7 @@ int device_add(struct device *dev) | |||
1022 | device_pm_add(dev); | 1034 | device_pm_add(dev); |
1023 | 1035 | ||
1024 | /* Notify clients of device addition. This call must come | 1036 | /* Notify clients of device addition. This call must come |
1025 | * after dpm_sysf_add() and before kobject_uevent(). | 1037 | * after dpm_sysfs_add() and before kobject_uevent(). |
1026 | */ | 1038 | */ |
1027 | if (dev->bus) | 1039 | if (dev->bus) |
1028 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | 1040 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, |
@@ -1090,6 +1102,9 @@ name_error: | |||
1090 | * have a clearly defined need to use and refcount the device | 1102 | * have a clearly defined need to use and refcount the device |
1091 | * before it is added to the hierarchy. | 1103 | * before it is added to the hierarchy. |
1092 | * | 1104 | * |
1105 | * For more information, see the kerneldoc for device_initialize() | ||
1106 | * and device_add(). | ||
1107 | * | ||
1093 | * NOTE: _Never_ directly free @dev after calling this function, even | 1108 | * NOTE: _Never_ directly free @dev after calling this function, even |
1094 | * if it returned an error! Always use put_device() to give up the | 1109 | * if it returned an error! Always use put_device() to give up the |
1095 | * reference initialized in this function instead. | 1110 | * reference initialized in this function instead. |