'\" t .\" Title: bus_for_each_dev .\" 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 "BUS_FOR_EACH_DEV" "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" bus_for_each_dev \- device iterator\&. .SH "SYNOPSIS" .HP \w'int\ bus_for_each_dev('u .BI "int bus_for_each_dev(struct\ bus_type\ *\ " "bus" ", struct\ device\ *\ " "start" ", void\ *\ " "data" ", int\ (*" "fn" ")\ (struct\ device\ *,\ void\ *));" .SH "ARGUMENTS" .PP \fIbus\fR .RS 4 bus type\&. .RE .PP \fIstart\fR .RS 4 device to start iterating from\&. .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 \fIbus\fR\*(Aqs list of devices, and call \fIfn\fR for each, passing it \fIdata\fR\&. If \fIstart\fR is not NULL, we use that device to begin iterating from\&. .PP We check the return of \fIfn\fR each time\&. If it returns anything other than 0, we break out and return that value\&. .SH "NOTE" .PP The device that returns a non\-zero value is not retained in any way, nor is its refcount incremented\&. If the caller needs to retain this data, it should do so, and increment the reference count in the supplied callback\&. .SH "COPYRIGHT" .br