'\" t .\" Title: class_find_device .\" 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 "CLASS_FIND_DEVICE" "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" class_find_device \- device iterator for locating a particular device .SH "SYNOPSIS" .HP \w'struct\ device\ *\ class_find_device('u .BI "struct device * class_find_device(struct\ class\ *\ " "class" ", struct\ device\ *\ " "start" ", const\ void\ *\ " "data" ", int\ (*" "match" ")\ (struct\ device\ *,\ const\ void\ *));" .SH "ARGUMENTS" .PP \fIclass\fR .RS 4 the class we\*(Aqre iterating .RE .PP \fIstart\fR .RS 4 Device to begin with .RE .PP \fIdata\fR .RS 4 data for the match function .RE .PP \fImatch\fR .RS 4 function to check device .RE .SH "DESCRIPTION" .PP This is similar to the \fBclass_for_each_dev\fR function above, but it returns a reference to a device that is \*(Aqfound\*(Aq for later use, as determined by the \fImatch\fR callback\&. .PP The callback should return 0 if the device doesn\*(Aqt match and non\-zero if it does\&. If the callback returns non\-zero, this function will return to the caller and not iterate over any more devices\&. .PP Note, you will need to drop the reference with \fBput_device\fR after use\&. .PP \fImatch\fR is allowed to do anything including calling back into class code\&. There\*(Aqs no locking restriction\&. .SH "COPYRIGHT" .br