'\" t .\" Title: bus_for_each_drv .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Device drivers infrastructure .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "BUS_FOR_EACH_DRV" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "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_drv \- driver iterator .SH "SYNOPSIS" .HP \w'int\ bus_for_each_drv('u .BI "int bus_for_each_drv(struct\ bus_type\ *\ " "bus" ", struct\ device_driver\ *\ " "start" ", void\ *\ " "data" ", int\ (*" "fn" ")\ (struct\ device_driver\ *,\ void\ *));" .SH "ARGUMENTS" .PP \fIbus\fR .RS 4 bus we\*(Aqre dealing with\&. .RE .PP \fIstart\fR .RS 4 driver to start iterating on\&. .RE .PP \fIdata\fR .RS 4 data to pass to the callback\&. .RE .PP \fIfn\fR .RS 4 function to call for each driver\&. .RE .SH "DESCRIPTION" .PP This is nearly identical to the device iterator above\&. We iterate over each driver that belongs to \fIbus\fR, and call \fIfn\fR for each\&. If \fIfn\fR returns anything but 0, we break out and return it\&. If \fIstart\fR is not NULL, we use it as the head of the list\&. .SH "NOTE" .PP we don\*(Aqt return the driver that returns a non\-zero value, nor do we leave the reference count incremented for that driver\&. If the caller needs to know that info, it must set it in the callback\&. It must also be sure to increment the refcount so it doesn\*(Aqt disappear before returning to the caller\&. .SH "COPYRIGHT" .br