'\" t .\" Title: kobject_add .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Driver Basics .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "KOBJECT_ADD" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "Driver Basics" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" kobject_add \- the main kobject add function .SH "SYNOPSIS" .HP \w'int\ kobject_add('u .BI "int kobject_add(struct\ kobject\ *\ " "kobj" ", struct\ kobject\ *\ " "parent" ", const\ char\ *\ " "fmt" ", " "\&.\&.\&." ");" .SH "ARGUMENTS" .PP \fIkobj\fR .RS 4 the kobject to add .RE .PP \fIparent\fR .RS 4 pointer to the parent of the kobject\&. .RE .PP \fIfmt\fR .RS 4 format to name the kobject with\&. .RE .PP \fI\&.\&.\&.\fR .RS 4 variable arguments .RE .SH "DESCRIPTION" .PP The kobject name is set and added to the kobject hierarchy in this function\&. .PP If \fIparent\fR is set, then the parent of the \fIkobj\fR will be set to it\&. If \fIparent\fR is NULL, then the parent of the \fIkobj\fR will be set to the kobject associated with the kset assigned to this kobject\&. If no kset is assigned to the kobject, then the kobject will be located in the root of the sysfs tree\&. .PP If this function returns an error, \fBkobject_put\fR must be called to properly clean up the memory associated with the object\&. Under no instance should the kobject that is passed to this function be directly freed with a call to \fBkfree\fR, that can leak memory\&. .PP Note, no \(lqadd\(rq uevent will be created with this call, the caller should set up all of the necessary sysfs files for the object and then call \fBkobject_uevent\fR with the UEVENT_ADD parameter to ensure that userspace is properly notified of this kobject\*(Aqs creation\&. .SH "COPYRIGHT" .br