platform/kernel/linux-starfive.git
10 years agostaging: vt6656: main_usb removed dead code
Malcolm Priestley [Wed, 25 Jun 2014 20:19:41 +0000 (21:19 +0100)]
staging: vt6656: main_usb removed dead code

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: dpc remove dead code.
Malcolm Priestley [Wed, 25 Jun 2014 20:19:40 +0000 (21:19 +0100)]
staging: vt6656: dpc remove dead code.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: move life time macros to rxtx.h
Malcolm Priestley [Wed, 25 Jun 2014 20:19:39 +0000 (21:19 +0100)]
staging: vt6656: move life time macros to rxtx.h

DEFAULT_MGN_LIFETIME_RES_64us
DEFAULT_MSDU_LIFETIME_RES_64us

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: dead code remove zonetypes
Malcolm Priestley [Wed, 25 Jun 2014 20:19:38 +0000 (21:19 +0100)]
staging: vt6656: dead code remove zonetypes

Remove vntconfiguration.dat, iocmd.h and country.h

Set all channels are enabled as by rf type.

mac80211 will handles zones

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: remove header declarations for static functions
James A Shackleford [Sat, 21 Jun 2014 03:06:11 +0000 (23:06 -0400)]
staging: vt6655: remove header declarations for static functions

The functions iwctl_giwscan() and iwctl_siwscan() are only referenced
within iwctl.c -- so, remove their function declarations from iwctl.h
and mark these functions as static.

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: rxtx implement power save poll
Malcolm Priestley [Wed, 25 Jun 2014 20:14:38 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: rxtx implement power save poll

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: device_alloc_bufs use dev_err
Malcolm Priestley [Wed, 25 Jun 2014 20:14:37 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: device_alloc_bufs use dev_err

priv->dev->name is now null change to dev_err

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: vnt_mac_set_keyentry remove byLocalID check
Malcolm Priestley [Wed, 25 Jun 2014 20:14:36 +0000 (21:14 +0100)]
staging: vt6656: vnt_mac_set_keyentry remove byLocalID check

This is now set in vnt_set_keys.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: change vnt_rf_set_txpower
Malcolm Priestley [Wed, 25 Jun 2014 20:14:35 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: change vnt_rf_set_txpower

Remove old eScanState code and use.

priv->hw->conf.chandef.chan->hw_value to find current channel

Check hw_value for bounds of vt3226d0_lo_current_table

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: move data rates to device.h
Malcolm Priestley [Wed, 25 Jun 2014 20:14:34 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: move data rates to device.h

Move all RATE_* macros to device.h

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: vRunCommand channel changes
Malcolm Priestley [Wed, 25 Jun 2014 20:14:33 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: vRunCommand channel changes

pDevice->hw->conf.chandef.chan->hw_value to find current channel

Remove bChannelSwitch, uCurrChannel, byNewChannel and bStopDataPkt

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: int.c changes
Malcolm Priestley [Wed, 25 Jun 2014 20:14:32 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: int.c changes

Remove BSSvUpdateNodeTxCounter which is not used. net_device_stats and wsats
will be removed later.

Change handling of ISR_BNTX to mac80211

Change handling of ISR_TBTT. Use IEEE80211_CONF_PS for WLAN_CMD_TBTT_WAKEUP
disable bChannelSwitch this is yet to be done.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: change vnt_next_tbtt_wakeup
Malcolm Priestley [Wed, 25 Jun 2014 20:14:31 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: change vnt_next_tbtt_wakeup

Wake up to listen to next beacon when struct ieee80211_conf -> listen_interval == 1

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: vRunCommand change beacon
Malcolm Priestley [Wed, 25 Jun 2014 20:14:30 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: vRunCommand change beacon

Remove bMgrPrepareBeaconToSend

Check that vif is not null

Call vnt_beacon_make and turn on TCR_AUTOBCNTX.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: enable power saving
Malcolm Priestley [Wed, 25 Jun 2014 20:14:29 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: enable power saving

Convert vnt_enable_power_saving and vnt_disable_power_saving

Remove mgmt->wCurrAID and use priv->current_aid

We nolonger send the PSbSendNullPacket from vnt_enable_power_saving

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: vnt_update_ifs change basic rates
Malcolm Priestley [Wed, 25 Jun 2014 20:14:28 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: vnt_update_ifs change basic rates

Use wBasicRate to find ofdm_rate.

wBasicRate is changed to u32 to match struct ieee80211_bss_conf -> basic_rates

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: add vnt_init to bScheduleCommand
Malcolm Priestley [Wed, 25 Jun 2014 20:14:27 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: add vnt_init to bScheduleCommand

start driver by linking vnt_init to vt6656_probe use bScheduleCommand
to schedule new command WLAN_CMD_INIT_MAC80211

vResetCommandTimer is now used to initiate command timer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: add channel bands
Malcolm Priestley [Wed, 25 Jun 2014 20:14:26 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: add channel bands

Add rates and channels according to rf type for vnt_init_bands which is
a mac80211 replacement for CHvInitChannelTable.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: main_usb add functions and change usb_driver...
Malcolm Priestley [Wed, 25 Jun 2014 20:14:25 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: main_usb add functions and change usb_driver functions

Create new functions for the operations of mac80211
vnt_tx_80211
vnt_start
vnt_stop
vnt_add_interface
vnt_remove_interface
vnt_config
vnt_bss_info_changed
vnt_prepare_multicast
vnt_configure
vnt_set_key
vnt_sw_scan_start
vnt_sw_scan_complete
vnt_get_tsf
vnt_set_tsf
vnt_reset_tsf

Create vnt_init to call device_init_registers to get permanent mac address.
This will be linked to vt6656_probe via bScheduleCommand in another patch as
firmware needs to be loaded first.

Modify vt6656_probe, vt6656_disconnect for mac80211

Change vt6656_suspend and vt6656_resume, nothing needs to be done here
let mac80211 handle the suspend.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: add key functions
Malcolm Priestley [Wed, 25 Jun 2014 20:14:24 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: add key functions

Create vnt_key_init_table to replace KeyvInitTable.

Create vnt_set_keymode to handle key setting operations with five different
modes VNT_KEY_DEFAULTKEY, VNT_KEY_GROUP_ADDRESS, VNT_KEY_ALLGROUP, VNT_KEY_GROUP
and VNT_KEY_PAIRWISE. VNT_KEY_ONFLY and VNT_KEY_ONFLY_ALL are for when
key latching in driver is not required.

Create vnt_set_keys to handle mac80211 key cipher modes, four modes are
supported WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, WLAN_CIPHER_SUITE_TKIP
and WLAN_CIPHER_SUITE_CCMP.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: Create tx functions
Malcolm Priestley [Wed, 25 Jun 2014 20:14:23 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: Create tx functions

Create vnt_fill_txkey as mac80211 replacement for s_vFillTxKey.

Create vnt_tx_packet which a merger of s_bPacketToWirelessUsb, nsDMA_tx_packet
and csMgmt_xmit using mac80211 signalling.

Create vnt_beacon_xmit as mac80211 replacement for csBeacon_xmit. Changing
header in vnt_beacon_buffer to struct ieee80211_mgmt deleting some of
old code. vnt_beacon_make is needed to make beacon for vnt_beacon_xmit.

Create vnt_beacon_enable as mac80211 call to enable beacon.

vnt_fill_ieee80211_rts is modified to use struct ieee80211_hdr instead of
struct ethhdr and access to tx_context.

In s_nsBulkOutIoCompleteWrite modify context handling

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: mac80211 conversion: create rx function.
Malcolm Priestley [Wed, 25 Jun 2014 20:14:22 +0000 (21:14 +0100)]
staging: vt6656: mac80211 conversion: create rx function.

Add mac80211 header and depends.

Create new function vnt_rx_data to receive 80211 packets which is based
on RXbBulkInProcessData and rx them into mac80211

The function also relays dbm, tsf_time(as mactime) and sets byBBPreEDRSSI and
uCurrRSSI.

skb is modified slightly to skb_put the maxium tail room in PIPEnsBulkInUsbRead
and trim back in vnt_rx_data. dev_alloc_skb is used to reallocate the sk_buff.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xillybus: Use devm_ API for memory allocation and DMA mapping
Eli Billauer [Sat, 21 Jun 2014 11:07:12 +0000 (14:07 +0300)]
staging: xillybus: Use devm_ API for memory allocation and DMA mapping

Managed device resource API replaces code that reinvents it for memory
allocation, page allocation and DMA mapping.

devm_add_action() is used for unwinding DMA mappings, since there is no
devm_* API for dma_map_single(). A recent patch that introduces such API
was rejected, mainly on the grounds that it may cause an unnecessary waste of
resources.

Suggested-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: wlags49_h2: Fix use of skb after netif_rx
Himangi Saraogi [Sat, 21 Jun 2014 15:04:09 +0000 (20:34 +0530)]
staging: wlags49_h2: Fix use of skb after netif_rx

This patch moves a call to netif_rx(skb) after a subsequent reference to
skb, because netif_rx may call kfree_skb via enqueue_to_backlog on its
argument.

This was found using the following semantic match.

// <smpl>
@@
expression skb, e,e1;
@@

(
 netif_rx(skb);
|
 netif_rx_ni(skb);
)
  ... when != skb = e
(
  skb = e1
|
* skb
)
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: Android: removed an unnecessary else statement
Karthik Nayak [Sat, 21 Jun 2014 14:53:16 +0000 (20:23 +0530)]
Staging: Android: removed an unnecessary else statement

As per checkpatch warning, removed an unnecessary else statement
proceeding an if statement with a return.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: unisys Remove BROKEN from Kconfig to allow compilation
Ken Cox [Thu, 26 Jun 2014 14:55:56 +0000 (09:55 -0500)]
Staging: unisys Remove BROKEN from Kconfig to allow compilation

The unisys drivers now properly check to make sure they are running
on the s-Par platform before they will initialize.  This was fixed in
commit fcd0157ece so it is safe to allow the unisys drivers to be built.

This has been tested in the same qemu environment that originally
produced the panic and the kernel now runs as expected.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Tested-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: unisys: remove references to __DATE__ and __TIME__
Ken Cox [Thu, 26 Jun 2014 14:55:55 +0000 (09:55 -0500)]
Staging: unisys: remove references to __DATE__ and __TIME__

The use of __DATE__ and __TIME__ is no longer allowed in the kernel so this
commit removes those.  They were once useful when the drivers were being
built externally, but now that the drivers are in the kernel the use of the
macros is redundant since the kernel already has the same information
elsewhere.

In addition, using these macros breaks the build if using gcc 4.9.0

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: remove unused macros
Paul Bolle [Thu, 26 Jun 2014 08:54:08 +0000 (10:54 +0200)]
staging: unisys: remove unused macros

The macros CONFIG_SPAR_GUEST, GUESTDRIVERBUILD, and NOAUTOVERSION are
defined in Makefiles for the Unisys SPAR driver. They are never used.
Remove the lines that define these macros.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: s626: remove struct s626_enc_info
H Hartley Sweeten [Fri, 20 Jun 2014 20:29:03 +0000 (13:29 -0700)]
staging: comedi: s626: remove struct s626_enc_info

The only member left in this struct is the 'chan' which is the
comedi channel of the encoder.

Remove the struct and refactor the code to pass/use the comedi
channel instead.

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>
10 years agostaging: comedi: s626: tidy up s626_enc_insn_read()
H Hartley Sweeten [Fri, 20 Jun 2014 20:29:02 +0000 (13:29 -0700)]
staging: comedi: s626: tidy up s626_enc_insn_read()

Abosorb the s626_read_latch() helper and tidy up this function.

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>
10 years agostaging: comedi: s626: remove 'my_event_bits' from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:29:01 +0000 (13:29 -0700)]
staging: comedi: s626: remove 'my_event_bits' from encoder private data

This array in the encoder private data just makes the driver harder to
follow.

The S626_EVBITS() macro is used to initialize the member in the declaration.
This macro creates a array of four values, based on the encoder channel, that
are used to mask and set the private data 'counter_int_enabs' member. The
values are created using the S626_OVERMASK() and S626_INDXMASK() macros using
the encoder channel number.

Remove the 'my_event_bits' member from the encoder private data as well
as the S626_EVBITS() macro. Refactor the code to use the S626_OVERMASK() and
S626_INDXMASK() macros 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>
10 years agostaging: comedi: s626: remove 'set_mode' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:29:00 +0000 (13:29 -0700)]
staging: comedi: s626: remove 'set_mode' callback from encoder private data

There are two functions used for the 'set_mode' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Add a helper function, s626_set_mode(), that uses the encoder channel number
to determine which function to call.

Remove the then unnecessary 'set_mode' member and just call s626_set_mode()
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>
10 years agostaging: comedi: s626: remove 'get_mode' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:59 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'get_mode' callback from encoder private data

There are two functions used for the 'get_mode' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Add a helper function, s626_get_mode(), that uses the encoder channel number
to determine which function to call.

Remove the then unnecessary 'get_mode' member from the encoder private data.

The 'get_mode' callbacks were not being used by the driver in any of the enabled
code. For now block the s626_get_mode() functions with '#ifdef unused' to prevent
a compiler warning.

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>
10 years agostaging: comedi: s626: remove 'reset_cap_flags' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:58 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'reset_cap_flags' callback from encoder private data

There are two functions used for the 'reset_cap_flags' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_reset_cap_flags() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'reset_cap_flags' member and just call s626_reset_cap_flags()
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>
10 years agostaging: comedi: s626: remove 'pulse_index' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:57 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'pulse_index' callback from encoder private data

There are two functions used for the 'pulse_index' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_pulse_index() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'pulse_index' member and just call s626_pulse_index()
drectly.

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>
10 years agostaging: comedi: s626: remove 'get_int_src' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:56 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'get_int_src' callback from encoder private data

There are two functions used for the 'get_int_src' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_int_srsc() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'get_int_src' member from the encoder private data.

The 'get_int_src' callbacks were not being used by the driver. For now block
the s626_get_int_src() function with '#ifdef unused' to prevent a compiler
warning.

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>
10 years agostaging: comedi: s626: remove 'set_int_src' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:55 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'set_int_src' callback from encoder private data

There are two functions used for the 'set_int_src' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_set_int_src() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'set_int_src' member and just call s626_set_int_src()
drectly.

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>
10 years agostaging: comedi: s626: remove 'get_load_trig' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:54 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'get_load_trig' callback from encoder private data

There are two functions used for the 'get_load_trig' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_load_trig() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'get_enable' member from the encoder private data.

The 'get_load_trig' callbacks were not being used by the driver. For now block
the s626_get_load_trig() function with '#ifdef unused' to prevent a compiler
warning.

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>
10 years agostaging: comedi: s626: remove 'set_load_trig' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:53 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'set_load_trig' callback from encoder private data

There are two functions used for the 'set_load_trig' callback, One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_set_load_trig() function and use
the encoder channel number to handle the differences.

Remove the then unnecessary 'set_load_trig' member and just call s626_set_load_trig()
drectly.

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>
10 years agostaging: comedi: s626: remove 'get_enable' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:52 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'get_enable' callback from encoder private data

There are two functions used for the 'get_enable' callback, s626_get_enable_a()
function is used for the channel 0-2 encoders and s626_get_enable_b() is used
for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_enable() function and use the
encoder channel number to handle the differenced.

Remove the then unnecessary 'get_enable' member and just call s626_set_enable()
directly.

The 'get_enable' callbacks were not being used by the driver. For now block the
s626_get_enable() function with '#ifdef unused' to prevent a compiler warning.

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>
10 years agostaging: comedi: s626: remove 'set_enable' callback from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:51 +0000 (13:28 -0700)]
staging: comedi: s626: remove 'set_enable' callback from encoder private data

There are two functions used for the 'set_enable' callback, s626_set_enable_a()
function is used for the channel 0-2 encoders and s626_set_enable_b() is used
for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_set_enable() function and use the
encoder channel number to handle the differenced.

Remove the then unnecessary 'set_enable' member and just call s626_set_enable()
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>
10 years agostaging: comedi: s626: remove my_latch_lsw from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:50 +0000 (13:28 -0700)]
staging: comedi: s626: remove my_latch_lsw from encoder private data

This member of the encoder private data can be calculated based on
the comedi channel stored in the 'chan' member of the private data.
Do that instead and remove the unnecessary member.

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>
10 years agostaging: comedi: s626: define S626_LP_CNTR* registers based on channel number
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:49 +0000 (13:28 -0700)]
staging: comedi: s626: define S626_LP_CNTR* registers based on channel number

Redefining the Counter Preload/Latch registers as a macro that calculates
the register offset based on the comedi channel number.

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>
10 years agostaging: comedi: s626: remove my_cr[ab] from encoder private data
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:48 +0000 (13:28 -0700)]
staging: comedi: s626: remove my_cr[ab] from encoder private data

These members of the encoder private data can be calculated based on
the comedi channel stored in the 'chan' member of the private data.
Do that instead and remove the unnecessary members.

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>
10 years agostaging: comedi: s626: add comedi "chan" number to struct s626_enc_info
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:47 +0000 (13:28 -0700)]
staging: comedi: s626: add comedi "chan" number to struct s626_enc_info

Add the comedi "chan" number to the encoder private data so we can then
remove some of the members of 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>
10 years agostaging: comedi: s626: define CRA/CRB registers based on channel number
H Hartley Sweeten [Fri, 20 Jun 2014 20:28:46 +0000 (13:28 -0700)]
staging: comedi: s626: define CRA/CRB registers based on channel number

Start cleaning up the 'struct s626_enc_info' by redefining the my_cra
and my_crb members based on the comedi channel number.

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>
10 years agostaging: comedi: addi_apci_1564: move apci1564_interrupt() into addi_apci_1564.c
Chase Southwood [Sat, 21 Jun 2014 22:26:10 +0000 (17:26 -0500)]
staging: comedi: addi_apci_1564: move apci1564_interrupt() into addi_apci_1564.c

On moving the function into the driver proper, also check the device is
asserting the shared interrupt line.

This patch also fixes the interrupt handling for the digital input
change-of-state interrupts.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1564: add Change-of-State interrupt subdevice and required...
Chase Southwood [Sat, 21 Jun 2014 22:25:58 +0000 (17:25 -0500)]
staging: comedi: addi_apci_1564: add Change-of-State interrupt subdevice and required functions

This board supports an interrupt that can be generated by an AND/OR
combination of 16 of the input channels.

Create a separate subdevice to handle this interrupt.

The apci1564_di_config() function is used to configure which
inputs are used to generate the interrupt. Currently this function
is broken since it does not follow the comedi API for insn_config
functions. Fix this function by implementing the config instruction
INSN_CONFIG_DIGITAL_TRIG.

Add the remaining subdevice operations necessary for the interrupt
subdevice to support async commands.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1564: introduce apci1564_private struct
Chase Southwood [Sat, 21 Jun 2014 22:25:43 +0000 (17:25 -0500)]
staging: comedi: addi_apci_1564: introduce apci1564_private struct

The addi_private struct defined in addi-data/addi_common.h is very bloated
and contains many fields which addi_apci_1564 does not require.  In the
interest of eventually removing this driver's dependency on
addi_common.h, we can create a private data struct specifically for
addi_apci_1564 containing only the fields it will actually use.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1564: remove unused static variables
Chase Southwood [Sat, 21 Jun 2014 22:25:17 +0000 (17:25 -0500)]
staging: comedi: addi_apci_1564: remove unused static variables

The global variables ui_InterruptStatus_1564 and ui_InterruptData are both
set but never used.  Just remove them from the driver.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1564: remove use of devpriv->b_OutputMemoryStatus
Chase Southwood [Sat, 21 Jun 2014 22:24:39 +0000 (17:24 -0500)]
staging: comedi: addi_apci_1564: remove use of devpriv->b_OutputMemoryStatus

This member of the private data struct is only set at one location in the
entire driver, and then never even used for anything.  Let's just remove
its use.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dt282x: automatically handle D/A data format
H Hartley Sweeten [Fri, 20 Jun 2014 20:13:02 +0000 (13:13 -0700)]
staging: comedi: dt282x: automatically handle D/A data format

The DT2821 series board have jumpers that set the output range for
the two Analog Output channels. The range_table for the Analog Output
subdevice provides all possible ranges to the user. When a unipolar
range is selected the board expects the data to be in a straight
binary format. When a bipolar range is select the data should be in
two's complement format.

Currently, the user passes some configuration options when attaching
to the driver to select the data format for each channel. If the
user does not pass the config options, the data format is assumed to
be straight binary.

The Analog Output subdevice now has a range_table that provides the
user will all possible ranges. Use the range information to determine
if the data values need to be munged into two's complememnt values
and deprecate the config options.

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>
10 years agostaging: comedi: dt282x: fix bug where DIO direction is reset to inputs
H Hartley Sweeten [Fri, 20 Jun 2014 20:13:01 +0000 (13:13 -0700)]
staging: comedi: dt282x: fix bug where DIO direction is reset to inputs

The direction of the 16 DIO channels is controlled with two bits in the
DACSR register. The HBOE bit controls the direction of channels 15-8 and
the LBOE bit channels 7-0.

The DACSR register is also used to control the Analog Output async command
support. Currently, starting or canceling an Analog Output command would
also reset the DIO directions so that all channels were inputs.

Fix the driver so that the DIO direction is not changed when starting or
canceling an Analog Output async command.

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>
10 years agostaging: comedi: dt282x: tidy up the register map and bit defines
H Hartley Sweeten [Fri, 20 Jun 2014 20:13:00 +0000 (13:13 -0700)]
staging: comedi: dt282x: tidy up the register map and bit defines

For aesthetics, rename the register map defines so that the bit defines
are associated with the registers. Also, convert all the bit defines into
bit-shifts to make them clear.

Remove all the verbose comments. All the registers and bits are named
according to the User Manual for the DT2821 Series, Document UM-05073-G.
That manual can be checked if necessary for the verbose information.

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>
10 years agostaging: comedi: dt282x: avoid calculating the timer divisor multiple times
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:59 +0000 (13:12 -0700)]
staging: comedi: dt282x: avoid calculating the timer divisor multiple times

A common timer is used for analog input and output async commands. The
(*do_cmdtest) for both subdevices calculates the divisor as part of
Step 4 when validating the trigger arguments. The divisor is calculated
again in the (*do_cmd) for both subdevices in order to set the timer.

The comedi core only calls the (*do_cmd) is called after a successful
(*do_cmdtest). Save the divisor from the (*do_cmdtest) in the private
data and use that value in the (*do_cmd).

The extra check of the cmd->convert_arg in dt282x_ai_cmd() is not necessary.
The convert_arg was already checked in the (*do_cmdtest), and it's not used
in the (*do_cmd).

Tidy up dt282x_ns_to_timer(), the parameters are all unsigned int's and the
mask of the 'flags' can be moved here to simplify the callers.

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>
10 years agostaging: comedi: dt282x: update the MODULE_DESCRIPTION
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:58 +0000 (13:12 -0700)]
staging: comedi: dt282x: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more useful than the
generic "Comedi low-level driver".

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>
10 years agostaging: comedi: dt282x: tidy up multi-line comments
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:57 +0000 (13:12 -0700)]
staging: comedi: dt282x: tidy up multi-line comments

Tidy up the multi-line comments at the beginning of the file to follow
the CodingStyle.

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>
10 years agostaging: comedi: dt282x: cleanup analog output range table
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:56 +0000 (13:12 -0700)]
staging: comedi: dt282x: cleanup analog output range table

The DT2821 series boards do not have programmable analog output ranges.
The range is set, per-channel, with jumpers on the board.

Currently the user has to pass some configuration options when attaching
to the driver in order to set the range for each channel. If they do not
pass the range options they will default to 0. If they pass an invalid
range option they will also default to 0. The 0 range option is bipolar
10V. If the user passes a range option that does not match the hardware
setting it doesn't cause any problems in the driver it just causes the
user space comedilib library to incorrectly convert the hardware values
to physical values.

Make the attach a bit simpler by deprecating these options and providing
a range table with all the valid ranges for the analog outputs. The user
can then select the correct range when they use the comedilib functions.

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>
10 years agostaging: comedi: dt282x: fix Analog Input se/diff channel configuration
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:55 +0000 (13:12 -0700)]
staging: comedi: dt282x: fix Analog Input se/diff channel configuration

Most of the boards supported by this driver can do either single-ended or
differential Analog Input but there are a couple that can only do one or
the other. On the boards that can do both the type of input is set with
jumpers on the board.

The 'it->options[4]' passed by the user during the board (*attach) is used
to determine how the Analog Inputs are configured. This is used to set
the subdevice flags and number of channels correctly.

Fix the check of this option so that it only applies when the board can
actually do differential input. Also, default to differential inputs if
that is the only mode the board supports.

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>
10 years agostaging: comedi: dt282x: tidy up Analog Input subdevice init
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:54 +0000 (13:12 -0700)]
staging: comedi: dt282x: tidy up Analog Input subdevice init

For aesthetics, add some whitespace to the Analog Input subdevice init.

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>
10 years agostaging: comedi: dt282x: tidy up Analog Output subdevice init
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:53 +0000 (13:12 -0700)]
staging: comedi: dt282x: tidy up Analog Output subdevice init

For aesthetics, add some whitespace to the Analog Output subdevice init.

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>
10 years agostaging: comedi: dt282x: remove the 'opt_*' enum
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:52 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove the 'opt_*' enum

This enum is used to index the 'options' values that are passed
by the user attaches to the driver. These options are identified
in the comedi comment block.

For aesthetics, remove the enum and just open code the index values.

Refactor the Analog Input subdevice init so that the it->options[4],
indicating differential inputs, does not have to be checked multiple
times.

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>
10 years agostaging: comedi: dt282x: factor board initialization out of (*attach)
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:51 +0000 (13:12 -0700)]
staging: comedi: dt282x: factor board initialization out of (*attach)

For aesthetics, factor the code that initializes the then checks to see
if it is actually a DT2821 series board out of the (*attach).

For clarity, remove the MASK and VAL defines used to check the board and
jsut open code the values.

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>
10 years agostaging: comedi: dt282x: fix dt282x_ao_insn_read()
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:50 +0000 (13:12 -0700)]
staging: comedi: dt282x: fix dt282x_ao_insn_read()

The comedi core expects the (*insn_read) functions to return 'insn->n'
samples. Fix this function to work like the core expects.

For aesthetics, rename the private data 'ao' member to clarify its
use. Also, remove the unnecessary 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>
10 years agostaging: comedi: dt282x: tidy up dt282x_ai_dma_interrupt()
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:49 +0000 (13:12 -0700)]
staging: comedi: dt282x: tidy up dt282x_ai_dma_interrupt()

The main interrupt handler already has the comedi_subdevice pointer
needed in this function. Pass that subdevice pointer so that it does
not need to be fetched as a local variable.

Tidy up the function a bit.

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>
10 years agostaging: comedi: dt282x: tidy up dt282x_ao_dma_interrupt()
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:48 +0000 (13:12 -0700)]
staging: comedi: dt282x: tidy up dt282x_ao_dma_interrupt()

The main interrupt handler already has the comedi_subdevice pointer
needed in this function. Pass that subdevice pointer so that it does
not need to be fetched as a local variable.

Tidy up the function a bit.

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>
10 years agostaging: comedi: dt282x: remove sanity checks of 's->async->prealloc_buf'
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:47 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove sanity checks of 's->async->prealloc_buf'

The comedi core sanity checks that the subdevice has a buffer allocated
before allowing an async command to start. The helper functions in comedi_buf
will also sanity check the buffer as a side effect of the 'alloc' helpers
with reading or writing data for the buffer.

Remove the unnecessary sanity checks in the ai/ao dma interrupt handlers.
This will allow the handlers to disable the dma and then fail when they
try to read/write the buffer. Currently dma is left enabled due to the
sanity checks.

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>
10 years agostaging: comedi: dt282x: tidy up Digital I/O subdevice init
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:46 +0000 (13:12 -0700)]
staging: comedi: dt282x: tidy up Digital I/O subdevice init

For aesthetics, add some whitespace to the Digital I/O subdevice init.

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>
10 years agostaging: comedi: dt282x: rename the prep_{ai,ao}_dma() functions
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:45 +0000 (13:12 -0700)]
staging: comedi: dt282x: rename the prep_{ai,ao}_dma() functions

Rename these functions so they have namespace associated with the driver.

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>
10 years agostaging: comedi: dt282x: remove unused chan_to_DAC() macro
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:44 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove unused chan_to_DAC() macro

This macro is not used in the driver. Remove it.

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>
10 years agostaging: comedi: dt282x: convert private data flags to bit-fields
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:43 +0000 (13:12 -0700)]
staging: comedi: dt282x: convert private data flags to bit-fields

Convert the '2scomp' flags in the private data into bit-fields to save
a bit of space.

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>
10 years agostaging: comedi: dt282x: remove DT2821_SIZE define
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:42 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove DT2821_SIZE define

This define is only used in the comedi_request_region() call to specify
the size of the I/O region. Remove it 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>
10 years agostaging: comedi: dt282x: IRQ and DMA are needed for async command support
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:41 +0000 (13:12 -0700)]
staging: comedi: dt282x: IRQ and DMA are needed for async command support

This driver requires an IRQ and 2 DMA channels in order to execute async
commands.

Modify the (*attach) so that command support is only hooked up if
DMA is available. This allows removing the extra checks in the
command support functions.

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>
10 years agostaging: comedi: dt282x: remove 'volatile' on private data variables
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:40 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove 'volatile' on private data variables

As indicated by checkpatch.pl, "WARNING: Use of volatile is usually
wrong: ...". The variables in the private data that are marked
volatile don't need to be. Remove the volatile.

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>
10 years agostaging: comedi: dt282x: fix dt282x_ao_insn_write()
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:39 +0000 (13:12 -0700)]
staging: comedi: dt282x: fix dt282x_ao_insn_write()

The (*insn_write) functions are expected to write 'insn->n' samples to the
hardware. Fix this function so it works like the comedi core expects.

The comedi core sanity checks that the samples are within the 'maxdata' range
of the subdevice before calling the (*insn_write) so this function does not
need to mask each sample by 's->maxdata'.

Also, the wrong '*2scomp' flag in the private data was being checked to see
if the sample needs to be munged before being written. Fix this.

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>
10 years agostaging: comedi: dt282x: convert 'dabits' boardinfo to 'ao_maxdata'
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:38 +0000 (13:12 -0700)]
staging: comedi: dt282x: convert 'dabits' boardinfo to 'ao_maxdata'

This member of the boardinfo is the number of bits in the analog output data.
Convert this member into the subdevice 'maxdata', (1 << board->dabits) - 1,
to avoid needing to do the calculation.

Use the subdevice 'maxdata' in the driver instead of using the boardinfo and
use the comedi_offset_munge() helper to convert the two's complement data to
the offset binary form that the comedi core expects.

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>
10 years agostaging: comedi: dt282x: convert 'adbits' boardinfo to 'ai_maxdata'
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:37 +0000 (13:12 -0700)]
staging: comedi: dt282x: convert 'adbits' boardinfo to 'ai_maxdata'

This member of the boardinfo is the number of bits in the analog input data.
Convert this member into the subdevice 'maxdata', (1 << board->adbits) - 1,
to avoid needing to do the calculation.

Use the subdevice 'maxdata' in the driver instead of using the boardinfo and
use the comedi_offset_munge() helper to convert the two's complement data to
the offset binary form that the comedi core expects.

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>
10 years agostaging: comedi: dt282x: remove '= 0' boardinfo
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:36 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove '= 0' boardinfo

All unlisted members in the boardinfo declaraction will default to '0'.
Remove the unnecessary code.

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>
10 years agostaging: comedi: dt282x: move boardinfo declaration
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:35 +0000 (13:12 -0700)]
staging: comedi: dt282x: move boardinfo declaration

For asethetics, move the boardinfo declaration closer to the 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>
10 years agostaging: comedi: dt282x: remove forward declarations
H Hartley Sweeten [Fri, 20 Jun 2014 20:12:34 +0000 (13:12 -0700)]
staging: comedi: dt282x: remove forward declarations

Move some of the functions to remove the need for the forward
declarations.

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>
10 years agostaging: comedi: introduce comedi_buf_n_bytes_ready()
H Hartley Sweeten [Fri, 20 Jun 2014 17:58:28 +0000 (10:58 -0700)]
staging: comedi: introduce comedi_buf_n_bytes_ready()

Introduce an inline helper to return the number of bytes that are
ready to read from the comedi_async buffer. Use the helper in the
comedi drivers that currently do the calculation as part of the
(*poll) operation.

Also, use the helper in comedi_fops where the calculation is used as
part of the subdevice going nonbusy.

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>
10 years agostaging: comedi: ke_counter: expose clock source options to user space
H Hartley Sweeten [Fri, 20 Jun 2014 17:39:43 +0000 (10:39 -0700)]
staging: comedi: ke_counter: expose clock source options to user space

As pointed out by Ian Abbott, the INSN_CONFIG_SET_CLOCK_SRC options should
be exposed in the user header comedi.h.

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>
10 years agoStaging: rtl8192e: adjust error handling
Himangi Saraogi [Sat, 21 Jun 2014 15:09:51 +0000 (20:39 +0530)]
Staging: rtl8192e: adjust error handling

This patch removes a test in error handling code by adding a return
path.

The Coccinelle semantic match that found the problem is:

// <smpl>
@@
expression E,E1,E2;
@@

E = alloc_etherdev(...)
... when != E = E1
if (...) { ... free_netdev(E); ... return ...; }
... when != E = E2
(
  if (...)
   {
   ... when != free_netdev(E);
   return dev; }
|
* if (...)
   {
   ... when != free_netdev(E);
   return ...; }
|
register_netdev(E)
)

// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8192u: r8192U_core.c: Cleaning up variable is set more than once
Rickard Strandqvist [Wed, 25 Jun 2014 12:20:58 +0000 (14:20 +0200)]
staging: rtl8192u: r8192U_core.c: Cleaning up variable is set more than once

A struct member variable is set to the same value more than once

This was found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8192u: r8192U_wx.c Fixed a code-style error about trailing whitespace
Chaitanya Hazarey [Fri, 20 Jun 2014 17:49:56 +0000 (10:49 -0700)]
Staging: rtl8192u: r8192U_wx.c Fixed a code-style error about trailing whitespace

Fixed the following error reported by running checkpatch.pl

ERROR: trailing whitespace

Signed-off-by: Chaitanya Hazarey <c@24.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8192u: r8192U_wx.c Fixed some more code-style warnings about spaces
Chaitanya Hazarey [Fri, 20 Jun 2014 17:49:55 +0000 (10:49 -0700)]
Staging: rtl8192u: r8192U_wx.c Fixed some more code-style warnings about spaces

Fixed the following warnings issued by checkpatch.pl

WARNING: please, no space before tabs

Signed-off-by: Chaitanya Hazarey <c@24.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8192u: r8192U_wx.c Fixed code-style warnings
Chaitanya Hazarey [Fri, 20 Jun 2014 17:49:54 +0000 (10:49 -0700)]
Staging: rtl8192u: r8192U_wx.c Fixed code-style warnings

Fixed some of the following warning generated by checkpatch.pl:

WARNING: Missing a blank line after declarations

Signed-off-by: Chaitanya Hazarey <c@24.io>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: serqt_usb2: fixed frivolous else statement warnings
Vincent Heuken [Fri, 20 Jun 2014 16:49:51 +0000 (09:49 -0700)]
Staging: serqt_usb2: fixed frivolous else statement warnings

This is a patch to the serqt_usb2.c file that fixes three instances
of the following checkpatch.pl warning:
WARNING: else is not generally useful after a break or return

Signed-off-by: Vincent Heuken <me@vincentheuken.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: fix sparse warnings for static symbols
James A Shackleford [Sat, 21 Jun 2014 08:42:10 +0000 (04:42 -0400)]
staging: lustre: fix sparse warnings for static symbols

This patch fixes the following sparse warnings:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:46:20: warning: symbol 'the_ksocklnd' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:49:19: warning: symbol 'ksocknal_ip2iface' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:67:15: warning: symbol 'ksocknal_create_route' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:103:1: warning: symbol 'ksocknal_create_peer' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:218:1: warning: symbol 'ksocknal_unlink_peer_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:248:1: warning: symbol 'ksocknal_get_peer_info' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:323:1: warning: symbol 'ksocknal_associate_route_conn_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:368:1: warning: symbol 'ksocknal_add_route_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:409:1: warning: symbol 'ksocknal_del_route_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:511:1: warning: symbol 'ksocknal_del_peer_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:566:1: warning: symbol 'ksocknal_del_peer' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:624:14: warning: symbol 'ksocknal_get_conn_by_idx' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:661:15: warning: symbol 'ksocknal_choose_scheduler_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:685:1: warning: symbol 'ksocknal_local_ipvec' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:713:1: warning: symbol 'ksocknal_match_peerip' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:745:1: warning: symbol 'ksocknal_select_ips' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:847:1: warning: symbol 'ksocknal_create_routes' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:997:1: warning: symbol 'ksocknal_connecting' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:1853:1: warning: symbol 'ksocknal_push_peer' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:1886:1: warning: symbol 'ksocknal_push' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:1935:1: warning: symbol 'ksocknal_add_interface' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:1997:1: warning: symbol 'ksocknal_peer_del_interface_locked' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2038:1: warning: symbol 'ksocknal_del_interface' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2213:1: warning: symbol 'ksocknal_free_buffers' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2256:1: warning: symbol 'ksocknal_base_shutdown' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2349:1: warning: symbol 'ksocknal_new_incarnation' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2364:1: warning: symbol 'ksocknal_base_startup' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2496:1: warning: symbol 'ksocknal_debug_peerhash' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2603:1: warning: symbol 'ksocknal_enumerate_interfaces' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2660:1: warning: symbol 'ksocknal_search_new_ipif' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2702:1: warning: symbol 'ksocknal_start_schedulers' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2748:1: warning: symbol 'ksocknal_net_start_threads' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2860:1: warning: symbol 'ksocknal_module_fini' was not declared. Should it be static?
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2866:1: warning: symbol 'ksocknal_module_init' was not declared. Should it be static?

Signed-off-by: James A Shackleford <shack@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: OnAssocReq23a(): Use cfg80211_find_vendor_ie() to locate VMM
Jes Sorensen [Tue, 24 Jun 2014 13:03:58 +0000 (15:03 +0200)]
staging: rtl8723au: OnAssocReq23a(): Use cfg80211_find_vendor_ie() to locate VMM

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Only validate vendor specific ies, when they it is vendor specific
Jes Sorensen [Tue, 24 Jun 2014 13:03:57 +0000 (15:03 +0200)]
staging: rtl8723au: Only validate vendor specific ies, when they it is vendor specific

Don't run rtw_validate_vendor_specific_ies() on anything but
WLAN_EID_VENDOR_SPECIFIC. In addition use the proper
WLAN_OUI_TYPE_MICROSOFT_* definitions.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: rtw_append_pmkid(): Adjust for IEs array not arrying fixed elements
Jes Sorensen [Tue, 24 Jun 2014 13:03:56 +0000 (15:03 +0200)]
staging: rtl8723au: rtw_append_pmkid(): Adjust for IEs array not arrying fixed elements

Another case using hard coded offsets counting on the presence of
fixed beacon elements in the IEs array.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: rtw_restruct_wmm_ie23a(): Use cfg80211_find_vendor_ie()
Jes Sorensen [Tue, 24 Jun 2014 13:03:55 +0000 (15:03 +0200)]
staging: rtl8723au: rtw_restruct_wmm_ie23a(): Use cfg80211_find_vendor_ie()

Rewrite rtw_restruct_wmm_ie23a() using cfg80211_find_vendor_ie()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Eliminate set_wep_key() and call set_group_key() directly
Jes Sorensen [Tue, 24 Jun 2014 13:03:54 +0000 (15:03 +0200)]
staging: rtl8723au: Eliminate set_wep_key() and call set_group_key() directly

This also eliminates another round of determine algorithm based on key
length, followed by determine key length based on algorithm.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Validate keys in cfg80211_rtw_add_key()
Jes Sorensen [Tue, 24 Jun 2014 13:03:53 +0000 (15:03 +0200)]
staging: rtl8723au: Validate keys in cfg80211_rtw_add_key()

We validate the parameters in cfg80211_rtw_add_key() so no need to do
it all again in rtw_cfg80211_{ap_}set_encryption()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove obsolete struct ieee_parm
Jes Sorensen [Tue, 24 Jun 2014 13:03:52 +0000 (15:03 +0200)]
staging: rtl8723au: Remove obsolete struct ieee_parm

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: rtw_cfg80211_{ap_}set_encryption(): Stop passing ieee_parms argument
Jes Sorensen [Tue, 24 Jun 2014 13:03:51 +0000 (15:03 +0200)]
staging: rtl8723au: rtw_cfg80211_{ap_}set_encryption(): Stop passing ieee_parms argument

struct ieee_parms is obsolete, so stop passing it on.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: rtw_cfg80211_{ap_}set_encryption(): Add sta_addr argument
Jes Sorensen [Tue, 24 Jun 2014 13:03:50 +0000 (15:03 +0200)]
staging: rtl8723au: rtw_cfg80211_{ap_}set_encryption(): Add sta_addr argument

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: rtw_cfg80211_{ap_}set_encryption(): No more string parsing to...
Jes Sorensen [Tue, 24 Jun 2014 13:03:49 +0000 (15:03 +0200)]
staging: rtl8723au: rtw_cfg80211_{ap_}set_encryption(): No more string parsing to determine cipher

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Stop setting ieee_parm arguments that aren't used
Jes Sorensen [Tue, 24 Jun 2014 13:03:48 +0000 (15:03 +0200)]
staging: rtl8723au: Stop setting ieee_parm arguments that aren't used

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>