diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-06-06 14:17:02 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-11 23:54:28 (GMT) |
commit | 4e2f002f7a9b316640eb06ef6df767f017e3e7b1 (patch) | |
tree | 3853091cebac9504fc9559edd0937f3882d38164 | |
parent | 4bfa9b2ee16e73087435ac64a35f32140a385438 (diff) | |
download | linux-fsl-qoriq-4e2f002f7a9b316640eb06ef6df767f017e3e7b1.tar.xz |
staging: comedi: describe comedi_recognize()
Add a comment to comedi_recognize() to describe what it does as it's a
bit confusing.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 9d2b206..49e53ea 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -300,8 +300,32 @@ static int postconfig(struct comedi_device *dev) return 0; } -/* generic recognize function for drivers - * that register their supported board names */ +/* + * Generic recognize function for drivers that register their supported + * board names. + * + * 'driv->board_name' points to a 'const char *' member within the + * zeroth element of an array of some private board information + * structure, say 'struct foo_board' containing a member 'const char + * *board_name' that is initialized to point to a board name string that + * is one of the candidates matched against this function's 'name' + * parameter. + * + * 'driv->offset' is the size of the private board information + * structure, say 'sizeof(struct foo_board)', and 'driv->num_names' is + * the length of the array of private board information structures. + * + * If one of the board names in the array of private board information + * structures matches the name supplied to this function, the function + * returns a pointer to the pointer to the board name, otherwise it + * returns NULL. The return value ends up in the 'board_ptr' member of + * a 'struct comedi_device' that the low-level comedi driver's + * 'attach()' hook can convert to a point to a particular element of its + * array of private board information structures by subtracting the + * offset of the member that points to the board name. (No subtraction + * is required if the board name pointer is the first member of the + * private board information structure, which is generally the case.) + */ static void *comedi_recognize(struct comedi_driver *driv, const char *name) { char **name_ptr = (char **)driv->board_name; |