Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\kobject.c Create Date:2022-07-28 06:16:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kobject_add_internal

Proto:static int kobject_add_internal(struct kobject *kobj)

Type:int

Parameter:

TypeParameterName
struct kobject *kobj
227  error = 0
230  If Not kobj Then Return -ENOENT
233  If Not name || Not name[0] Then
234  WARN(1, "kobject: (%p): attempted to be registered with empty name!\n", kobj)
237  Return -EINVAL
240  parent = kobject_get() - Increment refcount for object.*@kobj: object.
243  If kset Then
244  If Not parent Then parent = kobject_get() - Increment refcount for object.*@kobj: object.
246  add the kobject to its kset's list
247  parent = parent
250  pr_debug("kobject: '%s' (%p): %s: parent: '%s', set: '%s'\n", kobject_name(kobj), kobj, __func__, parent ? kobject_name(parent) : "<NULL>", kset ? kobject_name( & kobj) : "<NULL>")
255  error = create_dir(kobj)
256  If error Then
257  move the kobject from its kset's list
258  kobject_put() - Decrement refcount for object.*@kobj: object.* Decrement the refcount, and if 0, call kobject_cleanup().
259  parent = NULL
262  If error == -EEXIST Then pr_err("%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n", __func__, kobject_name(kobj))
265  Else pr_err("%s failed for %s (error: %d parent: %s)\n", __func__, kobject_name(kobj), error, parent ? kobject_name(parent) : "'none'")
269  Else state_in_sysfs = 1
272  Return error
Caller
NameDescribe
kobject_add_varg
kset_registerkset_register() - Initialize and add a kset.*@k: kset.