Commit 76668830 authored by Federico Vaga's avatar Federico Vaga

__get_n_chan_enabled: return the number of active channels on a cset

Signed-off-by: 's avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 622ba78f
......@@ -203,6 +203,20 @@ static inline struct zio_channel *__first_enabled_chan(struct zio_cset *cset,
(cptr = __first_enabled_chan(cset, cptr)); \
cptr++)
/*
* Return the number of enabled channel on a cset. Be careful: device
* spinlock must be taken before invoke this function and it can be released
* after the complete consumption of the information provided by this function
*/
static inline unsigned int __get_n_chan_enabled(struct zio_cset *cset) {
struct zio_channel *chan;
unsigned int n_chan = 0;
cset_for_each(cset, chan)
++n_chan;
return n_chan;
}
/* We suggest all drivers have these options */
#define ZIO_PARAM_TRIGGER(_name) \
char *_name; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment