Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75729
b: refs/heads/master
c: c11c415
h: refs/heads/master
i:
  75727: a2c308e
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jan 25, 2008
1 parent 5689e16 commit 2d6ec2b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 244f6cee9a928103132a722292bfa0eb84114b07
refs/heads/master: c11c4154e7ff4cebfadad849b1e22689d759c3f4
5 changes: 5 additions & 0 deletions trunk/include/linux/kobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ extern int __must_check kobject_add(struct kobject *);
extern int __must_check kobject_add_ng(struct kobject *kobj,
struct kobject *parent,
const char *fmt, ...);
extern int __must_check kobject_init_and_add(struct kobject *kobj,
struct kobj_type *ktype,
struct kobject *parent,
const char *fmt, ...);

extern void kobject_del(struct kobject *);

extern int __must_check kobject_rename(struct kobject *, const char *new_name);
Expand Down
27 changes: 27 additions & 0 deletions trunk/lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,33 @@ int kobject_add_ng(struct kobject *kobj, struct kobject *parent,
}
EXPORT_SYMBOL(kobject_add_ng);

/**
* kobject_init_and_add - initialize a kobject structure and add it to the kobject hierarchy
* @kobj: pointer to the kobject to initialize
* @ktype: pointer to the ktype for this kobject.
* @parent: pointer to the parent of this kobject.
* @fmt: the name of the kobject.
*
* This function combines the call to kobject_init_ng() and
* kobject_add_ng(). The same type of error handling after a call to
* kobject_add_ng() and kobject lifetime rules are the same here.
*/
int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype,
struct kobject *parent, const char *fmt, ...)
{
va_list args;
int retval;

kobject_init_ng(kobj, ktype);

va_start(args, fmt);
retval = kobject_add_varg(kobj, parent, fmt, args);
va_end(args);

return retval;
}
EXPORT_SYMBOL_GPL(kobject_init_and_add);

/**
* kobject_rename - change the name of an object
* @kobj: object in question.
Expand Down

0 comments on commit 2d6ec2b

Please sign in to comment.