---
name: "class_find_device"
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/class_find_device"
---

# class\_find\_device(9)

device iterator for locating a particular device

## NAME

class\_find\_device - device iterator for locating a particular device

## SYNOPSIS

**struct device \* class\_find\_device(struct class \*** *class***, struct device \*** *start***, const void \*** *data***, int (\****match***) (struct device \*, const void \*));**

## ARGUMENTS

*class*

the class we're iterating

*start*

Device to begin with

*data*

data for the match function

*match*

function to check device

## DESCRIPTION

This is similar to the **class\_for\_each\_dev** function above, but it returns a reference to a device that is 'found' for later use, as determined by the *match* callback.

The callback should return 0 if the device doesn't 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.

Note, you will need to drop the reference with **put\_device** after use.

*fn* is allowed to do anything including calling back into class code. There's no locking restriction.

## COPYRIGHT
