platform/kernel/linux-rpi.git
14 years agomac80211: reduce debugfs code size
Felix Fietkau [Wed, 2 Jun 2010 00:57:34 +0000 (02:57 +0200)]
mac80211: reduce debugfs code size

This patch reduces the binary size by around 25k (measured on MIPS,
with CONFIG_MAC80211_DEBUG_COUNTERS enabled).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix queue stop/start based on the number of pending frames
Felix Fietkau [Tue, 1 Jun 2010 19:33:13 +0000 (21:33 +0200)]
ath9k: fix queue stop/start based on the number of pending frames

Because there is a limited number of tx buffers available, once the
queue has been filled to a certain point, ath9k needs to stop accepting
new frames from mac80211. In order to prevent a full WMM queue from
stopping another queue with fewer frames, this patch limits the number
of queued frames to a quarter of the total available tx buffers, minus
some reserved frames to be used for other purposes (e.g. beacons).

Because tx buffers are reserved for frames when they're staged in
software queues as well, the actual queue depth cannot be used for
this, so this patch stores a reference to the tx queue in the ath_buf
struct and keeps track of the total number of pending frames.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Fix fair beacon distribution
Sujith [Tue, 1 Jun 2010 09:44:19 +0000 (15:14 +0530)]
ath9k_htc: Fix fair beacon distribution

This patch fixes beacon distribution in IBSS mode
by configuring the hardware beacon queue properly.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Handle host RX disable
Sujith [Tue, 1 Jun 2010 09:44:18 +0000 (15:14 +0530)]
ath9k_htc: Handle host RX disable

The MIB counters used by ANI have to be disabled
on the host because the FW doesn't do it on the target side.
Also, flush the receive buffers before initializing
RX on the target.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Handle monitor interface removal
Sujith [Tue, 1 Jun 2010 09:44:17 +0000 (15:14 +0530)]
ath9k_htc: Handle monitor interface removal

The monitor interface instance on the target has
to be removed before setting it to FULLSLEEP.
Handle this properly.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Fix locking for ps_idle
Sujith [Tue, 1 Jun 2010 09:44:16 +0000 (15:14 +0530)]
ath9k_htc: Fix locking for ps_idle

ps_idle is protected by the htc_pm_lock mutex.
Use it to protect the variable.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Remove useless cancel_work_sync
Sujith [Tue, 1 Jun 2010 09:44:15 +0000 (15:14 +0530)]
ath9k_htc: Remove useless cancel_work_sync

There is no need to cancel the PS work when disassociation
happens. The work handlers are cancelled in the stop()
callback.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Fix bug in handling CONF_IDLE
Sujith [Tue, 1 Jun 2010 09:44:14 +0000 (15:14 +0530)]
ath9k_htc: Fix bug in handling CONF_IDLE

Disable the radio only when mac80211 indicates it,
through the IEEE80211_CONF_CHANGE_IDLE flag.
Not handling this properly will result in multiple
calls to radio_disable() even though the radio is
already idle.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Add PS wrappers
Sujith [Tue, 1 Jun 2010 09:44:12 +0000 (15:14 +0530)]
ath9k_htc: Add PS wrappers

The HW has to be awake when registers are accessed.
Ensure this is so by using the PS wrappers at
appropriate places.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Revamp CONF_IDLE handling
Sujith [Tue, 1 Jun 2010 09:44:11 +0000 (15:14 +0530)]
ath9k_htc: Revamp CONF_IDLE handling

This patch revamps IDLE power save handling in the driver.
Two separate functions (radio enable/disable) are introduced,
because the semantics of radio handling is just not the same
as the start()/stop() callbacks. For example, the HW must not
be disabled, instead, the PHY has to be disabled in radio_disable().
Also, the HW has to be reset properly in radio enable/disable and
certain registers have to be programmed only once, in the
start() callback.

The radio_enable() routine doesn't need the PS wrappers since
we set the HW power mode to AWAKE anyway before calling it.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Fix async fifo for AR9287
Sujith [Tue, 1 Jun 2010 09:44:10 +0000 (15:14 +0530)]
ath9k_hw: Fix async fifo for AR9287

Async fifo is now enabled only for versions 1.3 and above.
Enable it in the appropriate place, in the reset routine,
instead of process_ini().

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Update the PCI WAR register
Sujith [Tue, 1 Jun 2010 09:44:09 +0000 (15:14 +0530)]
ath9k_hw: Update the PCI WAR register

This patch updates the PCI power save handling
code, fixing ASPM hangs and handling device state D3
properly.

The WAR register is programmed with the correct
values now.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Cleanup TX power calculation for AR9287
Sujith [Tue, 1 Jun 2010 09:44:07 +0000 (15:14 +0530)]
ath9k_hw: Cleanup TX power calculation for AR9287

* Add a few comments, and move the updation of max_power_level
  to a helper routine. This is also done by non-4K based chipsets,
  this will be fixed in a separate patch.

* Remove two WARs which are required for old AR5416 chipsets,
  and are not needed for AR9287.

* Fix indentation and make things readable.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Optimize ath9k_hw_ar9287_set_board_values
Sujith [Tue, 1 Jun 2010 09:44:06 +0000 (15:14 +0530)]
ath9k_hw: Optimize ath9k_hw_ar9287_set_board_values

Rather than doing a series of RMWs, calculate the
value to be written to the register in question and
do a single REGWRITE. This improves bringup time.

This depends on the analog_shiftreg configuration option,
which is currently buggy. For AP mode, a delay of 100us
has to be the default. For station mode, this knob has to
be enabled on a per-case basis, though it is a little
unclear on when to enable a delay. This can be fixed later though.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Cleanup eeprom_9287.c
Sujith [Tue, 1 Jun 2010 09:44:04 +0000 (15:14 +0530)]
ath9k_hw: Cleanup eeprom_9287.c

* Fix whitespace damage.
* Remove unused debug messages.
* Introduce a macro NUM_EEP_WORDS.
* Convert AR9287 to lowercase in function names.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: simplify key locking
Johannes Berg [Tue, 1 Jun 2010 08:19:19 +0000 (10:19 +0200)]
mac80211: simplify key locking

Since I recently made station management able
to sleep, I can now rework key management as
well; since it will no longer need a spinlock
and can also use a mutex instead, a bunch of
code to allow drivers' set_key to sleep while
key management is protected by a spinlock can
now be removed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/ipw2x00/ipw2100.c: Remove unnecessary kmalloc casts
Joe Perches [Tue, 1 Jun 2010 03:23:15 +0000 (20:23 -0700)]
drivers/net/wireless/ipw2x00/ipw2100.c: Remove unnecessary kmalloc casts

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: move plink state
Johannes Berg [Mon, 31 May 2010 09:40:23 +0000 (11:40 +0200)]
mac80211: move plink state

For some odd reason, the plink_state enum is
declared in the middle between aggregation
related structures. Move it down to make the
file easier to read.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: drop control frames after processing
Johannes Berg [Sun, 30 May 2010 12:53:43 +0000 (14:53 +0200)]
mac80211: drop control frames after processing

After ieee80211_rx_h_ctrl() processing we only
want to process management (including action)
frames, so there's no point in letting control
frames continue.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: remove useless work starting
Johannes Berg [Fri, 28 May 2010 12:48:52 +0000 (14:48 +0200)]
mac80211: remove useless work starting

Ever since we use only cfg80211 for configuration,
there is no configuration that could be pending at
this point, cfg80211 will have the configuration
that is pending and apply it afterwards.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: move WEP weak IV check
Johannes Berg [Fri, 28 May 2010 12:24:19 +0000 (14:24 +0200)]
mac80211: move WEP weak IV check

I suspect the compiler will do this optimisation
anyway, but it seems cleaner to move this into
the WEP switch case.

Also make rx_h_decrypt use a local variable for
the frame_control so that we don't need to reload
the hdr variable for this after linearizing.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: clean up ieee80211_stop_tx_ba_session
Johannes Berg [Thu, 27 May 2010 12:41:07 +0000 (14:41 +0200)]
mac80211: clean up ieee80211_stop_tx_ba_session

There's no sense in letting anything but internal
mac80211 functions set the initiator to anything
but WLAN_BACK_INITIATOR, since WLAN_BACK_RECIPIENT
is only valid when we have received a frame from
the peer, which we react to directly in mac80211.

The debugfs code I recently added got this wrong
as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: Add support for hardware ARP query filtering
Juuso Oikarinen [Thu, 27 May 2010 12:32:13 +0000 (15:32 +0300)]
mac80211: Add support for hardware ARP query filtering

Some hardware allow extended filtering of ARP frames not intended for
the host. To perform such filtering, the hardware needs to know the current
IP address(es) of the host, bound to its interface.

Add support for ARP filtering to mac80211 by adding a new op to the driver
interface, allowing to configure the current IP addresses. This op is called
upon association with the currently configured address(es), and when
associated whenever the IP address(es) change.

This patch adds configuration of IPv4 addresses only, as IPv6 addresses don't
need ARP filtering.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: remove tx status ampdu_ack_map
Johannes Berg [Wed, 26 May 2010 15:19:25 +0000 (17:19 +0200)]
mac80211: remove tx status ampdu_ack_map

There's a single use of this struct member, but
as it is write-only it clearly not necessary.
Thus we can free up some space here, even if we
don't need it right now it seems pointless to
carry around the variable.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: remove bogus mod_timer() call
Johannes Berg [Wed, 26 May 2010 14:41:40 +0000 (16:41 +0200)]
mac80211: remove bogus mod_timer() call

The IBSS code has a bogus mod_timer(..., 0) call,
we shouldn't ever pass a constant value to the
function since any constant value could be in the
future or the past.

However, invoking the timer here is not necessary
at all, since we just finished scanning and just
need to have the IBSS code run again from the
workqueue later, so factor out the work starting
and use that instead.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: use the key handling code from ath9k_common instead of duplicating it
Felix Fietkau [Tue, 25 May 2010 17:42:46 +0000 (19:42 +0200)]
ath9k: use the key handling code from ath9k_common instead of duplicating it

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_common: use allocated key cache entries for multi BSS crypto support
Felix Fietkau [Tue, 25 May 2010 17:42:45 +0000 (19:42 +0200)]
ath9k_common: use allocated key cache entries for multi BSS crypto support

This patch replaces the buggy 'ath9k: Group Key fix for VAPs' change.

For AP mode group keys, use the BSSID as lookup mac address, with
the multicast keysearch bit set.
For IBSS mode, use the peer's MAC address with multicast keysearch.
For STA mode, keep using the group key slots.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: add multicast key search support
Felix Fietkau [Tue, 25 May 2010 17:42:44 +0000 (19:42 +0200)]
ath9k_hw: add multicast key search support

If a MAC address for a key table entry is flagged with the
multicast bit (0x01), indicate to the hardware that multicast
lookup instead of unicast lookup should be used. The multicast
bit itself never makes it to the actual keytable entry register,
as it is shifted out.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agossb: fast powerup delay calculation for PMU capable devices
Rafał Miłecki [Mon, 24 May 2010 19:50:24 +0000 (21:50 +0200)]
ssb: fast powerup delay calculation for PMU capable devices

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Gábor Stefanik <netrolller.3d@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agossb: update PMU init to match specs
Rafał Miłecki [Mon, 24 May 2010 19:50:23 +0000 (21:50 +0200)]
ssb: update PMU init to match specs

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoRevert "iwlwifi: move _agn statistics related structure"
John W. Linville [Thu, 3 Jun 2010 17:55:37 +0000 (13:55 -0400)]
Revert "iwlwifi: move _agn statistics related structure"

This reverts commit a2064b7a4a22d118087898e4308670da7ac07911.

when CONFIG_IWLAGN=n:

drivers/net/wireless/iwlwifi/iwl-rx.c:254: error: 'struct iwl_priv' has no member named '_agn'
drivers/net/wireless/iwlwifi/iwl-rx.c:303: error: 'struct iwl_priv' has no member named '_agn'
drivers/net/wireless/iwlwifi/iwl-rx.c:304: error: 'struct iwl_priv' has no member named '_agn'
drivers/net/wireless/iwlwifi/iwl-rx.c:305: error: 'struct iwl_priv' has no member named '_agn'
drivers/net/wireless/iwlwifi/iwl-rx.c:306: error: 'struct iwl_priv' has no member named '_agn'

and many more.

Conflicts:

drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-rx.c

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Remove suspicious register write
Helmut Schaa [Thu, 3 Jun 2010 08:52:17 +0000 (10:52 +0200)]
rt2x00: Remove suspicious register write

Remove suspicious register write as the reg variable is never filled
with an TX_SW_CFG2 associated value before.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: fix use of mcs rates
Helmut Schaa [Thu, 3 Jun 2010 08:52:15 +0000 (10:52 +0200)]
rt2x00: fix use of mcs rates

In case of mcs rates txrate->idx contains the mcs index to be used for
transmission. Previously the mcs values dedicated for legacy rates where
used for mcs transmissions which resulted in the use of mcs 0 in a number
of cases (e.g. for all mcs rates >= 15 as rt2x00 does not register legacy
rates with indexes >= 15).

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Update TX_SW_CFG initvals for 305x SoC
Helmut Schaa [Thu, 3 Jun 2010 08:52:13 +0000 (10:52 +0200)]
rt2x00: Update TX_SW_CFG initvals for 305x SoC

Update TX_SW_CFG initvals for 305x SoC to match with the appropriate
legacy driver.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Use IEEE80211_TX_CTL_STBC flag
Ivo van Doorn [Thu, 3 Jun 2010 08:52:11 +0000 (10:52 +0200)]
rt2x00: Use IEEE80211_TX_CTL_STBC flag

Use the IEEE80211_TX_CTL_STBC flag to determine the
correct value to be used for the STBC field in the
TX descriptor

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: rt2800: disable TX STBC for 1 stream devices
Helmut Schaa [Thu, 3 Jun 2010 08:52:10 +0000 (10:52 +0200)]
rt2x00: rt2800: disable TX STBC for 1 stream devices

Disable TX STBC for 1 stream devices as a minimum of 2 streams is needed for TX STBC.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Fix HT40 operation in rt2800.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:52:08 +0000 (10:52 +0200)]
rt2x00: Fix HT40 operation in rt2800.

Closer inspection of the legacy Ralink driver reveals that in case of HT40+
or HT40- we must adjust the frequency settings that we program to the device.
Implement the same adjustment in the rt2x00 code.

With this HT40 seems to work for all devices supported by rt2800pci and
rt2800usb.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Sync rt2800 MCU boot signal with Ralink driver.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:52:06 +0000 (10:52 +0200)]
rt2x00: Sync rt2800 MCU boot signal with Ralink driver.

Latest versions of the Ralink rt2800 family drivers use 0 as the token value,
not 0xff.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Move PCI/USB specific register initializations to rt2800{pci,usb}.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:52:04 +0000 (10:52 +0200)]
rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb}.

This prevents us having common code depend on PCI or USB specific code.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Simplify check for external LNA in rt2800_init_rfcsr.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:52:02 +0000 (10:52 +0200)]
rt2x00: Simplify check for external LNA in rt2800_init_rfcsr.

Instead of parsing the EEPROM information, use the flag that was set during
device initialization.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Introduce separate interface type for PCI-express.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:52:00 +0000 (10:52 +0200)]
rt2x00: Introduce separate interface type for PCI-express.

Needed later for PCI-express specific code in rt2800pci.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Move all register definitions for rt2800 to rt2800.h.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:59 +0000 (10:51 +0200)]
rt2x00: Move all register definitions for rt2800 to rt2800.h.

There is no point on having them separated across 3 files.
At the same time rename USB_CYC_CFG to its proper name US_CYC_CNT
(as per the datasheet).

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Remove RT2870 chipset identification.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:57 +0000 (10:51 +0200)]
rt2x00: Remove RT2870 chipset identification.

There is no evidence, either in adapters or in the Ralink code, that such
a device actually exists. All so-call RT2870 adapter identify themselves
as RT2860.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Centralize rt2800 beacon writing.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:53 +0000 (10:51 +0200)]
rt2x00: Centralize rt2800 beacon writing.

The beacon writing functions of rt2800pci and rt2800usb are now identical.
Move them to rt2800lib to only have one central function.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Clean up USB vendor request buffer functions.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:51 +0000 (10:51 +0200)]
rt2x00: Clean up USB vendor request buffer functions.

There is no need to force the separation between a buffer USB vendor
request that does fit the CSR cache and one that doesn't onto the
callers. This is something that the rt2x00usb_vendor_request_buff
function can figure out by itself.
Combine the rt2x00usb_vendor_request_buff and
rt2x00usb_vendor_request_large_buff functions into a single one, as
both of them were equivalent for small buffers anyway.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Fix rt2800usb TX descriptor writing.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:50 +0000 (10:51 +0200)]
rt2x00: Fix rt2800usb TX descriptor writing.

The recent changes to skb handling introduced a bug in the rt2800usb
TX descriptor writing whereby the length of the USB packet wasn't
calculated correctly.
Found via code inspection, as the devices themselves didn't seem to mind.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Properly reserve room for descriptors in skbs.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:45 +0000 (10:51 +0200)]
rt2x00: Properly reserve room for descriptors in skbs.

Instead of fiddling with the skb->data pointer and thereby risking
out of bounds accesses, properly reserve the space needed in an
skb for descriptors.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Reverse calling order of bus write_tx_desc and driver write_tx_desc.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:43 +0000 (10:51 +0200)]
rt2x00: Reverse calling order of bus write_tx_desc and driver write_tx_desc.

For rt2800 reverse the calling order of rt2x00pci_write_data and
rt2800pci_write_data. Currently rt2800pci_write_data calls rt2x00pci_write_data
as there can be only 1 driver callback function specified by the driver.
Reverse this calling order by introducing a new driver callback function,
called write_tx_datadesc, which is called from the bus-specific write_tx_data
functions.
Preparation for futher cleanups in the skb data handling of rt2x00.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agort2x00: Push beacon TX descriptor writing to drivers.
Gertjan van Wingerde [Thu, 3 Jun 2010 08:51:41 +0000 (10:51 +0200)]
rt2x00: Push beacon TX descriptor writing to drivers.

Not all the devices require a TX descriptor to be written (i.e. rt2800
device don't require them). Push down the creation of the TX descriptor
to the device drivers so that they can decide for themselves whether
a TX descriptor is to be created.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
14 years agoath9k_htc: fix build error when ATH9K_HTC_DEBUGFS not enabled
John W. Linville [Wed, 2 Jun 2010 20:53:58 +0000 (16:53 -0400)]
ath9k_htc: fix build error when ATH9K_HTC_DEBUGFS not enabled

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Fix scan parameter handling for 5GHz
Juuso Oikarinen [Mon, 24 May 2010 08:18:20 +0000 (11:18 +0300)]
wl1271: Fix scan parameter handling for 5GHz

The 5GHz bands were scanned without the proper IE's in place, preventing
proper 5GHz scanning. This patches fixes the problem by storing a pointer
to the scan request (with the IE's) for all iterations of scan.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Use proper rates for PSM entry/exit null-funcs for 5GHz
Juuso Oikarinen [Mon, 24 May 2010 08:18:19 +0000 (11:18 +0300)]
wl1271: Use proper rates for PSM entry/exit null-funcs for 5GHz

A fixed 1 mbps rate was used for the PSM entry/exit null-func frames. Fix this
by using the basic rates instead.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: the core wl1271 module shouldn't depend on SPI_MASTER
Luciano Coelho [Mon, 24 May 2010 08:18:18 +0000 (11:18 +0300)]
wl1271: the core wl1271 module shouldn't depend on SPI_MASTER

The core wl1271 module can also be used with SDIO, so it should not depend on
SPI_MASTER.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Flush TX buffers to air before going to idle
Juuso Oikarinen [Mon, 24 May 2010 08:18:17 +0000 (11:18 +0300)]
wl1271: Flush TX buffers to air before going to idle

The mac80211 changes to idle almost immediately after transmitting some
frames, such as deauth etc. When going to idle, the wl1271 is disconnected,
which causes TX frames already on buffers, but not yet transmitted, to be
deleted.

To make sure deauth frames reach the air, allow the TX buffers to flush
before proceeding to idle.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Idle handling into own function
Juuso Oikarinen [Mon, 24 May 2010 08:18:16 +0000 (11:18 +0300)]
wl1271: Idle handling into own function

As there is more and more stuff triggered by going in and out of idle,
create a separate function for handling that.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Prevent dropping of TX frames in joins
Juuso Oikarinen [Mon, 24 May 2010 08:18:15 +0000 (11:18 +0300)]
wl1271: Prevent dropping of TX frames in joins

The wl1271 uses a session counter in CMD_JOIN and TX frame descriptors. This
counter is used to determine which frames to drop when the CMD_JOIN is
executed.

The driver executes CMD_JOIN multiple times upon association and sometimes
disassociation, and we don't want any frames to get lost.

Fix this by incrementing the session counter only when leaving idle (not every
CMD_JOIN as before.) Also, remove the TX flush flag from the CMD_JOIN options.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: cleanup: remove unneeded null check
Dan Carpenter [Sat, 22 May 2010 20:33:11 +0000 (22:33 +0200)]
ath9k: cleanup: remove unneeded null check

We dereference "wmi" on the line before and also when we initialize "ah".
This check has always been after a dereference since the first commit a
couple months ago.  Looking through the code, it looks like "wmi" can't
actually be null here so I just removed the check.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/prism54: Use memdup_user
Julia Lawall [Sat, 22 May 2010 08:25:44 +0000 (10:25 +0200)]
drivers/net/wireless/prism54: Use memdup_user

Use memdup_user when user data is immediately copied into the
allocated region.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@

-  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+  to = memdup_user(from,size);
   if (
-      to==NULL
+      IS_ERR(to)
                 || ...) {
   <+... when != goto l1;
-  -ENOMEM
+  PTR_ERR(to)
   ...+>
   }
-  if (copy_from_user(to, from, size) != 0) {
-    <+... when != goto l2;
-    -EFAULT
-    ...+>
-  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Fix bug in validating received data length for edma
Vasanthakumar Thiagarajan [Thu, 20 May 2010 21:34:48 +0000 (14:34 -0700)]
ath9k: Fix bug in validating received data length for edma

The rx status length should also be taken into account while
validating the length of a received frame.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Fix bug in accessing skb->data of rx frame for edma
Vasanthakumar Thiagarajan [Thu, 20 May 2010 21:34:47 +0000 (14:34 -0700)]
ath9k: Fix bug in accessing skb->data of rx frame for edma

Skip the rx status portion in skb->data before accessing ieee80211
frame header.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Clean up few function parameters in recv.c
Vasanthakumar Thiagarajan [Thu, 20 May 2010 21:34:46 +0000 (14:34 -0700)]
ath9k: Clean up few function parameters in recv.c

ath9k_rx_skb_preprocess() needs only ieee80211 frame header,
pass only frame headers instead of skb to that function. Also
remove ineffective frame dump in ath9k_process_rate().

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Move driver specific structures
Sujith [Thu, 20 May 2010 10:04:40 +0000 (15:34 +0530)]
ath9k: Move driver specific structures

A bunch of data structures are present in the
common module, which are internal to ath9k.
Move them to ath9k.h

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Move ath9k specific RX code to driver
Sujith [Thu, 20 May 2010 10:04:38 +0000 (15:34 +0530)]
ath9k: Move ath9k specific RX code to driver

This patch relocates RX processing code from the
common module to ath9k. This reduces the size
of the common module which is also used by ath9k_htc.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless: Storage class should be before const qualifier
Tobias Klauser [Thu, 20 May 2010 08:38:11 +0000 (10:38 +0200)]
drivers/net/wireless: Storage class should be before const qualifier

The C99 specification states in section 6.11.5:

The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Enable TX IQ calibration on AR9003
Luis R. Rodriguez [Wed, 19 May 2010 20:45:50 +0000 (16:45 -0400)]
ath9k_hw: Enable TX IQ calibration on AR9003

To enable it we now disable and re-enable the PHY chips
after TX IQ calibration.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agocfg80211: make action channel type optional
Johannes Berg [Wed, 19 May 2010 10:17:12 +0000 (12:17 +0200)]
cfg80211: make action channel type optional

When sending action frames, we want to verify
that we do that on the correct channel. However,
checking the channel type in addition can get in
the way, since the channel type could change on
the fly during an association, and it's not
useful to have the channel type anyway since it
has no effect on the transmission. Therefore,
make it optional to specify so that if wanted,
it can still be checked, but is not required.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: print error message if ANI levels are out of range
Bruno Randolf [Wed, 19 May 2010 01:31:42 +0000 (10:31 +0900)]
ath5k: print error message if ANI levels are out of range

Since we have sysfs to manually set the ANI levels, we should print errors to
the kernel log if the values are out of bounds.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: always calculate ANI listen time
Bruno Randolf [Wed, 19 May 2010 01:31:37 +0000 (10:31 +0900)]
ath5k: always calculate ANI listen time

Calculate 'listen' time also when automatic ANI is off, since this and the
"busy" time is useful information also in manual mode.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: add sysfs files for ANI parameters
Bruno Randolf [Wed, 19 May 2010 01:31:32 +0000 (10:31 +0900)]
ath5k: add sysfs files for ANI parameters

/sys/class/ieee80211/phy0/device/ani/ani_mode
/sys/class/ieee80211/phy0/device/ani/noise_immunity_level
/sys/class/ieee80211/phy0/device/ani/spur_level
/sys/class/ieee80211/phy0/device/ani/firstep_level
/sys/class/ieee80211/phy0/device/ani/ofdm_weak_signal_detection
/sys/class/ieee80211/phy0/device/ani/cck_weak_signal_detection
/sys/class/ieee80211/phy0/device/ani/noise_immunity_level_max
/sys/class/ieee80211/phy0/device/ani/spur_level_max
/sys/class/ieee80211/phy0/device/ani/firstep_level_max

sysfs has a lot of symlinks, so you can find the files also in other locations,
like (by PCI ID) /sys/devices/pci0000:00/0000:00:11.0/ani and others.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: use ath5k_softc as driver data
Bruno Randolf [Wed, 19 May 2010 01:31:26 +0000 (10:31 +0900)]
ath5k: use ath5k_softc as driver data

It's our "private driver data"... It's used more often and hw is the mac80211
part. This makes more sense with the next (sysfs) patch.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: clarify logic when to enable spur mitigation filter
Bruno Randolf [Wed, 19 May 2010 01:31:21 +0000 (10:31 +0900)]
ath5k: clarify logic when to enable spur mitigation filter

The old code logically did not make sense and seems to have been confused by
the fact that we could have newer EEPROMs on older hardware. In any case the
spur mitigation filter was set if the srev was >= AR5K_SREV_AR5424.

Spur info is available only from EEPROM versions bigger than 5.3 but but the
EEPOM routines will use static values for older versions, so that should be
o.k.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: remove ATH_TRACE macro
Bruno Randolf [Wed, 19 May 2010 01:31:16 +0000 (10:31 +0900)]
ath5k: remove ATH_TRACE macro

Now that we have ftrace, it is not needed any more.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: run NF calibration only every 60 seconds
Bruno Randolf [Wed, 19 May 2010 01:31:10 +0000 (10:31 +0900)]
ath5k: run NF calibration only every 60 seconds

Since NF calibration interferes with TX and RX and also has been the cause of
other problems (when it's run concurrently with ath5k_reset) we want to run it
less often - every 60 seconds for now.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: Stop queues only for NF calibration
Bruno Randolf [Wed, 19 May 2010 01:31:05 +0000 (10:31 +0900)]
ath5k: Stop queues only for NF calibration

As far as we know, only NF calibration interferes with RX/TX so we can
leave the queues enabled for the other calibrations.

BTW: Stopping the queues is not enough for avoiding transmissions, since there
might be packets in the queue + beacons are also sent regularly! But i leave it
like this until we have a better solution (stopping TX DMA?).

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: move noise floor calibration into tasklet
Bruno Randolf [Wed, 19 May 2010 01:31:00 +0000 (10:31 +0900)]
ath5k: move noise floor calibration into tasklet

Seperate noise floor calibration from other PHY calibration and move it to the
tasklet. This is the first step to more separation of different calibrations.

Also move out ath5k_hw_request_rfgain_probe(ah) so we have one clean function
for I/Q calibration on 5111x parts.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: initialize calibration timers
Bruno Randolf [Wed, 19 May 2010 01:30:55 +0000 (10:30 +0900)]
ath5k: initialize calibration timers

Initialize calibration timers on reset, since otherwise they might be in the
future and the calibration tasklet might not be scheduled for a long time.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorndis_wlan: increase assocbuf size and validate association info offsets from driver
Jussi Kivilinna [Tue, 18 May 2010 08:27:31 +0000 (11:27 +0300)]
rndis_wlan: increase assocbuf size and validate association info offsets from driver

Buffer size for get_association_info was limited to WEXT event size. Since association
info no longer is sent through WEXT, this limit is not needed. Code also did not
check if data get truncated, memory outside buffer might be addressed. Fix all these.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: Enable auto sleep for ar9003
Vasanthakumar Thiagarajan [Tue, 18 May 2010 01:57:56 +0000 (18:57 -0700)]
ath9k_hw: Enable auto sleep for ar9003

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Fix power save with auto sleeping
Vasanthakumar Thiagarajan [Tue, 18 May 2010 01:57:55 +0000 (18:57 -0700)]
ath9k: Fix power save with auto sleeping

Rx should not be disabed/disabled when hw supports auto sleeping.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Make sure null func frame is acked before going into PS for ar9003
Vasanthakumar Thiagarajan [Tue, 18 May 2010 01:57:54 +0000 (18:57 -0700)]
ath9k: Make sure null func frame is acked before going into PS for ar9003

Add missing code to handle nullfunc frame completion in
ath_tx_edma_tasklet().

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowireless: fix several minor description typos
Walter Goldens [Tue, 18 May 2010 11:44:54 +0000 (04:44 -0700)]
wireless: fix several minor description typos

Signed-off-by: Walter Goldens <goldenstranger@yahoo.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agocfg80211: don't refuse HT20 channels on devices that don't support HT40
Helmut Schaa [Mon, 17 May 2010 15:30:59 +0000 (17:30 +0200)]
cfg80211: don't refuse HT20 channels on devices that don't support HT40

Don't refuse HT20 channels on devices that don't support HT40.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Enable RX STBC for AR9271
Sujith [Mon, 17 May 2010 06:31:21 +0000 (12:01 +0530)]
ath9k_htc: Enable RX STBC for AR9271

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Enable SGI in HT20 for AR9271
Sujith [Mon, 17 May 2010 06:31:19 +0000 (12:01 +0530)]
ath9k_htc: Enable SGI in HT20 for AR9271

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Update HT configuration properly
Sujith [Mon, 17 May 2010 06:31:18 +0000 (12:01 +0530)]
ath9k_htc: Update HT configuration properly

Use BSS_CHANGED_HT to handle HT parameter changes.
The rate information on the target has to be updated
to handle changes in HT configuration.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Cleanup rate initialization
Sujith [Mon, 17 May 2010 06:31:16 +0000 (12:01 +0530)]
ath9k_htc: Cleanup rate initialization

This patch removes a large chunk of code dealing
with rate management within the driver and simplifying
things by removing the hacky method of calculating
HT changes. A subsequent patch would fix this by
just using BSS_CHANGED_HT from mac80211.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_htc: Initvals update for AR9271
Sujith [Mon, 17 May 2010 06:31:13 +0000 (12:01 +0530)]
ath9k_htc: Initvals update for AR9271

Update from internal systems engineering team.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/orinoco: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:24:07 +0000 (23:24 +0200)]
drivers/net/wireless/orinoco: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/p54: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:22:55 +0000 (23:22 +0200)]
drivers/net/wireless/p54: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/ipw2x00: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:21:01 +0000 (23:21 +0200)]
drivers/net/wireless/ipw2x00: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/b43: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:20:26 +0000 (23:20 +0200)]
drivers/net/wireless/b43: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/ath/ath9k: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:17:19 +0000 (23:17 +0200)]
drivers/net/wireless/ath/ath9k: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/iwmc3200wifi: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:16:58 +0000 (23:16 +0200)]
drivers/net/wireless/iwmc3200wifi: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/libertas_tf: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:16:03 +0000 (23:16 +0200)]
drivers/net/wireless/libertas_tf: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/wl12xx: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:15:10 +0000 (23:15 +0200)]
drivers/net/wireless/wl12xx: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodrivers/net/wireless/libertas: Use kmemdup
Julia Lawall [Sat, 15 May 2010 21:12:28 +0000 (23:12 +0200)]
drivers/net/wireless/libertas: Use kmemdup

Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k/debug: fixup the return codes
Dan Carpenter [Fri, 14 May 2010 13:25:39 +0000 (15:25 +0200)]
ath9k/debug: fixup the return codes

Changed -EINVAL to -EFAULT if copy_to_user() failed.
Changed 0 to -ENOMEM if allocations failed.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k/debug: improve the snprintf() handling
Dan Carpenter [Fri, 14 May 2010 13:24:37 +0000 (15:24 +0200)]
ath9k/debug: improve the snprintf() handling

The snprintf() function returns the number of bytes that *would* have
been written (not counting the NULL terminator) and that can potentally
be more than the size of the buffer.

In this patch if there were one liners where string clearly fits into
the buffer, then I changed snprintf to sprintf().  It's confusing to use
the return value of snprintf() as a limitter without verifying that it's
smaller than size.  This is what initially caught my attention here.
If we use the return value of sprintf() instead future code auditors will
assume we've verified that it fits already.

Also I did find some places where it made sense to use the return value
after we've verified that it is smaller than the buffer size.

Finally the read_file_rcstat() function added an explicit NULL terminator
before calling snprintf().  That's unnecessary because snprintf() will
add the null terminator automatically.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: fix dma direction for map/unmap in ath_rx_tasklet
Ming Lei [Fri, 14 May 2010 13:15:38 +0000 (21:15 +0800)]
ath9k: fix dma direction for map/unmap in ath_rx_tasklet

For edma, we should use DMA_BIDIRECTIONAL, or else use
DMA_FROM_DEVICE.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agolibertas: Added callback functions to support SDIO suspend/resume.
Amitkumar Karwar [Wed, 19 May 2010 10:24:38 +0000 (03:24 -0700)]
libertas: Added callback functions to support SDIO suspend/resume.

In suspend() host sleep is activated using already configured
host sleep parameters through wol command, and in resume() host
sleep is cancelled. Earlier priv->fw_ready flag used to reset and
set in suspend and resume handler respectively. Since after suspend
only host goes into sleep state and firmware is always ready, those
changes in flag state are removed.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>