Name

class_find_child — device iterator for locating a particular class_device

Synopsis

struct class_device * class_find_child (struct class * class,
 void * data,
 int (*match) (struct class_device *, void *));
 

Arguments

class

the class we're iterating

data

data for the match function

match

function to check class_device

Description

This function returns a reference to a class_device that is 'found' for later use, as determined by the match callback.

The callback should return 0 if the class_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 class_devices.

Note, you will need to drop the reference with class_device_put after use.

We hold class->sem in this function, so it can not be re-acquired in match, otherwise it will self-deadlocking. For example, calls to add or remove class members would be verboten.