'\" t .\" Title: device_add .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: Device drivers infrastructure .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "DEVICE_ADD" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Device drivers infrastructure" .\" ----------------------------------------------------------------- .\" * 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" device_add \- add device to device hierarchy\&. .SH "SYNOPSIS" .HP \w'int\ device_add('u .BI "int device_add(struct\ device\ *\ " "dev" ");" .SH "ARGUMENTS" .PP \fIdev\fR .RS 4 device\&. .RE .SH "DESCRIPTION" .PP This is part 2 of \fBdevice_register\fR, though may be called separately _iff_ \fBdevice_initialize\fR has been called separately\&. .PP This adds \fIdev\fR to the kobject hierarchy via \fBkobject_add\fR, adds it to the global and sibling lists for the device, then adds it to the other relevant subsystems of the driver model\&. .PP Do not call this routine or \fBdevice_register\fR more than once for any device structure\&. The driver model core is not designed to work with devices that get unregistered and then spring back to life\&. (Among other things, it\*(Aqs very hard to guarantee that all references to the previous incarnation of \fIdev\fR have been dropped\&.) Allocate and register a fresh new struct device instead\&. .SH "NOTE" .PP _Never_ directly free \fIdev\fR after calling this function, even if it returned an error! Always use \fBput_device\fR to give up your reference instead\&. .SH "COPYRIGHT" .br