staging: comedi: ni_stc.h: remove read/write callbacks from ni_private
The drivers that include ni_mio_common.c set the read/write callbacks
to private functions that handle the read/write operations in the
correct manner for the hardware. The ni_atmio and ni_mio_cs drivers
use ioport register access and the ni_pcimio driver uses memory mapped
register access. The memory mapped base address is stored in the 'mite'
pointer in the private data which is only allocated and initialized by
the ni_pcimio driver.
Detect the need for memory mapped register access by checking if the
'mite' pointer is set in the private data and remove the callbacks
from the private 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>
staging: comedi: ni_mio_common.c: wrap the read/write operations
The ni_atmio, ni_pcimio, and ni_mio_cs drivers all include this source
file to handle the common functionality of the drivers. Each of those
drivers set some function pointers in the private data to handle the
read/write operations to the normal registers.
Like done for the stc register operations, wrap these operations with
some helper functions to clarify the code a bit and make it easier to
read and maintain.
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>
staging: comedi: ni_mio_common.c: wrap the stc_read/write operations
The ni_atmio, ni_pcimio, and ni_mio_cs drivers all include this source
file to handle the common functionality of the drivers. Each of those
drivers set some function pointers in the private data to handle the
read/write operations to the stc registers.
Wrap these operations with some helper functions to clarify the code
a bit and make it easier to read and maintain.
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>
staging: comedi: ni_stc.h: add a 'is_m_series' flag to private data
The (board->reg_type & ni_reg_m_series_mask) test is commonly used
in ni_mio_common.c to detect if the driver is being used with a
National Instruments "M series" DAQ board. Simplify the code a bit
by adding an 'is_m_series' bit-field flag to the private 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>
Jes Sorensen [Thu, 19 Jun 2014 09:37:29 +0000 (11:37 +0200)]
staging: rtl8723au: issue_probersp(): Do not copy the IEs in front of probe_resp data
Another case where the driver was copying IEs in front of the
probe_resp data in the management frame, when running in AP mode. This
would result in badly corrupted frames hitting the wire - ouf ouf ouf!
Jes Sorensen [Thu, 19 Jun 2014 09:37:27 +0000 (11:37 +0200)]
staging: rtl8723au: issue_beacon23a(): Do not copy IEs in front of beacon data
Not sure how this happened, but one should never copy the IEs in front
of the beacon frame info. This could lead to some nasty corrupted
beacon frames hitting the wire if running AP mode - ouf!
Jes Sorensen [Thu, 19 Jun 2014 09:37:24 +0000 (11:37 +0200)]
staging: rtl8723au: Update bss beacon info in rtw_add_beacon()
Pull out the core info beacon_interval, capability, and tsf and update
cur_network.network with the info in rtw_add_beacon() instead of
relying on it being in ->IEs.
This will help later when getting rid of the beacon struct info from
->IEs and only carrying the actual IEs there.
Jes Sorensen [Thu, 19 Jun 2014 09:37:17 +0000 (11:37 +0200)]
staging: rtl8723au: rtw_cfg80211_inform_bss(): Use cfg80211_inform_bss()
There is no point in creating a fake beacon frame to call
cfg80211_inform_bss_frame() when we can just call
cfg80211_inform_bss() with the parameters we were sticking into the
fake frame.
Merge tag 'iio-for-3.17a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of new drivers, cleanups and functionality for the 3.17 cycle.
New drivers
* t5403 barometric pressure sensor
* kxcjk1013 accelerometer (with a locking followup fix).
* ak09911 digital compass
Documentation
* ABI docs for proximity added (interface has been there a long time but
somehow snuck through without being documented)
* Move iio-trig-sysfs documentation out of staging (got left behind when
the driver moved some time ago).
Cleanups
* drop the timestamp argument from iio_trigger_poll(_chained) as
nothing has been done with it for some time.
* ad799x kerneldoc for ad799x_chip brought up to date.
* replace a number of reimplementations of the GENMASK macro and
use the BIT macro to cleanup a few locations.
* bring the iio_event_monitor example program up to date with new
device types.
* fix some incorrect function prototypes in iio_utils.h example code.
* INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED fix in docs. This
got left behind after we renamed it a long time back.
* fix error handling in the generic_buffer example program.
* small tidy ups in the iio-trig-periodic-rtc driver.
* Allow reseting iio-trig-periodic-rtc frequency to 0 (default) after
it has changed.
* Trivial tidy ups in coding style in iio_simply_dummy
fixed: WARNING: line over 80 characters, used a new variable 'size_index' to
store the offset. Replaced "unsigned long" with "loff_t" type for
'cur_index'. Removed the parenthesis around the second part of the if statement following the '||' as its not required.
Scott Weir [Mon, 16 Jun 2014 10:44:51 +0000 (20:44 +1000)]
staging: lustre: Fix sparse warnings for undeclared symbols
This patch fixes the sparse warnings in drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c:
sec_lproc.c:58:6: warning: symbol 'sec_flags2str' was not declared. Should it be static?
Signed-off-by: Scott Weir <sjw0410@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vitaly Osipov [Sat, 14 Jun 2014 07:29:51 +0000 (17:29 +1000)]
staging: lustre: remove memset(0) after LIBCFS_ALLOC
Joe Perches mentioned on driverdev-devel that memset after LIBCFS_ALLOC
is not necessary as it is already done during LIBCFS_ALLOC_POST. This
commit removes these unnecessary memsets. Based on the results of running
a cocci patch along the lines of:
John Church [Mon, 2 Jun 2014 13:31:10 +0000 (14:31 +0100)]
staging: lustre: fix sparse warnings for undeclared symbols
This patch fixes the following sparse warnings for drivers/staging/lustre/lnet/lnet/router.c:
router.c:139:1: warning: symbol 'lnet_ni_notify_locked' was not declared. Should it be static?
router.c:277:1: warning: symbol 'lnet_add_route_to_rnet' was not declared. Should it be static?
Signed-off-by: John Church <sleeveroller@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Julia Lawall [Wed, 4 Jun 2014 09:07:54 +0000 (11:07 +0200)]
staging: tidspbridge: use safer test on the result of find_first_zero_bit
Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
staging: tidspbridge: pmgr: dspapi.c: Cleaning up uninitialized variable
There is a risk that the variables will be used without being initialized.
Has also improved error handling, after an email proposal from Dan Carpenter.
staging: comedi: ni_stc.h: add read/write callbacks to struct ni_private
The {read,write}[bwl] macros used to access the registers in the ni_atmio,
ni_mio_cs, and ni_pcimio drivers and the included ni_mio_common.c file all
rely on a local variable having a specific name. They also require some of
the ni_mio_common code to need a __maybe_unused tag on the devpriv local
variable.
Remove all the macros by converting them into private functions and storing
the callbacks in the private data.
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>
This macro is used to create the private data structure that is used by
the ni_atmio, ni_mio_cs, and ni_pcimio drivers. These drivers all include
the ni_mio_common.c source to provide most of the driver functionality.
The only driver specific information needed to convert the macro into a
proper struct definition is the MAX_N_CALDACS define. This define is used
to size a couple array members in the struct. The ni_atmio and ni_mio_cs
drivers both define MAX_N_CALDACS as 32. The ni_pcimio driver defines it
as (16+16+2). The ni_mio_common file only uses this define to sanity check
that the struct members are large enough for the number of channels in
the calibration subdevice.
Move the MAX_N_CALDACS define to ni_stc.h and set it to the largest number
of caldacs (34).
The ni_atmio and ni_mio_cs drivers also add one additional member to the
private data struct before using the NI_PRIVATE_COMMON macro.
For the ni_atmio driver, the struct pnp_dev pointer can be saved in the
comedi_device as the 'hw_dev'. The (*detach) of this driver can then use
to_pnp_dev() to get it back when detaching the pnp device.
In the ni_mio_cs driver, the struct pcmia_device pointer is not used so
it can simply be removed.
The NI_PRIVATE_COMMON macro can then be converted into a proper struct
definition.
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>
staging: comedi: ke_counter: add ability to select counter clock source
Add an (*insn_config) to the counter subdevice to allow the user to select
the clock source for the counters using the INSN_CONFIG_SET_CLOCK_SRC
instruction. The current selection can be queried with the instruction
INSN_CONFIG_GET_CLOCK_SRC.
Also, handle the INSN_CONFIG_RESET instruction to reset all the counters.
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>
The functions pci9111_trigger_source_set(), pci9111_pretrigger_set(),
and pci9111_autoscan_set() are all used to select the A/D trigger type.
They all do a read/mask/set/write of the A/D Trigger Mode Control register.
Simplify the code by removing these helper functions and combining all
the trigger bits so that a single write can be used to set the register.
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>
This define is only used in the pci_device_id table and doesn't add
any additional clarity to the code. Remove the define and just open
code the value.
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>
Reformat the comment describing this comedi driver to use the usual
block comment format.
Also remove reference to digital I/O emulating an 8255, because it
doesn't, and remove "DIO only" from the "Description:" line as it also
supports analog inputs.
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>
staging: comedi: adq12b: remove 'differential' from private data
This member of the private data is only used during the attach to
determine if there are 8 differential or 16 single-ended analog
inputs. Remove the member and use the comedi_devconfig option
directly.
Also, fix the subdev_flags when differential analog inputs are used.
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>
staging: comedi: adq12b: remove 'unipolar' from private data
This member of the private data is only used during the attach to
determine which range table to use for the analog inputs. Remove
the member and use the comedi_devconfig option directly.
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>
staging: comedi: adq12b: tidy up adq12b_ai_rinsn()
For aesthetics, rename this function.
Clean up the local variables by reusing 'val' instead of using
separate variables for the:
'status' - use once to trigger the first A/D conversion
'hi' and 'lo' - used to read the A/D conversion result
For aesthetics, change the final return to insn->n and remove the
comment.
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>
This driver only updates the ctreg (ai channel/range) register if the
desired channel or range has changed since the last analog input read
operation. It does this becuase the hardware requires an udelay to
allow the multiplexor to settle. Unfortunatly the current code never
updates the 'last_channel' and 'last_range' in the private data so
the ctreg gets updated every time.
Fix this and simplify it a bit by just storing the last ctreg value
in the private data.
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>
staging: comedi: ni_mio_common: fix the (*insn_write) for the freq_out counter
The (*insn_write) functions are supposed to write insn->n data values and
return the number of values written. For this subdevice it only makes sense
to write the last data value.
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>
staging: comedi: ni_mio_common: use dev->write_subdev
The (*attach) in ni_E_init() sets the dev->write_subdev to the analog
output subdevice. Use that instead of accessing the dev->subdevices
array directly.
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>
staging: comedi: ni_mio_common: use dev->read_subdev
The (*attach) in ni_E_init() sets the dev->read_subdev to the analog
input subdevice. Use that instead of accessing the dev->subdevices
array directly.
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>
staging: comedi: ni_mio_common: move externally called functions to EOF
This source file is included by the ni_atmio, ni_mio_cs, and ni_pcmio
drivers to support the common hardware on National Instruments DAQ-STC
based boards.
The only functions actually used by the external source files are
ni_E_interrupt(), ni_alloc_private(), ni_E_init(), and mio_common_detach().
The rest of the functions in this file are only used locally.
For aesthetics, move all the externally called functions to the end of
the file.
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>