---
name: "bus_for_each_drv"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/bus_for_each_drv"
---

# bus\_for\_each\_drv(9)

driver iterator

## NAME

bus\_for\_each\_drv - driver iterator

## SYNOPSIS

**int bus\_for\_each\_drv(struct bus\_type \*** *bus***, struct device\_driver \*** *start***, void \*** *data***, int (\****fn***) (struct device\_driver \*, void \*));**

## ARGUMENTS

*bus*

bus we're dealing with.

*start*

driver to start iterating on.

*data*

data to pass to the callback.

*fn*

function to call for each driver.

## DESCRIPTION

This is nearly identical to the device iterator above. We iterate over each driver that belongs to *bus*, and call *fn* for each. If *fn* returns anything but 0, we break out and return it. If *start* is not NULL, we use it as the head of the list.

## NOTE

we don't 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't disappear before returning to the caller.

## COPYRIGHT
