Felix Fietkau [Fri, 12 Nov 2010 19:14:44 +0000 (11:14 -0800)]
compat: fix pm_qos_params compile error on 2.6.35
Linux 2.6.35 pm_qos_params.h is missing a #ifndef/define/endif around
its header file contents, causing a compile error when its functions
are overwritten by macros in the compat header files.
Fix this by adding these to the compat version of this header file.
This patch moves code out from wireless drivers where two different
functions are defined in three code locations for the same purpose and
provides a common function to sign extend a 32-bit value.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
In the error path, _request_firmware sets
firmware_p to NULL rather than *firmware_p,
which leads to passing a freed firmware
struct to drivers when the firmware file
cannot be found. Fix this.
Reported-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
All kernels older than 2.6.33 would be affected by this.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Hauke Mehrtens [Sat, 23 Oct 2010 18:13:59 +0000 (20:13 +0200)]
compat: fix device_lock functions on non rt kernel
CONFIG_NONE and CONFIG_PREEMPT_VOLUNTARY are not added by the last RT
patch. I have not found any references to CONFIG_NONE, probably
CONFIG_PREEMPT_NONE was meant, but that is also wrong like
CONFIG_PREEMPT_VOLUNTARY. These two options are also in the normal kernel
config system without the rt patch.
This patch only checks for KConfig options added by the rt patch, but a
rt-patch user could also select PREEMPT_NONE or PREEMPT_VOLUNTARY, and
compat-wireless will not build. I do not think this will hapen often, so leave
it like this.
Blaise Gassend [Fri, 22 Oct 2010 09:32:04 +0000 (02:32 -0700)]
compat: Fixes missing sem member in struct device for RT PREEMPT prior to 2.6.34
The RT PREEMPT patch eliminates the sem member in struct device
breaking device_lock, device_unlock and device_trylock in kernels
prior to 2.6.34. The attached patch replaces the use of sem by a use
of mutex.
Signed-off-by: Blaise Gassend <blaise@willowgarage.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
In kernel <= 2.6.28 the member napi_list in struct net_device is only
availabe if CONFIG_NETPOLL is set. We should initialize it only if it
is available.
pci-aspm.h was introduced in kernel 2.6.25 and is used by the ath5k and iwlwifi driver.
v2: Do not place the empty functions into pci-aspm.h. Now we do not
have to change pci-aspm.h when it changes in the mainline kernel only
compat-2.6.26.h has to be changed.
This fixes a compilation warning on Ubuntu's 2.6.24
kernel which added the PM_EVENT_SLEEP even though upstream
Linux 2.6.24.7 (the last 2.6.24) does not have it. Its
a trivial change and I'm willing to support it to avoid
compilation.
Hauke Mehrtens [Tue, 17 Aug 2010 18:32:32 +0000 (20:32 +0200)]
compat: backport net_ns_type_operations
net_ns_type_operations needs to be exported. This only works for kernel
>= 2.6.35 because struct kobj_ns_type_operations was introduced in
kernel 2.6.35.
compat: add br_port_exists() and ask for inclusion upstream
The br_port_exists() call is used internally on private bridge
code on net/bridge/ to check if a netdevice is a bridge port.
The way to check if a netdevice is a bridge port has changed
for 2.6.36 from checking the netdev->br_port pointer to
checking for a IFF_BRIDGE_PORT flag on the netdev->priv_flags.
Instead of requiring backport code to ifdef the checks lets
move the private br_port_exists() to a public header accessible
by drivers and consistantly use it to check for the bridge
port.
I'll submit a patch upstream to move br_port_exists() to a public
header so that we don't have to later even require a patch on
backported code. We'll see if it gets accepted though.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
trace/define_trace.h can be included more often and it have to.
This fixes some errors like this:
WARNING: "__tracepoint_iwlwifi_dev_rx" [/home/hauke/compat-wireless/compat-wireless-git/drivers/net/wireless/iwlwifi/iwlcore.ko] undefined!
compat: Fix panic caused by NULL pointer derefence in rtnl_fill_ifinfo
get stats netdev ops is blindy called for older kernels (< 2.6.29) and
so assigning a NULL pointer from netdev_attach_ops causes a NULL pointer
dereference.
By default, netdev alloc provides an internal stats reference. So fill
this only if ndo_get_stats is defined.
Hauke Mehrtens [Sun, 6 Jun 2010 09:12:27 +0000 (11:12 +0200)]
compat: use kernel pm_qos_params.h
Do not use pm_qos_params.h from compat-wireless if the kernel also
ships this file. In kernel 2.6.35 pm_qos_params.h changed and the in
kernel header file is needed.
This will be used to identify the backport project
only during initialization, there is no associated
module parameter for this as there is no need for it.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
This will allow you to supply a version tag for the
backport you use. Compat-wireless will re-use this and
give it its own value based on the kernel we backport
from. It will use either the linux-next git describe
or the stable kernel git describe. Any delta on top of
the git tree should also be reflected then in case of
custom private trees/releases.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
compat: add new way to backport the usage of net_device_ops
We tend to #ifdef code that uses the new net_device_ops
on kernels older than 2.6.29. This tends to create a burden
on the upkeeping of the hunks. We can minimize our work by
instead definining a new netdev_attach_ops() which will do
our backport work for the older kernels and simply attach
the ops for newer kernels.
This should simplify backporting of network drivers
considerably.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
compat: fix uevent_suppress on 2.6.29 or older kernels
Missing uevent_suppress is causing two uevents instead of one, which is
confusing udev and sometimes causing firmware load to fail due to race
condition, so let's add it.
Pavel Roskin [Sat, 20 Feb 2010 01:17:42 +0000 (20:17 -0500)]
compat: move debugfs_remove_recursive() to compat-2.6.27
debugfs_remove_recursive() appeared in Linux 2.6.27, so it should be in
compat-2.6.27, not in compat-2.6.26. Don't compile it if
CONFIG_DEBUG_FS is disabled.