diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-06-19 15:24:36 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-24 15:46:56 -0700 |
commit | 0480bcb9fb5e279df9d39f21bb0e87ab15b5092a (patch) | |
tree | 46fc47b3121ee4355f780bfcf570f4e7c02d5ad9 /drivers/staging/comedi/comedidev.h | |
parent | 2eb226dcedd0257ae0d712f0c0c0c35de24465ea (diff) |
staging: comedi: have comedi_set_spriv() allocate the memory
As suggested by Ian Abbott, comedi_set_spriv() can only be used to
set the subdevice->private pointer to something that can be kfree()'d.
Rename the function to comedi_alloc_spriv() and have it kzalloc() the
memory as well as set the private pointer. This saves a function call
in the drivers and avoids the possibility of incorrectly calling
comedi_set_spriv() for some pointer that is not meant to be kfree()'d.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r-- | drivers/staging/comedi/comedidev.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index e8dc7af8f5a..b75915f30f4 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -270,7 +270,8 @@ enum subdevice_runflags { }; bool comedi_is_subdevice_running(struct comedi_subdevice *s); -void comedi_set_spriv(struct comedi_subdevice *s, void *data); + +void *comedi_alloc_spriv(struct comedi_subdevice *s, size_t size); int comedi_check_chanlist(struct comedi_subdevice *s, int n, |