The hardware_device member of comedi_file_info is not set in this
function. Use kzalloc to make sure this pointer does not contain
invalid data.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use comedi_dev_from_minor() to simplify the return -ENODEV tests.
Change the (foo == NULL) tests to simply (!foo).
Use a local variable to hold a pointer to the async->buf_page_list[]
when doing the remap_pfn_range(). This cleans up the ugly line breaks
for the page_to_pfn(virt_to_page(...) operation.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Flip the info->device tests so than the return NULL occurs last.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Introduce, and use, a helper to check the subdevice runflags to see if
it is not in error and not running.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Introduce, and use, a helper to check the subdevice runflags to see if
the SRF_ERROR flag is set.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The subdevice runflags are protected with a spin_lock. Only the comedi
core should be accessing them directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use the helper function comedi_is_subdevice_running() instead of getting
the subdevice runflags and then masking the result.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Introduce a helper function that checks the subdevice runflags to
see if the subdevice is running a command.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, move this function so its near
comedi_set_subdevice_runflags().
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As mentioned in CodingStyle, the prefered form is:
p = kmalloc(sizeof(*p), ...);
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This function is only called by the module_{init,exit} functions. For
aesthetic reasons, move it near them.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, move the module_{init,exit} functions to the end
of the file.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, move the MODULE_* information to the end of
the file.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use comedi_dev_from_minor() to simplify the return -ENODEV tests.
Cleanup the sanity checking a bit and remove the need for the goto's
when returning an initial error condition.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use comedi_dev_from_minor() to simplify the return -ENODEV tests.
Cleanup the sanity checking a bit and remove the need for the goto's
when returning an initial error condition.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Consolidate the local variables 'read_subdev' and 'write_subdev' into a
single local variable 's'.
Use comedi_dev_from_minor() to simplify the return -ENODEV tests.
Use a goto in the !dev->attached test so that the mutex_unlock() call
is in a common place.
Cleanup the formating of the || in the read and write subdevice poll
code.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Consolidate the local variables 'read_subdev' and 'write_subdev' into a
single local variable 's'.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The 'get' usually implies increasing a reference count of an object.
These function return a pointer but do not do any reference counting.
For aesthetic reasons, rename the functions to better represent what
they do.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The 'get' usually implies increasing a reference count of an object.
This function returns a pointer but does not do any reference counting.
For aesthetic reasons, rename the function to better represent what
its doing.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, rename this struct to comedi_file_info. It's
a bit shorter and allows fixing some of the ugly line breaks used
to keep the lines < 80 chars.
Also, consistently use the local variable name 'info' instead of the
longer 'dev_file_info' to also fix some ugly line breaks.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This structure is only used in comedi_fops.c as part of handling
the file operations and sysfs files. Remove it's defenition from
comedidev.h so it's not exposed to the comedi drivers.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This function is now only used in comedi_fops.c and does not need
to be exported.
Make it static and move it to avoid forward declarations.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove the need to export comedi_get_device_file_info() by using the
new helper comedi_dev_from_minor(). This will also allow us to make
the comedi_device_file_info struct private.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A number of functions have to call comedi_get_device_file_info()
to get the comedi_device_file_info pointer for a given minor. That
pointer is only used to get the actual comedi_device pointer for
the minor.
Introduce a new helper function, comedi_dev_from_minor(), to simplify
this operation. This will also allow us to make the comedi_device_file_info
struct private.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
These two inline helper function in comedidev.h are only used in
comedi_fops.c. They return information that should only be used
by the comedi core.
Move both functions to comedi_fops.c so they aren't exposed to
the comedi drivers. Also, remove the inline tag and let the
compiler figure it out.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Move a couple of the functions to remove the need for the forward
declarations.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This module is built whenever CONFIG_COMEDI is enabled but it is
only used by the pcmmio and pcmuio drivers. The pcm_common module
consists of one exported function. Put a local copy of the function
in the pcmmio and pcmuio drivers.
This removes the need for the pcm_common module and the now unused
pcm_common.[ch] files can be deleted and removed from the Makefile.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When setting up asynchronous commands on the special interrupt
subdevice, support the `TRIG_COUNT` stop source to allow the command to
stop automatically after a specified number of scans.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Initialize the special interrupt subdevice as a digital input subdevice
even if the interrupt handler cannot be registered. It's `insn_bits`
handler will still read the interrupt status register. This hardware
status bits in this register might be valid even if they haven't been
enabled in the interrupt control register, but this needs to be checked.
In any case, initializing the subdevice as a digital input subdevice is
harmless.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When setting up asynchronous commands for the special interrupt
subdevice, use the channel list to decide which interrupt sources to
enable. Set the maximum length of the channel list to be the same as
the number of channels (2). Normally, the channel list would include
channel 0, channel 1 or both.
When reading the scan data in the interrupt routine, the readings from
each channel in the channel list will be packed into a single unsigned
short data value. Make each bit in this value correspond to an index in
the channel list.
Since all the channels in the channel list are read at the same time,
insist that the scan end argument is the length of the channel list and
that the conversion source is `TRIG_NOW`.
Allocate some private data for the special interrupt subdevice to hold a
spin-lock, the channels to be enabled and an indication of whether the
command is still active. Stop the command if a buffer overflow occurs.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The interrupt handler disables all interrupt sources when a valid
interrupt occurs. Just disable the triggered interrupt source so we can
still get interrupts for the other interrupt source.
Also add a comment indicating why the triggered interrupt source is
disabled. The interrupt sources are level-sensitive and indicate
hardware errors that are likely to be persistent, so if we reenabled
them they would just keep triggering repeatedly.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The `insn_bits` handler for the special digital input subdevice used for
interrupts currently uses `s->state` for the data value, which is set to
the value of the APCI2032_INT_STATUS_REG register when a valid interrupt
occurs. Just read the live register contents in the `insn_bits` handler
instead of relying on the interrupt service routine to read it for us.
The register contains a couple of hardware error status bits. They
might also be valid even when the corresponding bits have not been
enabled in the APCI_INT_CTRL_REG register in which case this would be
useful for checking for hardware errors without using interrupts, but
this needs to be checked.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If the call to `comedi_buf_put()` fails in the interrupt routine, set
the `COMEDI_CB_OVERFLOW` event flag. Note that the `COMEDI_CB_ERROR`
flag will have also been set by `comedi_buf_put()` in this case.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The subdevice type and flags are initialized incorrectly for the
interrupt subdevice - the SDF_CMD_READ value belongs in the subdevice
flags. Fix it. Also set the number of channels to 2 since there are 2
interrupt sources each with its own status bit.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Put the hardware into a safe state before enabling the interrupt. In
the interrupt routine, check the device has been fully configured by
checking `dev->attached`. In particular, `dev->read_subdev` could be
NULL early on and although the hardware's status register should
indicate no interrupt has occurred (since it's been put into a safe
state), it's better not to rely on it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Turn static some symbols which do not actually need to be
externally-visible
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This prefixes all externally-visible symbols of speakup with "spk_".
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use register name defines instead of magic numbers where a bit of
clarity would be useful.
Also a small typo fix and some register prefixes added, for further
clarity.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Several magic numbers were used to represent rxdma csr register bitmasks.
Replace them with descriptive defines.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
we should check the return value of calling function fir16_create(): a NULL
value means the memory allocation fails.
this patch also cleans up the error handling in function function oslec_create()
Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In uf_send_pkt_to_encrypt(), the memory area zeroed by this call to memset() is
overwritten by a call to memcpy() a few instructions later, so it is not needed.
Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
line6_send_sysex_message_async() isn't called from anywhere.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Johannes Thumshirn <morbidrsa@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: line6: driver.c
The semantic patch that makes this output is available
in scripts/coccinelle/api/memdup.cocci.
Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fix those checkpatch issues
drivers/staging/line6/pcm.c:84:
WARNING: simple_strtoul is obsolete, use kstrtoul instead
call to obsolete simple_strtoul() replaced by kstrtoint()
drivers/staging/line6/pcm.c:423:
ERROR: switch and case should be at the same indent
realigns comments
Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed a coding style issue. Fixed positions
of braces regarding to linux coding style.
Signed-off-by: Kurt Kanzenbach <shifty91@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed a coding style issue. Replaced all
c99 comments by c89 ones and deleted
commented out code.
Signed-off-by: Kurt Kanzenbach <shifty91@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the checkpatch error "do not initialize statics to 0 or NULL"
Signed-off-by: Sebastian Hahn <snsehahn@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the checkpatch error "switch and case should be at the same indent"
Signed-off-by: Sebastian Hahn <snsehahn@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>