Hauke Mehrtens [Thu, 9 Jun 2011 22:04:44 +0000 (00:04 +0200)]
compat: add device name in register_netdevice(dev)
dev_alloc_name() is not called explicitly in the driver code any more,
but it is done in register_netdevice(). This causes devices getting
wrong names like "wlan%d". With this patch they get names like wlan0
again.
Hauke Mehrtens [Sun, 22 May 2011 10:47:34 +0000 (12:47 +0200)]
compat: remove wrong backport of kfree_rcu
Backporting kfree_rcu() in compat does not work as
struct rcu_head->func is always interpreted as a pointer in older
kernel versions, but when using kfree_rcu() it is set to an offset.
rcu_head->func is used in some functions in the kernel not backported
by compat-wireless.
In older kernel versions in __rcu_reclaim just the else path is available.
compat: do not include kstrto* for kernel >= 2.6.38.4
kstrto* went into kernel 2.6.38.4 and causes conflicts with the version
included in compat-wireless. We use strict_strtol to check if kstrto*
is already available.
kstrto* was not moved to compat-2.6.38.h because kernel version <=
2.6.38.3 needs this backport and some distributions like Ubuntu still
ship an older version of this kernel.
Reported-by: Andreas Hartmann <andihartmann@01019freenet.de> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/kstrtox.c is copied from lib/kstrtox.c in the Linux kernel.
This is needed by some drivers now.
For kernel < 2.6.26 div_u64 needs to be backported.
We should not copy the files like kstrtox.c, kfifo.c and so on to
compat/ by hand, but copy them when creating compat-wireless along with
the wireless drivers.
Hauke Mehrtens [Thu, 6 Jan 2011 17:16:38 +0000 (18:16 +0100)]
compat: backport kfifo
This is a copy of the hole kfifo implementation from a recent kernel
version. When we ship this implementation we do not have to backport
any kfifo related stuff any more.
Hauke Mehrtens [Sat, 1 Jan 2011 14:23:35 +0000 (06:23 -0800)]
compat: add generic functions for suspend/resume
This define is used to generate a suspend and a resume function for pci
devices using the old power management interface. The new interface was
introduced in kernel 2.6.29.
Hauke Mehrtens [Fri, 17 Dec 2010 22:41:38 +0000 (14:41 -0800)]
compat: backport pci_is_pcie and pci_pcie_cap
compat_is_pcie already did the same thing as pci_is_pcie, but this
method is now in kernel so the mainline drivers should use this
function instead of accessing the member in the struct directly. We
backported this function for older kernels.
pci_pcie_cap is used in rtlwifi so we also need this.
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!