'\" t .\" Title: class_for_each_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_FOR_EACH_DEVIC" "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_for_each_device \- device iterator .SH "SYNOPSIS" .HP \w'int\ class_for_each_device('u .BI "int class_for_each_device(struct\ class\ *\ " "class" ", struct\ device\ *\ " "start" ", void\ *\ " "data" ", int\ (*" "fn" ")\ (struct\ device\ *,\ void\ *));" .SH "ARGUMENTS" .PP \fIclass\fR .RS 4 the class we\*(Aqre iterating .RE .PP \fIstart\fR .RS 4 the device to start with in the list, if any\&. .RE .PP \fIdata\fR .RS 4 data for the callback .RE .PP \fIfn\fR .RS 4 function to be called for each device .RE .SH "DESCRIPTION" .PP Iterate over \fIclass\fR\*(Aqs list of devices, and call \fIfn\fR for each, passing it \fIdata\fR\&. If \fIstart\fR is set, the list iteration will start there, otherwise if it is NULL, the iteration starts at the beginning of the list\&. .PP We check the return of \fIfn\fR each time\&. If it returns anything other than 0, we break out and return that value\&. .PP \fIfn\fR is allowed to do anything including calling back into class code\&. There\*(Aqs no locking restriction\&. .SH "COPYRIGHT" .br