pcie.c: Fix section mismatch
cpufreq: update lpj only if frequency has changed

During scaling up of cpu frequency, loops_per_jiffy
is updated upon invoking PRECHANGE notifier.
If setting to new frequency fails in cpufreq driver,
lpj is left at incorrect value.

Hence update lpj only if cpu frequency is changed,
i.e. upon invoking POSTCHANGE notifier.

Penalty would be that during time period between
changing cpu frequency & invocation of POSTCHANGE
notifier, udelay(x) may not gurantee minimal delay
of 'x' us for frequency scaling up operation.

Perhaps a better solution would be to define
CPUFREQ_ABORTCHANGE & handle accordingly, but then
it would be more intrusive (using ABORTCHANGE may
help drivers also; if any has registered notifier
and expect POST for a PRECHANGE, their needs can
be taken care using ABORT)

Signed-off-by: Afzal Mohammed <afzal@ti.com>
net / netfilter: remove annoying 'comparison will always be true' warning

-adding a new function which avoids this warning
-using the new function in all places where it makes no sense to check
timer: optimize apply_slack()

__fls(mask) is equivalent to find_last_bit(&mask, BITS_PER_LONG), but cheaper.
find_last_bit was showing up high on the list when I was profiling for stalls
on icache misses on a system with very small cache size (MIPS).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
mac80211: mark the p2p0 interface with a special flag

This flag indicates the lower driver the interface will be used for
p2p management operations only (p2p find). This will be superseded
by pending upstream patches making p2p a wdev-only interface.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl12xx: enable the dev role on the p2p mgmt iface

When starting a p2p mgmt interface, enable its device role. This
is used to keep the FW Rx filters down for the p2p dev role MAC address.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl12xx: don't ROC or switch to MR on p2p mgmt on-chan Tx

When in the SR FW and Tx arrives on the p2p mgmt interface on the
same channel as an existing p2p role, don't switch to MR or ROC on
the newly started device role. Just start the device role and use it
for Tx. Do the ROC as usual in the MR FW.

This avoids problems during p2p operation, when we need to respond
to packets via the p2p-dev interface (i.e. provision discovery in GO).

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wl12xx: Always pass DMA-able buffers to mmc functions

Some of the mmc drivers initiate DMA transfers with buffers passed from
higher layers. This means that the driver shouldn't ever pass non
DMA-able buffers, such as ones that are unaligned, allocated on the
stack or static.

Fix a couple of calls to the mmc layer in which buffers which weren't
necessarily DMA-able were passed.

Reported-by: "De Cesco, Jonathan" <jonathanc@ti.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
Revert "wl12xx: fix BA session after AP recovery"

This reverts commit 5ec6973c0fd6f3d2744d174576beb2e7ad007e0b.
which introduced a bug where the hlid allocated for the sta during
reconfig wasn't saved in the ieee80211_sta which was passed
from mac80211. Instead a copy of ieee80211_sta was created and
maintained by wl12xx. This is wrong as mac80211 needs to be in
sync with us. The result could be attempting to free the wrong
hlid when mac80211 removes the sta among others. Fix this by
avoiding the copy and instead keep the pending peers list by
linking the driver private struct at the end of ieee80211_sta.

Another bug existed in wl1271_bss_info_changed_ap() where when
adding the peers the state was updated effectively only for the
first peer.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
mac80211: add stations after AP start on reconfig

When performing a HW restart for an AP mode interface, add stations back
only after the AP is beaconing. This mimics the normal flow of STA
addition on AP.

Some devices (wlcore) do not support adding stations before beaconing,
so this has the added benefit of making recovery work for them.

[Eyal - backported to R5]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
mac80211: stop Rx during HW reconfig

While HW reconfig is in progress, drop all incoming Rx. This prevents
incoming packets from changing the internal state of the driver or
calling callbacks of the low level driver while it is in inconsistent
state.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
mac80211: always set in_reconfig=false on wakeup

If the interfaces were removed just before a restart
work was started, open_count will be 0, and most of
the reconfig work will be skipped, including the
resetting of local->in_reconfig to false.

Leaving local->inconfig = true will result in
dropping any incoming packet.

Fix it by always setting local->in_reconfig = false
(even if there are no active interfaces).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
patch: introduce T(R) scheduler