'\" t .\" Title: device_create .\" 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_CREATE" "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_create \- creates a device and registers it with sysfs .SH "SYNOPSIS" .HP \w'struct\ device\ *\ device_create('u .BI "struct device * device_create(struct\ class\ *\ " "class" ", struct\ device\ *\ " "parent" ", dev_t\ " "devt" ", void\ *\ " "drvdata" ", const\ char\ *\ " "fmt" ", " "\&.\&.\&." ");" .SH "ARGUMENTS" .PP \fIclass\fR .RS 4 pointer to the struct class that this device should be registered to .RE .PP \fIparent\fR .RS 4 pointer to the parent struct device of this new device, if any .RE .PP \fIdevt\fR .RS 4 the dev_t for the char device to be added .RE .PP \fIdrvdata\fR .RS 4 the data to be added to the device for callbacks .RE .PP \fIfmt\fR .RS 4 string for the device\*(Aqs name .RE .PP \fI\&.\&.\&.\fR .RS 4 variable arguments .RE .SH "DESCRIPTION" .PP This function can be used by char device classes\&. A struct device will be created in sysfs, registered to the specified class\&. .PP A \(lqdev\(rq file will be created, showing the dev_t for the device, if the dev_t is not 0,0\&. If a pointer to a parent struct device is passed in, the newly created struct device will be a child of that device in sysfs\&. The pointer to the struct device will be returned from the call\&. Any further sysfs files that might be required can be created using this pointer\&. .PP Returns struct device pointer on success, or \fBERR_PTR\fR on error\&. .SH "NOTE" .PP the struct class passed to this function must have previously been created with a call to \fBclass_create\fR\&. .SH "COPYRIGHT" .br