Ian Abbott [Tue, 27 Oct 2015 16:59:20 +0000 (16:59 +0000)]
staging: comedi: comedi_test: make timer rate similar to scan rate
The asynchronous command handling for the analog input subdevice uses a
kernel timer which expires approximately `HZ` times a second. However,
it only needs to do anything after each scan period. Set the timer to
expire just after the next scan period.
Although the timer expiry function `waveform_ai_interrupt()` uses
precise time values to generate the fake waveforms used to generate the
data, those time values are constructed in a precise sequence, and do
not depend on the time the timer expiry function is actually called. So
the timer expiry rate does not have to be very precise.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:19 +0000 (16:59 +0000)]
staging: comedi: comedi_test: rename waveform members
Rename the members `struct waveform_private` associated with fake
waveform generation. The affected members are `uvolt_amplitude` -->
`wf_amplitude` (the amplitude of the waveform), `usec_period` -->
`wf_period` (the period of the waveform), and `usec_current` -->
`wf_current` (the current time within a waveform period).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:18 +0000 (16:59 +0000)]
staging: comedi: comedi_test: rename members for AI commands
Rename the members of `struct waveform_private` that are used to handle
AI commands, apart from those members used to control fake waveform
generation. The renames are `timer` --> `ai_timer`, `scan_period` -->
`ai_scan_period`, and `convert_period` --> `ai_convert_period`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:17 +0000 (16:59 +0000)]
staging: comedi: comedi_test: simplify time since last AI scan
The private data structure `struct waveform_private` currently uses
member `last` to remember the time of the last timer interrupt, and the
member `usec_remainder` to keep track of how far into a simulated scan
the interrupt occurred. Replace these with a single new member
`ai_last_scan_time` that records the time of the last scan. This
simplifies the calculation of the number of scans to simulate in the
timer routine, `waveform_ai_interrupt()`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:16 +0000 (16:59 +0000)]
staging: comedi: comedi_test: use unsigned int for waveform timing
Use `unsigned int` instead of `unsigned long` to hold the period of the
fake waveform generator and the current time within each waveform. The
waveform period will be no more than `INT_MAX` and the current time
within the waveform (prior to the modulo operation to bring it actually
within the waveform period) will be no more than `INT_MAX + UINT_MAX /
1000`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:15 +0000 (16:59 +0000)]
staging: comedi: comedi_test: move modulo operations for waveform
The fake waveform generator functions, `fake_sawtooth()` and
`fake_squarewave()`, called from `fake_waveform()`, have a
`current_time` parameter which is the time since the start of a waveform
period. The parameter value may be greater than the waveform period so
they do a modulo operation to bring it into range. Do the modulo
operations outside the functions in `waveform_ai_interrupt()` so that
the waveform generator functions always get a `current_time` parameter
less than the waveform period and do not have to do the modulo operation
themselves. Also, only do the modulo operations when the time since the
start of a waveform exceeds the waveform period. Usually, several
samples are produced in each waveform period and modulo operations are
typically more expensive than a simple comparison.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:14 +0000 (16:59 +0000)]
staging: comedi: comedi_test: support scan_begin_src == TRIG_FOLLOW
It is quite common for COMEDI subdevices that support commands to
support setting `scan_begin_src` to `TRIG_FOLLOW`. This means the next
scan begins once all conversions in the current scan are complete.
Support the following timing combinations for the AI subdevice:
The actual scan period in microseconds is stored in the `scan_period`
member of the private data structure `struct waveform_private`. An
`unsigned int` is still wide enough, because the conversion period is no
more than `UINT_MAX / 1000` microseconds and the number of conversions
is no more than 16 (`N_CHANS * 2`).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 27 Oct 2015 16:59:13 +0000 (16:59 +0000)]
staging: comedi: comedi_test: limit maximum convert_arg
When testing the parameters for setting up an asynchronous command on
the AI subdevice, limit the maximum conversion period
(`cmd->convert_arg`) so that the number of conversions in a scan
(`cmd->scan_end_arg`, same as `cmd->chanlist_len`) multiplied by the
conversion period fits within an `unsigned int`, as that is used to
limit the minimum scan period (`cmd->scan_begin_arg`).
Also ensure rounding of the conversion period and scan period to the
nearest microsecond both fit in an `unsigned int`. Do all this in stage
4 ("fix up any arguments") of the command testing.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The `static const int nano_per_micro` variable is set to 1000, the
number of nanoseconds in a microsecond. Remove it and use the
`NSEC_PER_USEC` macro from <linux/time.h> instead.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
While an asynchronous command is running on the analog input subdevice,
fake waveform generators are connected to each channel to provide the
input voltages that are converted to sample value. Channel 0 is
connected to a sawtooth generator, channel 1 is connected to a
squarewave generator, and the remaining channels are connected to a
flatline generator. The non-flatline generators share the same
amplitude (in microvolts) and period (in microseconds) which are
configured when the COMEDI device is attached. All waveforms are
centered around 0 microvolts and the non-flatline waveforms go between
-amplitude and +amplitude.
It is possible for the waveforms to swing outside the input range of the
channels to which they are connected. When that happens, the sample
values resulting from simulated A-to-D conversion will wrap around due
to integer overflow. Prevent that by clamping the sample values that
would go out of range. This is closer to how a real hardware device
would behave (assuming the input voltage is not high enough to damage
the hardware!).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Christian Gromm [Wed, 28 Oct 2015 14:14:35 +0000 (15:14 +0100)]
staging: most: remove exclusive wait_queue
This patch removes the unnecessary wait_queue that has exclusively been
used for the poll function and its poll_table. Instead, an already
existing one is used.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chaehyun Lim [Tue, 27 Oct 2015 23:19:21 +0000 (08:19 +0900)]
staging: wilc1000: replace u8 with int.
This patch changes data type of variable i from u8 to int.
It is used as index of an array to print its content. It's better
to use as data type of int.
Chaehyun Lim [Tue, 27 Oct 2015 23:19:20 +0000 (08:19 +0900)]
staging: wilc1000: fix parameter name of function declaration
This patch changes struct host_if_drv of host_int_add_wep_key_bss_ap
function declaration from hWFIDrv to hif_drv.
With this change, first parameter name of this function declaration and
definition has same name as hif_drv.
Chaehyun Lim [Tue, 27 Oct 2015 23:19:19 +0000 (08:19 +0900)]
staging: wilc1000: fix return type of host_int_add_wep_key_bss_ap
This patch changes return type of host_int_add_wep_key_bss_ap from s32
to int. The result variable gets return value from wilc_mq_send that has
return type of int. It should be changed return type of this function as
well as data type of result variable.
Chaehyun Lim [Tue, 27 Oct 2015 11:40:33 +0000 (20:40 +0900)]
staging: wilc1000: fix parameter name of function declaration
This patch changes struct host_if_drv of host_int_add_wep_key_bss_sta
function declaration from hWFIDrv to hif_drv.
With this change, first parameter name of this function declaration and
definition has same name as hif_drv.
Chaehyun Lim [Tue, 27 Oct 2015 11:40:32 +0000 (20:40 +0900)]
staging: wilc1000: fix return type of host_int_add_wep_key_bss_sta
This patch changes return type of host_int_add_wep_key_bss_sta from s32
to int. The result variable gets return value from wilc_mq_send that has
return type of int. It should be changed return type of this function
as well as data type of result variable.
Leo Kim [Wed, 28 Oct 2015 06:59:27 +0000 (15:59 +0900)]
staging: wilc1000: rename au8StartTime of struct join_bss_param
This patch renames au8StartTime of struct join_bss_param to start_time
to avoid CamelCase naming convention.
Signed-off-by: Leo Kim <leo.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the checks reported by checkpatch.pl
for Blank lines aren't necessary after an open brace '{' and
Blank lines aren't necessary before a close brace '}'.
Signed-off-by: Leo Kim <leo.kim@atmel.com> Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tony Cho [Wed, 28 Oct 2015 08:43:27 +0000 (17:43 +0900)]
staging: wilc1000: change MAINTAINERS
This patch removes Rachel Kim from the MAINTAINERS list because she
retires from her position and adds Austin shin as new MAINTAINER for
the Atmel wireless link controller: WILC1000 and WILC3000.
Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch removes goto statement and moves the spin lock position.
If a memory allocation fails, directly returns an error.
The spin lock actually protects the pHandle. Therefore, call spin lock just
before pHandle is used.
Signed-off-by: Leo Kim <leo.kim@atmel.com> Signed-off-by: Tony Cho <tony.cho@atmel.com> Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Tue, 27 Oct 2015 09:27:45 +0000 (18:27 +0900)]
staging: wilc1000: wlan_initialize_threads: change argument with net_device
This patch changes function argument with net_device and use netdev private
data member wilc instead of g_linux_wlan. And there are assignment code with
different value continuously. Take last code.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Tue, 27 Oct 2015 09:27:40 +0000 (18:27 +0900)]
staging: wilc1000: wilc_handle_isr: add argument wilc to wilc_handle_isr
This patch add new argument wilc to wilc_handle_isr and pass wilc to
the function.
It is void type for now because wilc_wlan.c was implemented platform
independently at the beginning (linux_wlan.c is implementation of LINUX part),
so the header file which defines struct wilc cannot be included at this moment,
but this driver is dedicated to LINUX so wilc_wlan.c and linux_wlan.c will be
merged. After that, this void type will be changed with struct wilc as well as
other functions which are using void type in wilc_wlan.h.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Tue, 27 Oct 2015 09:27:37 +0000 (18:27 +0900)]
staging: wicl1000: isr_uh_routine: use netdev private wilc
Use netdev private member wilc instead of g_linux_wlan and change argument wilc
with dev in the function request_threaded_irq to pass back to handler
the function isr_uh_routine.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Glen Lee [Tue, 27 Oct 2015 09:20:14 +0000 (18:20 +0900)]
staging: wilc1000: fix build error on SPI
wilc_netdev_init function has parameters to pass but no argument is passed
when bus type SPI is selected. Which causes build error.
This patch passes argument &wilc to the function wilc_netdev_init.
Signed-off-by: Glen Lee <glen.lee@atmel.com> Fixes: 12ba5416dc77 ("staging: wilc1000: assign pointer of g_linux_wlan to sdio device data") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Wed, 28 Oct 2015 16:54:28 +0000 (12:54 -0400)]
staging: lustre: cleanup over 80 characters in libcfs_hash.h
Fix up all the over 80 character line issues in libcfs_hash.h
reported by checkpatch.pl. At the same time update this header
to match what is in the OpenSFS lustre branch.
Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>