Name

class_for_each_device — device iterator

Synopsis

int class_for_each_device (struct class *  class,
 void *  data,
 int (* fn(struct device *, void *));

Arguments

class

the class we're iterating

data

data for the callback

fn

function to be called for each device

Description

Iterate over class's list of devices, and call fn for each, passing it data.

We check the return of fn each time. If it returns anything other than 0, we break out and return that value.

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