'\" t .\" Title: device_register .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Device drivers infrastructure .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "DEVICE_REGISTER" "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_register \- register a device with the system\&. .SH "SYNOPSIS" .HP \w'int\ device_register('u .BI "int device_register(struct\ device\ *\ " "dev" ");" .SH "ARGUMENTS" .PP \fIdev\fR .RS 4 pointer to the device structure .RE .SH "DESCRIPTION" .PP This happens in two clean steps \- initialize the device and add it to the system\&. The two steps can be called separately, but this is the easiest and most common\&. I\&.e\&. you should only call the two helpers separately if have a clearly defined need to use and refcount the device before it is added to the hierarchy\&. .PP For more information, see the kerneldoc for \fBdevice_initialize\fR and \fBdevice_add\fR\&. .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 the reference initialized in this function instead\&. .SH "COPYRIGHT" .br