UBUNTU: Import backports 4.2-rc7

backports tree was automatically generated and integrated with the following command:

$ ./gentree.py --integrate --clean --git-revision v4.2-rc7 \
    <path>/linux-next <path>/linux-mako

(we're using a slightly modified backports tree to adjust every export automatically for
 our needs).

See https://backports.wiki.kernel.org/index.php/Documentation/integration for
documentation and https://github.com/ubuntu-phonedations/backports for the used backports
tree.

All uncessary parts (bcma, wifi, nfc etc.) were dropped and just the bluetooth relevant
parts are kept.

BugLink: http://bugs.launchpad.net/bugs/1489327

Signed-off-by: Simon Fels <simon.fels@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
This commit is contained in:
Simon Fels
2015-08-26 15:26:45 +02:00
committed by Tim Gardner
parent 006184adc8
commit 62e84e1cd2
379 changed files with 145426 additions and 1 deletions

View File

@@ -9,3 +9,4 @@ config SRCARCH
option env="SRCARCH" option env="SRCARCH"
source "arch/$SRCARCH/Kconfig" source "arch/$SRCARCH/Kconfig"
source "backports/Kconfig"

View File

@@ -510,6 +510,7 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
$(Q)$(MAKE) $(build)=$(@) $(Q)$(MAKE) $(build)=$(@)
# Objects we will link into vmlinux / subdirs we need to visit # Objects we will link into vmlinux / subdirs we need to visit
backports-y := backports/
init-y := init/ init-y := init/
drivers-y := drivers/ sound/ firmware/ ubuntu/ drivers-y := drivers/ sound/ firmware/ ubuntu/
net-y := net/ net-y := net/
@@ -716,13 +717,16 @@ core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
$(backports-y) $(backports-m) \
$(net-y) $(net-m) $(libs-y) $(libs-m))) $(net-y) $(net-m) $(libs-y) $(libs-m)))
vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
$(init-n) $(init-) \ $(init-n) $(init-) \
$(core-n) $(core-) $(drivers-n) $(drivers-) \ $(core-n) $(core-) $(drivers-n) $(drivers-) \
$(backports-n) $(backports-) \
$(net-n) $(net-) $(libs-n) $(libs-)))) $(net-n) $(net-) $(libs-n) $(libs-))))
backports-y := $(patsubst %/, %/built-in.o, $(backports-y))
init-y := $(patsubst %/, %/built-in.o, $(init-y)) init-y := $(patsubst %/, %/built-in.o, $(init-y))
core-y := $(patsubst %/, %/built-in.o, $(core-y)) core-y := $(patsubst %/, %/built-in.o, $(core-y))
drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
@@ -759,7 +763,7 @@ libs-y := $(libs-y1) $(libs-y2)
# System.map is generated to document addresses of all kernel symbols # System.map is generated to document addresses of all kernel symbols
vmlinux-init := $(head-y) $(init-y) vmlinux-init := $(head-y) $(init-y)
vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y) vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(backports-y)
vmlinux-all := $(vmlinux-init) $(vmlinux-main) vmlinux-all := $(vmlinux-init) $(vmlinux-main)
vmlinux-lds := arch/$(SRCARCH)/kernel/vmlinux.lds vmlinux-lds := arch/$(SRCARCH)/kernel/vmlinux.lds
export KBUILD_VMLINUX_OBJS := $(vmlinux-all) export KBUILD_VMLINUX_OBJS := $(vmlinux-all)

356
backports/COPYING Normal file
View File

@@ -0,0 +1,356 @@
NOTE! This copyright does *not* cover user programs that use kernel
services by normal system calls - this is merely considered normal use
of the kernel, and does *not* fall under the heading of "derived work".
Also note that the GPL below is copyrighted by the Free Software
Foundation, but the instance of code that it refers to (the Linux
kernel) is copyrighted by me and others who actually wrote it.
Also note that the only valid version of the GPL as far as the kernel
is concerned is _this_ particular version of the license (ie v2, not
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
Linus Torvalds
----------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

80
backports/Kconfig Normal file
View File

@@ -0,0 +1,80 @@
config BACKPORT_INTEGRATE
bool
def_bool y
config BACKPORT_DIR
string
default "backports/"
config BACKPORT_VERSION
string
default "v4.2-rc1-1-3-g0d0798b"
config BACKPORT_KERNEL_VERSION
string
default "v4.2-rc7-0-g2c6625c"
config BACKPORT_KERNEL_NAME
string
default "Linux"
menuconfig BACKPORT_LINUX
bool "Backport Linux v4.2-rc7-0-g2c6625c (backports v4.2-rc1-1-3-g0d0798b)"
default n
---help---
Enabling this will let give you the opportunity to use features and
drivers backported from Linux v4.2-rc7-0-g2c6625c
on the kernel your are using. This is experimental and you should
say no unless you'd like to help test things or want to help debug
this should we run into any issues.
if BACKPORT_LINUX
config BACKPORT_KERNEL_3_5
def_bool y
config BACKPORT_KERNEL_3_6
def_bool y
config BACKPORT_KERNEL_3_7
def_bool y
config BACKPORT_KERNEL_3_8
def_bool y
config BACKPORT_KERNEL_3_9
def_bool y
config BACKPORT_KERNEL_3_10
def_bool y
config BACKPORT_KERNEL_3_11
def_bool y
config BACKPORT_KERNEL_3_12
def_bool y
config BACKPORT_KERNEL_3_13
def_bool y
config BACKPORT_KERNEL_3_14
def_bool y
config BACKPORT_KERNEL_3_15
def_bool y
config BACKPORT_KERNEL_3_16
def_bool y
config BACKPORT_KERNEL_3_17
def_bool y
config BACKPORT_KERNEL_3_18
def_bool y
config BACKPORT_KERNEL_3_19
def_bool y
config BACKPORT_KERNEL_4_0
def_bool y
config BACKPORT_KERNEL_4_1
def_bool y
config BACKPORT_KERNEL_4_2
def_bool y
# this has the configuration for the backport code
source "$BACKPORT_DIR/compat/Kconfig"
# these are copied from the kernel
source "$BACKPORT_DIR/net/bluetooth/Kconfig"
source "$BACKPORT_DIR/net/6lowpan/Kconfig"
source "$BACKPORT_DIR/net/ieee802154/Kconfig"
source "$BACKPORT_DIR/net/mac802154/Kconfig"
endif # BACKPORT_LINUX

11471
backports/MAINTAINERS Normal file

File diff suppressed because it is too large Load Diff

56
backports/Makefile Normal file
View File

@@ -0,0 +1,56 @@
ifeq ($(CONFIG_BACKPORT_INTEGRATE),)
# Since 2.6.21, try-run is available, but cc-disable-warning
# was only added later, so we add it here ourselves:
backport-cc-disable-warning = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
NOSTDINC_FLAGS := \
-I$(M)/backport-include/ \
-I$(M)/backport-include/uapi \
-I$(M)/include/ \
-I$(M)/include/uapi \
-include $(M)/backport-include/backport/backport.h \
$(call backport-cc-disable-warning, unused-but-set-variable) \
-DCONFIG_BACKPORT_VERSION=\"$(BACKPORTS_VERSION)\" \
-DCONFIG_BACKPORT_KERNEL_VERSION=\"$(BACKPORTED_KERNEL_VERSION)\" \
-DCONFIG_BACKPORT_KERNEL_NAME=\"$(BACKPORTED_KERNEL_NAME)\" \
$(BACKPORTS_GIT_TRACKER_DEF) \
$(CFLAGS)
export backport_srctree = $(M)
else
export BACKPORT_DIR = backports/
export backport_srctree = $(srctree)/$(BACKPORT_DIR)
NOSTDINC_FLAGS := \
-I$(backport_srctree)/backport-include/ \
-I$(backport_srctree)/backport-include/uapi \
-I$(backport_srctree)/include/ \
-I$(backport_srctree)/include/uapi \
-include $(backport_srctree)/backport-include/backport/backport.h \
$(CFLAGS)
endif
obj-y += compat/
# obj-$(CONFIG_BACKPORT_CFG80211) += net/wireless/
# obj-$(CONFIG_BACKPORT_MAC80211) += net/mac80211/
# obj-$(CONFIG_BACKPORT_WLAN) += drivers/net/wireless/
obj-$(CONFIG_BACKPORT_BT) += net/bluetooth/
obj-$(CONFIG_BACKPORT_BT) += drivers/bluetooth/
# obj-$(CONFIG_BACKPORT_SSB) += drivers/ssb/
# obj-$(CONFIG_BACKPORT_BCMA) += drivers/bcma/
# obj-$(CONFIG_BACKPORT_ETHERNET) += drivers/net/ethernet/
# obj-$(CONFIG_BACKPORT_USB_NET_RNDIS_WLAN) += drivers/net/usb/
# obj-$(CONFIG_BACKPORT_NFC) += net/nfc/
# obj-$(CONFIG_BACKPORT_NFC) += drivers/nfc/
# obj-$(CONFIG_BACKPORT_MEDIA_SUPPORT) += drivers/media/
obj-$(CONFIG_BACKPORT_6LOWPAN) += net/6lowpan/
obj-$(CONFIG_BACKPORT_IEEE802154) += net/ieee802154/
obj-$(CONFIG_BACKPORT_BT) += net/ieee802154/
obj-$(CONFIG_BACKPORT_MAC802154) += net/mac802154/
# obj-$(CONFIG_BACKPORT_IEEE802154) += drivers/net/ieee802154/
# obj-$(CONFIG_BACKPORT_USB_WDM) += drivers/usb/class/
# obj-$(CONFIG_BACKPORT_USB_USBNET) += drivers/net/usb/

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_ASM_GENERIC_BARRIER_H
#define __BACKPORT_ASM_GENERIC_BARRIER_H
#include_next <asm-generic/barrier.h>
#ifndef dma_rmb
#define dma_rmb() rmb()
#endif
#endif /* __BACKPORT_ASM_GENERIC_BARRIER_H */

View File

@@ -0,0 +1,39 @@
#ifndef __BACKPORT_ASM_GENERIC_BUG_H
#define __BACKPORT_ASM_GENERIC_BUG_H
#include_next <asm-generic/bug.h>
#ifndef __WARN
#define __WARN(foo) dump_stack()
#endif
#ifndef WARN_ONCE
#define WARN_ONCE(condition, format...) ({ \
static int __warned; \
int __ret_warn_once = !!(condition); \
\
if (unlikely(__ret_warn_once)) \
if (WARN(!__warned, format)) \
__warned = 1; \
unlikely(__ret_warn_once); \
})
#endif
#ifndef __WARN_printf
/*
* To port this properly we'd have to port warn_slowpath_null(),
* which I'm lazy to do so just do a regular print for now. If you
* want to port this read kernel/panic.c
*/
#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
#endif
#ifndef WARN
#define WARN(condition, format...) ({ \
int __ret_warn_on = !!(condition); \
if (unlikely(__ret_warn_on)) \
__WARN_printf(format); \
unlikely(__ret_warn_on); \
})
#endif
#endif /* __BACKPORT_ASM_GENERIC_BUG_H */

View File

@@ -0,0 +1,17 @@
#ifndef __BACKPORT_ASM_GENERIC_PCI_DMA_COMPAT_H
#define __BACKPORT_ASM_GENERIC_PCI_DMA_COMPAT_H
#include_next <asm-generic/pci-dma-compat.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
#define pci_zalloc_consistent LINUX_BACKPORT(pci_zalloc_consistent)
static inline void *pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
dma_addr_t *dma_handle)
{
void *ret = pci_alloc_consistent(hwdev, size, dma_handle);
if (ret)
memset(ret, 0, size);
return ret;
}
#endif
#endif /* __BACKPORT_ASM_GENERIC_PCI_DMA_COMPAT_H */

View File

@@ -0,0 +1,22 @@
#ifndef __BACKPORT_ASM_ATOMIC_H
#define __BACKPORT_ASM_ATOMIC_H
#include_next <asm/atomic.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
/*
* In many versions, several architectures do not seem to include an
* atomic64_t implementation, and do not include the software emulation from
* asm-generic/atomic64_t.
* Detect and handle this here.
*/
#if (!defined(ATOMIC64_INIT) && !defined(CONFIG_X86) && !(defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64)))
#include <asm-generic/atomic64.h>
#endif
#endif
#ifndef smp_mb__after_atomic
#define smp_mb__after_atomic smp_mb__after_clear_bit
#endif
#endif /* __BACKPORT_ASM_ATOMIC_H */

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_ASM_BARRIER_H
#define __BACKPORT_ASM_BARRIER_H
#include_next <asm/barrier.h>
#ifndef dma_rmb
#define dma_rmb() rmb()
#endif
#endif /* __BACKPORT_ASM_BARRIER_H */

View File

@@ -0,0 +1,27 @@
#ifndef __BACKPORT_ASM_DMA_MAPPING_H
#define __BACKPORT_ASM_DMA_MAPPING_H
#include_next <asm/dma-mapping.h>
#include <linux/version.h>
#if defined(CONFIG_BACKPORT_BPAUTO_BUILD_DMA_SHARED_HELPERS)
#define dma_common_get_sgtable LINUX_BACKPORT(dma_common_get_sgtable)
int
dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
void *cpu_addr, dma_addr_t dma_addr, size_t size);
#endif /* defined(CONFIG_BACKPORT_BPAUTO_BUILD_DMA_SHARED_HELPERS) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#define dma_get_sgtable_attrs LINUX_BACKPORT(dma_get_sgtable_attrs)
struct dma_attrs;
static inline int
dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr,
dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs)
{
return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size);
}
#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
#endif /* __BACKPORT_ASM_DMA_MAPPING_H */

View File

@@ -0,0 +1,23 @@
#ifndef __BACKPORT_ASM_ERRNO_H
#define __BACKPORT_ASM_ERRNO_H
#include_next <asm/errno.h>
#ifndef ERFKILL
#if !defined(CONFIG_ALPHA) && !defined(CONFIG_MIPS) && !defined(CONFIG_PARISC) && !defined(CONFIG_SPARC)
#define ERFKILL 132 /* Operation not possible due to RF-kill */
#endif
#ifdef CONFIG_ALPHA
#define ERFKILL 138 /* Operation not possible due to RF-kill */
#endif
#ifdef CONFIG_MIPS
#define ERFKILL 167 /* Operation not possible due to RF-kill */
#endif
#ifdef CONFIG_PARISC
#define ERFKILL 256 /* Operation not possible due to RF-kill */
#endif
#ifdef CONFIG_SPARC
#define ERFKILL 134 /* Operation not possible due to RF-kill */
#endif
#endif
#endif /* __BACKPORT_ASM_ERRNO_H */

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_ASM_IOCTLS_H
#define __BACKPORT_ASM_IOCTLS_H
#include_next <asm/ioctls.h>
#ifndef TIOCPKT_IOCTL
#define TIOCPKT_IOCTL 64
#endif
#endif /* __BACKPORT_ASM_IOCTLS_H */

View File

@@ -0,0 +1,16 @@
#ifndef __BACKPORT_H
#define __BACKPORT_H
#include <generated/autoconf.h>
#ifndef CONFIG_BACKPORT_INTEGRATE
#include <backport/autoconf.h>
#endif
#include <linux/kconfig.h>
#ifndef __ASSEMBLY__
#define LINUX_BACKPORT(__sym) backport_ ##__sym
#ifndef CONFIG_BACKPORT_INTEGRATE
#include <backport/checks.h>
#endif
#endif
#endif /* __BACKPORT_H */

View File

@@ -0,0 +1,12 @@
#ifndef __BACKPORT_CHECKS
#define __BACKPORT_CHECKS
#if defined(CONFIG_MAC80211) && defined(CONFIG_BACKPORT_MAC80211)
#error "You must not have mac80211 built into your kernel if you want to enable it"
#endif
#if defined(CONFIG_CFG80211) && defined(CONFIG_BACKPORT_CFG80211)
#error "You must not have cfg80211 built into your kernel if you want to enable it"
#endif
#endif /* __BACKPORT_CHECKS */

View File

@@ -0,0 +1,181 @@
#ifndef __BACKPORT_LED_DISABLED_SUPPORT
#define __BACKPORT_LED_DISABLED_SUPPORT
/*
* LED support is strange, with the NEW_LEDS, LEDS_CLASS and LEDS_TRIGGERS
* Kconfig symbols ... If any of them are not defined, we build our
* "compatibility" code that really just makes it all non-working but
* allows compilation.
*/
#ifdef CONFIG_BACKPORT_BPAUTO_BUILD_LEDS
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/rwsem.h>
#include <linux/workqueue.h>
#define led_classdev LINUX_BACKPORT(led_classdev)
#define led_trigger LINUX_BACKPORT(led_trigger)
struct led_classdev {
const char *name;
int brightness;
int max_brightness;
int flags;
/* Lower 16 bits reflect status */
#ifndef LED_SUSPENDED
#define LED_SUSPENDED (1 << 0)
/* Upper 16 bits reflect control information */
#define LED_CORE_SUSPENDRESUME (1 << 16)
#define LED_BLINK_ONESHOT (1 << 17)
#define LED_BLINK_ONESHOT_STOP (1 << 18)
#define LED_BLINK_INVERT (1 << 19)
#endif
/* Set LED brightness level */
/* Must not sleep, use a workqueue if needed */
void (*brightness_set)(struct led_classdev *led_cdev,
enum led_brightness brightness);
/* Get LED brightness level */
enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
/*
* Activate hardware accelerated blink, delays are in milliseconds
* and if both are zero then a sensible default should be chosen.
* The call should adjust the timings in that case and if it can't
* match the values specified exactly.
* Deactivate blinking again when the brightness is set to a fixed
* value via the brightness_set() callback.
*/
int (*blink_set)(struct led_classdev *led_cdev,
unsigned long *delay_on,
unsigned long *delay_off);
struct device *dev;
struct list_head node; /* LED Device list */
const char *default_trigger; /* Trigger to use */
unsigned long blink_delay_on, blink_delay_off;
struct timer_list blink_timer;
int blink_brightness;
struct work_struct set_brightness_work;
int delayed_set_value;
/* Protects the trigger data below */
struct rw_semaphore trigger_lock;
struct led_trigger *trigger;
struct list_head trig_list;
void *trigger_data;
/* true if activated - deactivate routine uses it to do cleanup */
bool activated;
};
struct led_trigger {
const char *name;
void (*activate)(struct led_classdev *led_cdev);
void (*deactivate)(struct led_classdev *led_cdev);
rwlock_t leddev_list_lock;
struct list_head led_cdevs;
struct list_head next_trig;
};
#undef led_classdev_register
#define led_classdev_register LINUX_BACKPORT(led_classdev_register)
#undef led_classdev_unregister
#define led_classdev_unregister LINUX_BACKPORT(led_classdev_unregister)
#undef led_blink_set
#define led_blink_set LINUX_BACKPORT(led_blink_set)
#undef led_set_brightness
#define led_set_brightness LINUX_BACKPORT(led_set_brightness)
#undef led_classdev_suspend
#define led_classdev_suspend LINUX_BACKPORT(led_classdev_suspend)
#undef led_classdev_resume
#define led_classdev_resume LINUX_BACKPORT(led_classdev_resume)
#undef led_trigger_register
#define led_trigger_register LINUX_BACKPORT(led_trigger_register)
#undef led_trigger_unregister
#define led_trigger_unregister LINUX_BACKPORT(led_trigger_unregister)
#undef led_trigger_register_simple
#define led_trigger_register_simple LINUX_BACKPORT(led_trigger_register_simple)
#undef led_trigger_unregister_simple
#define led_trigger_unregister_simple LINUX_BACKPORT(led_trigger_unregister_simple)
#undef led_trigger_event
#define led_trigger_event LINUX_BACKPORT(led_trigger_event)
#undef DEFINE_LED_TRIGGER
#define DEFINE_LED_TRIGGER(x) static struct led_trigger *x;
static inline int led_classdev_register(struct device *parent,
struct led_classdev *led_cdev)
{
return 0;
}
static inline void led_classdev_unregister(struct led_classdev *led_cdev)
{
}
static inline void led_trigger_register_simple(const char *name,
struct led_trigger **trigger)
{
}
static inline void led_trigger_unregister_simple(struct led_trigger *trigger)
{
}
static inline void led_blink_set(struct led_classdev *led_cdev,
unsigned long *delay_on,
unsigned long *delay_off)
{
}
static inline void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
}
static inline void led_classdev_suspend(struct led_classdev *led_cdev)
{
}
static inline void led_classdev_resume(struct led_classdev *led_cdev)
{
}
static inline int led_trigger_register(struct led_trigger *trigger)
{
INIT_LIST_HEAD(&trigger->led_cdevs);
INIT_LIST_HEAD(&trigger->next_trig);
rwlock_init(&trigger->leddev_list_lock);
return 0;
}
static inline void led_trigger_unregister(struct led_trigger *trigger)
{
}
static inline void led_trigger_event(struct led_trigger *trigger,
enum led_brightness event)
{
}
static inline void led_trigger_blink(struct led_trigger *trigger,
unsigned long *delay_on,
unsigned long *delay_off)
{
}
static inline void led_trigger_blink_oneshot(struct led_trigger *trigger,
unsigned long *delay_on,
unsigned long *delay_off,
int invert)
{
}
#endif
#endif /* __BACKPORT_LED_DISABLED_SUPPORT */

View File

@@ -0,0 +1,16 @@
/*
* These tricks are taken from
* http://efesx.com/2010/07/17/variadic-macro-to-count-number-of-arguments/
* and
* http://efesx.com/2010/08/31/overloading-macros/
*/
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(__VA_ARGS__, 5,4,3,2,1)
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(func, ...) \
macro_dispatcher_(func, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(func, nargs) \
macro_dispatcher__(func, nargs)
#define macro_dispatcher__(func, nargs) \
func ## nargs

View File

@@ -0,0 +1,33 @@
#ifndef __BACKPORT_CRYPTO_AEAD_H
#define __BACKPORT_CRYPTO_AEAD_H
#include_next <crypto/aead.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
#define aead_request_set_ad LINUX_BACKPORT(aead_request_set_ad)
static inline void aead_request_set_ad(struct aead_request *req,
unsigned int assoclen)
{
req->assoclen = assoclen;
}
#define crypto_aead_reqsize LINUX_BACKPORT(crypto_aead_reqsize)
unsigned int crypto_aead_reqsize(struct crypto_aead *tfm);
struct aead_request *crypto_backport_convert(struct aead_request *req);
static inline int backport_crypto_aead_encrypt(struct aead_request *req)
{
return crypto_aead_encrypt(crypto_backport_convert(req));
}
#define crypto_aead_encrypt LINUX_BACKPORT(crypto_aead_encrypt)
static inline int backport_crypto_aead_decrypt(struct aead_request *req)
{
return crypto_aead_decrypt(crypto_backport_convert(req));
}
#define crypto_aead_decrypt LINUX_BACKPORT(crypto_aead_decrypt)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) */
#endif /* __BACKPORT_CRYPTO_AEAD_H */

View File

@@ -0,0 +1,21 @@
#ifndef __BACKPORT_GENERATED_UTS_RELEASE_H
#define __BACKPORT_GENERATED_UTS_RELEASE_H
#include_next <generated/utsrelease.h>
/*
* We only want the UTS_UBUNTU_RELEASE_ABI var when we are on a normal
* Ubuntu distribution kernel and not when we are on a Ubuntu mainline
* kernel. Some of the Ubuntu mainline kernel do have an invalid octal
* number in this field like 031418 and we do not want to evaluate this
* at all on the Ubuntu mainline kernels. All Ubuntu distribution
* kernel have CONFIG_VERSION_SIGNATURE set so this way we can detect
* the which type of kernel we are on.
*/
#ifndef UTS_UBUNTU_RELEASE_ABI
#define UTS_UBUNTU_RELEASE_ABI 0
#elif !defined(CONFIG_VERSION_SIGNATURE)
#undef UTS_UBUNTU_RELEASE_ABI
#define UTS_UBUNTU_RELEASE_ABI 0
#endif
#endif /* __BACKPORT_GENERATED_UTS_RELEASE_H */

View File

@@ -0,0 +1,57 @@
#ifndef __BACKPORT_LINUX_ACPI_H
#define __BACKPORT_LINUX_ACPI_H
#include_next <linux/acpi.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
/*
* Backports
*
* commit 95f8a082b9b1ead0c2859f2a7b1ac91ff63d8765
* Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* Date: Wed Nov 21 00:21:50 2012 +0100
*
* ACPI / driver core: Introduce struct acpi_dev_node and related macros
*
* To avoid adding an ACPI handle pointer to struct device on
* architectures that don't use ACPI, or generally when CONFIG_ACPI is
* not set, in which cases that pointer is useless, define struct
* acpi_dev_node that will contain the handle pointer if CONFIG_ACPI is
* set and will be empty otherwise and use it to represent the ACPI
* device node field in struct device.
*
* In addition to that define macros for reading and setting the ACPI
* handle of a device that don't generate code when CONFIG_ACPI is
* unset. Modify the ACPI subsystem to use those macros instead of
* referring to the given device's ACPI handle directly.
*
* Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
*/
#ifdef CONFIG_ACPI
#define ACPI_HANDLE(dev) DEVICE_ACPI_HANDLE(dev)
#else
#define ACPI_HANDLE(dev) (NULL)
#endif /* CONFIG_ACPI */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
#ifdef CONFIG_ACPI
static inline struct acpi_device *_acpi_get_companion(struct device *dev)
{
struct acpi_device *adev;
int ret;
ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev);
if (ret < 0)
adev = NULL;
return adev;
}
#define ACPI_COMPANION(dev) _acpi_get_companion(dev)
#else
#define ACPI_COMPANION(dev) (NULL)
#endif /* CONFIG_ACPI */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) */
#endif /* __BACKPORT_LINUX_ACPI_H */

View File

@@ -0,0 +1,19 @@
#ifndef __BACKPORT_BITOPS_H
#define __BACKPORT_BITOPS_H
#include_next <linux/bitops.h>
#include <linux/version.h>
#include <generated/utsrelease.h>
#ifndef GENMASK
/*
* Create a contiguous bitmask starting at bit position @l and ending at
* position @h. For example
* GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
*/
#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
#endif
#endif /* __BACKPORT_BITOPS_H */

View File

@@ -0,0 +1,116 @@
#ifndef __BACKPORT_LINUX_CLK_H
#define __BACKPORT_LINUX_CLK_H
#include_next <linux/clk.h>
#include <linux/version.h>
/*
* commit 93abe8e4 - we only backport the non CONFIG_COMMON_CLK
* case as the CONFIG_COMMON_CLK case requires arch support. By
* using the backport_ namespace for older kernels we force usage
* of these helpers and that's required given that 3.5 added some
* of these helpers expecting a few exported symbols for the non
* CONFIG_COMMON_CLK case. The 3.5 kernel is not supported as
* per kernel.org so we don't send a fix upstream for that.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#ifndef CONFIG_COMMON_CLK
/*
* Whoopsie!
*
* clk_enable() and clk_disable() have been left without
* a nop export symbols when !CONFIG_COMMON_CLK since its
* introduction on v2.6.16, but fixed until 3.6.
*/
#if 0
#define clk_enable LINUX_BACKPORT(clk_enable)
static inline int clk_enable(struct clk *clk)
{
return 0;
}
#define clk_disable LINUX_BACKPORT(clk_disable)
static inline void clk_disable(struct clk *clk) {}
#endif
#define clk_get LINUX_BACKPORT(clk_get)
static inline struct clk *clk_get(struct device *dev, const char *id)
{
return NULL;
}
#define devm_clk_get LINUX_BACKPORT(devm_clk_get)
static inline struct clk *devm_clk_get(struct device *dev, const char *id)
{
return NULL;
}
#define clk_put LINUX_BACKPORT(clk_put)
static inline void clk_put(struct clk *clk) {}
#define devm_clk_put LINUX_BACKPORT(devm_clk_put)
static inline void devm_clk_put(struct device *dev, struct clk *clk) {}
#define clk_get_rate LINUX_BACKPORT(clk_get_rate)
static inline unsigned long clk_get_rate(struct clk *clk)
{
return 0;
}
#define clk_set_rate LINUX_BACKPORT(clk_set_rate)
static inline int clk_set_rate(struct clk *clk, unsigned long rate)
{
return 0;
}
#define clk_round_rate LINUX_BACKPORT(clk_round_rate)
static inline long clk_round_rate(struct clk *clk, unsigned long rate)
{
return 0;
}
#define clk_set_parent LINUX_BACKPORT(clk_set_parent)
static inline int clk_set_parent(struct clk *clk, struct clk *parent)
{
return 0;
}
#define clk_get_parent LINUX_BACKPORT(clk_get_parent)
static inline struct clk *clk_get_parent(struct clk *clk)
{
return NULL;
}
#endif /* CONFIG_COMMON_CLK */
#endif /* #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
#define clk_prepare_enable LINUX_BACKPORT(clk_prepare_enable)
/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
static inline int clk_prepare_enable(struct clk *clk)
{
int ret;
ret = clk_prepare(clk);
if (ret)
return ret;
ret = clk_enable(clk);
if (ret)
clk_unprepare(clk);
return ret;
}
#define clk_disable_unprepare LINUX_BACKPORT(clk_disable_unprepare)
/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
static inline void clk_disable_unprepare(struct clk *clk)
{
clk_disable(clk);
clk_unprepare(clk);
}
#endif /* < 3,3,0 && >= 3,2,0 */
#endif /* __LINUX_CLK_H */

View File

@@ -0,0 +1,21 @@
#ifndef __BACKPORT_COMPAT_H
#define __BACKPORT_COMPAT_H
#include_next <linux/compat.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
#ifdef CONFIG_X86_X32_ABI
#define COMPAT_USE_64BIT_TIME \
(!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
#else
#define COMPAT_USE_64BIT_TIME 0
#endif
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
#define compat_put_timespec LINUX_BACKPORT(compat_put_timespec)
extern int compat_put_timespec(const struct timespec *, void __user *);
#endif
#endif /* __BACKPORT_COMPAT_H */

View File

@@ -0,0 +1,17 @@
#ifndef __BACKPORT_LINUX_COMPILER_H
#define __BACKPORT_LINUX_COMPILER_H
#include_next <linux/compiler.h>
#ifndef __rcu
#define __rcu
#endif
#ifndef __always_unused
#ifdef __GNUC__
#define __always_unused __attribute__((unused))
#else
#define __always_unused /* unimplemented */
#endif
#endif
#endif /* __BACKPORT_LINUX_COMPILER_H */

View File

@@ -0,0 +1,21 @@
#ifndef __BACKPORT_COMPLETION_H
#define __BACKPORT_COMPLETION_H
#include_next <linux/completion.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
/**
* reinit_completion - reinitialize a completion structure
* @x: pointer to completion structure that is to be reinitialized
*
* This inline function should be used to reinitialize a completion structure so it can
* be reused. This is especially important after complete_all() is used.
*/
#define reinit_completion LINUX_BACKPORT(reinit_completion)
static inline void reinit_completion(struct completion *x)
{
x->done = 0;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
#endif /* __BACKPORT_COMPLETION_H */

View File

@@ -0,0 +1,60 @@
#ifndef _BACKPORT_LINUX_CORDIC_H
#define _BACKPORT_LINUX_CORDIC_H 1
#include <linux/version.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,1,0))
#include_next <linux/cordic.h>
#else
/*
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __CORDIC_H_
#define __CORDIC_H_
#include <linux/types.h>
/**
* struct cordic_iq - i/q coordinate.
*
* @i: real part of coordinate (in phase).
* @q: imaginary part of coordinate (quadrature).
*/
struct cordic_iq {
s32 i;
s32 q;
};
/**
* cordic_calc_iq() - calculates the i/q coordinate for given angle.
*
* @theta: angle in degrees for which i/q coordinate is to be calculated.
* @coord: function output parameter holding the i/q coordinate.
*
* The function calculates the i/q coordinate for a given angle using
* cordic algorithm. The coordinate consists of a real (i) and an
* imaginary (q) part. The real part is essentially the cosine of the
* angle and the imaginary part is the sine of the angle. The returned
* values are scaled by 2^16 for precision. The range for theta is
* for -180 degrees to +180 degrees. Passed values outside this range are
* converted before doing the actual calculation.
*/
#define cordic_calc_iq LINUX_BACKPORT(cordic_calc_iq)
struct cordic_iq cordic_calc_iq(s32 theta);
#endif /* __CORDIC_H_ */
#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3,1,0)) */
#endif /* _BACKPORT_LINUX_CORDIC_H */

View File

@@ -0,0 +1,14 @@
#ifndef _BACKPORT_LINUX_CRC7_H
#define _BACKPORT_LINUX_CRC7_H
#include_next <linux/crc7.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
#define crc7_be LINUX_BACKPORT(crc7_be)
static inline u8 crc7_be(u8 crc, const u8 *buffer, size_t len)
{
return crc7(crc, buffer, len) << 1;
}
#endif /* < 3.16 */
#endif /* _BACKPORT_LINUX_CRC7_H */

View File

@@ -0,0 +1,10 @@
#ifndef __BACKPORT_LINUX_CRED_H
#define __BACKPORT_LINUX_CRED_H
#include_next <linux/cred.h>
#include <linux/version.h>
#ifndef current_user_ns
#define current_user_ns() (current->nsproxy->user_ns)
#endif
#endif /* __BACKPORT_LINUX_CRED_H */

View File

@@ -0,0 +1,24 @@
#ifndef __BACKPORT_DEBUGFS_H_
#define __BACKPORT_DEBUGFS_H_
#include_next <linux/debugfs.h>
#include <linux/version.h>
#include <linux/device.h>
#include <generated/utsrelease.h>
#if defined(CONFIG_DEBUG_FS)
struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
struct dentry *parent,
int (*read_fn)(struct seq_file *s,
void *data));
#else
static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
const char *name,
struct dentry *parent,
int (*read_fn)(struct seq_file *s,
void *data))
{
return ERR_PTR(-ENODEV);
}
#endif /* CONFIG_DEBUG_FS */
#endif /* __BACKPORT_DEBUGFS_H_ */

View File

@@ -0,0 +1,247 @@
#ifndef __BACKPORT_DEVICE_H
#define __BACKPORT_DEVICE_H
#include <linux/export.h>
#include_next <linux/device.h>
#include <linux/version.h>
/*
* string.h is usually included from the asm/ folder in most configuration,
* but on some older kernels it doesn't. As we're using memcpy() in the code
* below, we need to be safe and make sure string.h is indeed there.
*/
#include <linux/string.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
/* backport
* commit 9f3b795a626ee79574595e06d1437fe0c7d51d29
* Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
* Date: Fri Feb 1 20:40:17 2013 +0100
*
* driver-core: constify data for class_find_device()
*/
typedef int (backport_device_find_function_t)(struct device *, void *);
#define class_find_device(cls, start, idx, fun) \
class_find_device((cls), (start), (void *)(idx),\
(backport_device_find_function_t *)(fun))
#endif
#ifndef module_driver
/**
* module_driver() - Helper macro for drivers that don't do anything
* special in module init/exit. This eliminates a lot of boilerplate.
* Each module may only use this macro once, and calling it replaces
* module_init() and module_exit().
*
* Use this macro to construct bus specific macros for registering
* drivers, and do not use it on its own.
*/
#define module_driver(__driver, __register, __unregister) \
static int __init __driver##_init(void) \
{ \
return __register(&(__driver)); \
} \
module_init(__driver##_init); \
static void __exit __driver##_exit(void) \
{ \
__unregister(&(__driver)); \
} \
module_exit(__driver##_exit);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
#define devm_ioremap_resource LINUX_BACKPORT(devm_ioremap_resource)
void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
#define devres_release LINUX_BACKPORT(devres_release)
extern int devres_release(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
#include <linux/ratelimit.h>
#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
if (__ratelimit(&_rs)) \
dev_level(dev, fmt, ##__VA_ARGS__); \
} while (0)
#define dev_emerg_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
#define dev_alert_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
#define dev_crit_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
#define dev_err_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
#define dev_warn_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
#define dev_notice_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
#define dev_info_ratelimited(dev, fmt, ...) \
dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
#define dev_dbg_ratelimited(dev, fmt, ...) \
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
__ratelimit(&_rs)) \
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
##__VA_ARGS__); \
} while (0)
#else
#define dev_dbg_ratelimited(dev, fmt, ...) \
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif /* dynamic debug */
#endif /* <= 3.5 */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0)
static inline void
backport_device_release_driver(struct device *dev)
{
device_release_driver(dev);
device_lock(dev);
dev_set_drvdata(dev, NULL);
device_unlock(dev);
}
#define device_release_driver LINUX_BACKPORT(device_release_driver)
#define kobj_to_dev LINUX_BACKPORT(kobj_to_dev)
static inline struct device *kobj_to_dev(struct kobject *kobj)
{
return container_of(kobj, struct device, kobj);
}
#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3,6,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
#ifndef DEVICE_ATTR_RO
#define DEVICE_ATTR_RO(_name) \
struct device_attribute dev_attr_ ## _name = __ATTR_RO(_name);
#endif
#ifndef DEVICE_ATTR_RW
#define DEVICE_ATTR_RW(_name) \
struct device_attribute dev_attr_ ## _name = __ATTR_RW(_name)
#endif
#endif
#define ATTRIBUTE_GROUPS_BACKPORT(_name) \
static struct BP_ATTR_GRP_STRUCT _name##_dev_attrs[ARRAY_SIZE(_name##_attrs)];\
static void init_##_name##_attrs(void) \
{ \
int i; \
for (i = 0; _name##_attrs[i]; i++) \
_name##_dev_attrs[i] = \
*container_of(_name##_attrs[i], \
struct BP_ATTR_GRP_STRUCT, \
attr); \
}
#ifndef __ATTRIBUTE_GROUPS
#define __ATTRIBUTE_GROUPS(_name) \
static const struct attribute_group *_name##_groups[] = { \
&_name##_group, \
NULL, \
}
#endif /* __ATTRIBUTE_GROUPS */
#undef ATTRIBUTE_GROUPS
#define ATTRIBUTE_GROUPS(_name) \
static const struct attribute_group _name##_group = { \
.attrs = _name##_attrs, \
}; \
static inline void init_##_name##_attrs(void) {} \
__ATTRIBUTE_GROUPS(_name)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
#define devm_kmalloc(dev, size, flags) devm_kzalloc(dev, size, flags)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
#define devm_kstrdup LINUX_BACKPORT(devm_kstrdup)
extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
#define devm_kmalloc_array LINUX_BACKPORT(devm_kmalloc_array)
static inline void *devm_kmalloc_array(struct device *dev,
size_t n, size_t size, gfp_t flags)
{
if (size != 0 && n > SIZE_MAX / size)
return NULL;
return devm_kmalloc(dev, n * size, flags);
}
#define devm_kcalloc LINUX_BACKPORT(devm_kcalloc)
static inline void *devm_kcalloc(struct device *dev,
size_t n, size_t size, gfp_t flags)
{
return devm_kmalloc_array(dev, n, size, flags);
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
#define devm_kmemdup LINUX_BACKPORT(devm_kmemdup)
static inline void *devm_kmemdup(struct device *dev, const void *src,
size_t len, gfp_t gfp)
{
void *p;
p = devm_kmalloc(dev, len, gfp);
if (p)
memcpy(p, src, len);
return p;
}
#endif
#ifndef dev_level_once
#ifdef CONFIG_PRINTK
#define dev_level_once(dev_level, dev, fmt, ...) \
do { \
static bool __print_once __read_mostly; \
\
if (!__print_once) { \
__print_once = true; \
dev_level(dev, fmt, ##__VA_ARGS__); \
} \
} while (0)
#else
#define dev_level_once(dev_level, dev, fmt, ...) \
do { \
if (0) \
dev_level(dev, fmt, ##__VA_ARGS__); \
} while (0)
#endif
#define dev_emerg_once(dev, fmt, ...) \
dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__)
#define dev_alert_once(dev, fmt, ...) \
dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__)
#define dev_crit_once(dev, fmt, ...) \
dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__)
#define dev_err_once(dev, fmt, ...) \
dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__)
#define dev_warn_once(dev, fmt, ...) \
dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__)
#define dev_notice_once(dev, fmt, ...) \
dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__)
#define dev_info_once(dev, fmt, ...) \
dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
#define dev_dbg_once(dev, fmt, ...) \
dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__)
#endif /* dev_level_once */
#endif /* __BACKPORT_DEVICE_H */

View File

@@ -0,0 +1,54 @@
#ifndef _BACKPORT_DMA_BUF_H__
#define _BACKPORT_DMA_BUF_H__
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
#include_next <linux/dma-buf.h>
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) */
#include <linux/dma-direction.h>
#include <linux/dma-attrs.h>
#include <linux/dma-mapping.h>
#if !defined(DEFINE_DMA_BUF_EXPORT_INFO) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
/**
* helper macro for exporters; zeros and fills in most common values
*/
#define DEFINE_DMA_BUF_EXPORT_INFO(a) \
struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME }
struct dma_buf_export_info {
const char *exp_name;
const struct dma_buf_ops *ops;
size_t size;
int flags;
struct reservation_object *resv;
void *priv;
};
#ifdef dma_buf_export
#undef dma_buf_export
#endif
static inline
struct dma_buf *backport_dma_buf_export(const struct dma_buf_export_info *exp_info)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
return dma_buf_export(exp_info->priv,
(struct dma_buf_ops *)exp_info->ops,
exp_info->size, exp_info->flags);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
return dma_buf_export(exp_info->priv, exp_info->ops,
exp_info->size, exp_info->flags);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
return dma_buf_export_named(exp_info->priv, exp_info->ops,
exp_info->size, exp_info->flags,
exp_info->exp_name);
#else
return dma_buf_export_named(exp_info->priv, exp_info->ops,
exp_info->size, exp_info->flags,
exp_info->exp_name, exp_info->resv);
#endif
}
#define dma_buf_export LINUX_BACKPORT(dma_buf_export)
#endif /* !defined(DEFINE_DMA_BUF_EXPORT_INFO) */
#endif /* _BACKPORT_DMA_BUF_H__ */

View File

@@ -0,0 +1,35 @@
#ifndef __BACKPORT_LINUX_DMA_MAPPING_H
#define __BACKPORT_LINUX_DMA_MAPPING_H
#include_next <linux/dma-mapping.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
#define dma_zalloc_coherent LINUX_BACKPORT(dma_zalloc_coherent)
static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
if (ret)
memset(ret, 0, size);
return ret;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
/*
* Set both the DMA mask and the coherent DMA mask to the same thing.
* Note that we don't check the return value from dma_set_coherent_mask()
* as the DMA API guarantees that the coherent DMA mask can be set to
* the same or smaller than the streaming DMA mask.
*/
#define dma_set_mask_and_coherent LINUX_BACKPORT(dma_set_mask_and_coherent)
static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask)
{
int rc = dma_set_mask(dev, mask);
if (rc == 0)
dma_set_coherent_mask(dev, mask);
return rc;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
#endif /* __BACKPORT_LINUX_DMA_MAPPING_H */

View File

@@ -0,0 +1,36 @@
#ifndef __BACKPORT_LINUX_DYNAMIC_DEBUG_H
#define __BACKPORT_LINUX_DYNAMIC_DEBUG_H
#include <linux/version.h>
#include_next <linux/dynamic_debug.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
/* backports 07613b0b */
#if defined(CONFIG_DYNAMIC_DEBUG)
#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,4))
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
static struct _ddebug __used __aligned(8) \
__attribute__((section("__verbose"))) name = { \
.modname = KBUILD_MODNAME, \
.function = __func__, \
.filename = __FILE__, \
.format = (fmt), \
.lineno = __LINE__, \
.flags = _DPRINTK_FLAGS_DEFAULT, \
.enabled = false, \
}
#else
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
static struct _ddebug __used __aligned(8) \
__attribute__((section("__verbose"))) name = { \
.modname = KBUILD_MODNAME, \
.function = __func__, \
.filename = __FILE__, \
.format = (fmt), \
.lineno = __LINE__, \
.flags = _DPRINTK_FLAGS_DEFAULT, \
}
#endif /* RHEL_RELEASE_CODE < 6.4 */
#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
#endif /* < 3.2 */
#endif /* __BACKPORT_LINUX_DYNAMIC_DEBUG_H */

View File

@@ -0,0 +1,10 @@
#ifndef _COMPAT_LINUX_EEPROM_93CX6_H
#define _COMPAT_LINUX_EEPROM_93CX6_H 1
#include_next <linux/eeprom_93cx6.h>
#ifndef PCI_EEPROM_WIDTH_93C86
#define PCI_EEPROM_WIDTH_93C86 8
#endif /* PCI_EEPROM_WIDTH_93C86 */
#endif /* _COMPAT_LINUX_EEPROM_93CX6_H */

View File

@@ -0,0 +1,10 @@
#ifndef __BACKPORT_LINUX_ERR_H
#define __BACKPORT_LINUX_ERR_H
#include_next <linux/err.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
#define PTR_ERR_OR_ZERO(p) PTR_RET(p)
#endif
#endif /* __BACKPORT_LINUX_ERR_H */

View File

@@ -0,0 +1,196 @@
#ifndef _BACKPORT_LINUX_ETHERDEVICE_H
#define _BACKPORT_LINUX_ETHERDEVICE_H
#include_next <linux/etherdevice.h>
#include <linux/version.h>
/*
* newer kernels include this already and some
* users rely on getting this indirectly
*/
#include <asm/unaligned.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random)
static inline void eth_hw_addr_random(struct net_device *dev)
{
dev->addr_assign_type |= NET_ADDR_RANDOM;
random_ether_addr(dev->dev_addr);
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#include <linux/random.h>
/**
* eth_broadcast_addr - Assign broadcast address
* @addr: Pointer to a six-byte array containing the Ethernet address
*
* Assign the broadcast address to the given address array.
*/
#define eth_broadcast_addr LINUX_BACKPORT(eth_broadcast_addr)
static inline void eth_broadcast_addr(u8 *addr)
{
memset(addr, 0xff, ETH_ALEN);
}
/**
* eth_random_addr - Generate software assigned random Ethernet address
* @addr: Pointer to a six-byte array containing the Ethernet address
*
* Generate a random Ethernet address (MAC) that is not multicast
* and has the local assigned bit set.
*/
#define eth_random_addr LINUX_BACKPORT(eth_random_addr)
static inline void eth_random_addr(u8 *addr)
{
get_random_bytes(addr, ETH_ALEN);
addr[0] &= 0xfe; /* clear multicast bit */
addr[0] |= 0x02; /* set local assignment bit (IEEE802) */
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
/* This backports:
*
* commit 6d57e9078e880a3dd232d579f42ac437a8f1ef7b
* Author: Duan Jiong <djduanjiong@gmail.com>
* Date: Sat Sep 8 16:32:28 2012 +0000
*
* etherdevice: introduce help function eth_zero_addr()
*/
#define eth_zero_addr LINUX_BACKPORT(eth_zero_addr)
static inline void eth_zero_addr(u8 *addr)
{
memset(addr, 0x00, ETH_ALEN);
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
#define ether_addr_equal LINUX_BACKPORT(ether_addr_equal)
static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
{
return !compare_ether_addr(addr1, addr2);
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
#define eth_prepare_mac_addr_change LINUX_BACKPORT(eth_prepare_mac_addr_change)
extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
#define eth_commit_mac_addr_change LINUX_BACKPORT(eth_commit_mac_addr_change)
extern void eth_commit_mac_addr_change(struct net_device *dev, void *p);
#endif /* < 3.9 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
/**
* eth_hw_addr_inherit - Copy dev_addr from another net_device
* @dst: pointer to net_device to copy dev_addr to
* @src: pointer to net_device to copy dev_addr from
*
* Copy the Ethernet address from one net_device to another along with
* the address attributes (addr_assign_type).
*/
static inline void eth_hw_addr_inherit(struct net_device *dst,
struct net_device *src)
{
dst->addr_assign_type = src->addr_assign_type;
memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN);
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
/**
* ether_addr_equal_64bits - Compare two Ethernet addresses
* @addr1: Pointer to an array of 8 bytes
* @addr2: Pointer to an other array of 8 bytes
*
* Compare two Ethernet addresses, returns true if equal, false otherwise.
*
* The function doesn't need any conditional branches and possibly uses
* word memory accesses on CPU allowing cheap unaligned memory reads.
* arrays = { byte1, byte2, byte3, byte4, byte5, byte6, pad1, pad2 }
*
* Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits.
*/
#define ether_addr_equal_64bits LINUX_BACKPORT(ether_addr_equal_64bits)
static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
const u8 addr2[6+2])
{
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2);
#ifdef __BIG_ENDIAN
return (fold >> 16) == 0;
#else
return (fold << 16) == 0;
#endif
#else
return ether_addr_equal(addr1, addr2);
#endif
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
/**
* ether_addr_equal_unaligned - Compare two not u16 aligned Ethernet addresses
* @addr1: Pointer to a six-byte array containing the Ethernet address
* @addr2: Pointer other six-byte array containing the Ethernet address
*
* Compare two Ethernet addresses, returns true if equal
*
* Please note: Use only when any Ethernet address may not be u16 aligned.
*/
#define ether_addr_equal_unaligned LINUX_BACKPORT(ether_addr_equal_unaligned)
static inline bool ether_addr_equal_unaligned(const u8 *addr1, const u8 *addr2)
{
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
return ether_addr_equal(addr1, addr2);
#else
return memcmp(addr1, addr2, ETH_ALEN) == 0;
#endif
}
/**
* ether_addr_copy - Copy an Ethernet address
* @dst: Pointer to a six-byte array Ethernet address destination
* @src: Pointer to a six-byte array Ethernet address source
*
* Please note: dst & src must both be aligned to u16.
*/
#define ether_addr_copy LINUX_BACKPORT(ether_addr_copy)
static inline void ether_addr_copy(u8 *dst, const u8 *src)
{
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
*(u32 *)dst = *(const u32 *)src;
*(u16 *)(dst + 4) = *(const u16 *)(src + 4);
#else
u16 *a = (u16 *)dst;
const u16 *b = (const u16 *)src;
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
#endif
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#define eth_get_headlen LINUX_BACKPORT(eth_get_headlen)
int eth_get_headlen(unsigned char *data, unsigned int max_len);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
#define eth_skb_pad LINUX_BACKPORT(eth_skb_pad)
/**
* eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame
* @skb: Buffer to pad
*
* An Ethernet frame should have a minimum size of 60 bytes. This function
* takes short frames and pads them with zeros up to the 60 byte limit.
*/
static inline int eth_skb_pad(struct sk_buff *skb)
{
return skb_put_padto(skb, ETH_ZLEN);
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
#endif /* _BACKPORT_LINUX_ETHERDEVICE_H */

View File

@@ -0,0 +1,18 @@
#ifndef __BACKPORT_LINUX_ETHTOOL_H
#define __BACKPORT_LINUX_ETHTOOL_H
#include_next <linux/ethtool.h>
#include <linux/version.h>
#ifndef SPEED_UNKNOWN
#define SPEED_UNKNOWN -1
#endif /* SPEED_UNKNOWN */
#ifndef DUPLEX_UNKNOWN
#define DUPLEX_UNKNOWN 0xff
#endif /* DUPLEX_UNKNOWN */
#ifndef ETHTOOL_FWVERS_LEN
#define ETHTOOL_FWVERS_LEN 32
#endif
#endif /* __BACKPORT_LINUX_ETHTOOL_H */

View File

@@ -0,0 +1,19 @@
#ifndef _COMPAT_LINUX_EXPORT_H
#define _COMPAT_LINUX_EXPORT_H 1
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
#include_next <linux/export.h>
#else
#ifndef pr_fmt
#define backport_undef_pr_fmt
#endif
#include <linux/module.h>
#ifdef backport_undef_pr_fmt
#undef pr_fmt
#undef backport_undef_pr_fmt
#endif
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
#endif /* _COMPAT_LINUX_EXPORT_H */

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_LINUX_FIRMWARE_H
#define __BACKPORT_LINUX_FIRMWARE_H
#include_next <linux/firmware.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
#define request_firmware_direct(fw, name, device) request_firmware(fw, name, device)
#endif
#endif /* __BACKPORT_LINUX_FIRMWARE_H */

View File

@@ -0,0 +1,32 @@
#ifndef __BACKPORT_FREEZER_H_INCLUDED
#define __BACKPORT_FREEZER_H_INCLUDED
#include_next <linux/freezer.h>
#ifdef CONFIG_FREEZER
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
/*
* Like schedule_hrtimeout_range(), but should not block the freezer. Do not
* call this with locks held.
*/
#define freezable_schedule_hrtimeout_range LINUX_BACKPORT(freezable_schedule_hrtimeout_range)
static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
unsigned long delta, const enum hrtimer_mode mode)
{
int __retval;
freezer_do_not_count();
__retval = schedule_hrtimeout_range(expires, delta, mode);
freezer_count();
return __retval;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) */
#else /* !CONFIG_FREEZER */
#ifndef freezable_schedule_hrtimeout_range
#define freezable_schedule_hrtimeout_range(expires, delta, mode) \
schedule_hrtimeout_range(expires, delta, mode)
#endif
#endif /* !CONFIG_FREEZER */
#endif /* __BACKPORT_FREEZER_H_INCLUDED */

View File

@@ -0,0 +1,46 @@
#ifndef _COMPAT_LINUX_FS_H
#define _COMPAT_LINUX_FS_H
#include_next <linux/fs.h>
#include <linux/version.h>
/*
* some versions don't have this and thus don't
* include it from the original fs.h
*/
#include <linux/uidgid.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
#define simple_open LINUX_BACKPORT(simple_open)
extern int simple_open(struct inode *inode, struct file *file);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
/**
* backport of:
*
* commit 496ad9aa8ef448058e36ca7a787c61f2e63f0f54
* Author: Al Viro <viro@zeniv.linux.org.uk>
* Date: Wed Jan 23 17:07:38 2013 -0500
*
* new helper: file_inode(file)
*/
static inline struct inode *file_inode(struct file *f)
{
return f->f_path.dentry->d_inode;
}
#endif
#ifndef replace_fops
/*
* This one is to be used *ONLY* from ->open() instances.
* fops must be non-NULL, pinned down *and* module dependencies
* should be sufficient to pin the caller down as well.
*/
#define replace_fops(f, fops) \
do { \
struct file *__file = (f); \
fops_put(__file->f_op); \
BUG_ON(!(__file->f_op = (fops))); \
} while(0)
#endif /* replace_fops */
#endif /* _COMPAT_LINUX_FS_H */

View File

@@ -0,0 +1,18 @@
#ifndef __BACKPORT_LINUX_GENETLINK_H
#define __BACKPORT_LINUX_GENETLINK_H
#include_next <linux/genetlink.h>
/* This backports:
*
* commit e9412c37082b5c932e83364aaed0c38c2ce33acb
* Author: Neil Horman <nhorman@tuxdriver.com>
* Date: Tue May 29 09:30:41 2012 +0000
*
* genetlink: Build a generic netlink family module alias
*/
#ifndef MODULE_ALIAS_GENL_FAMILY
#define MODULE_ALIAS_GENL_FAMILY(family)\
MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family)
#endif
#endif /* __BACKPORT_LINUX_GENETLINK_H */

View File

@@ -0,0 +1,29 @@
#ifndef __BACKPORT_LINUX_GPIO_H
#define __BACKPORT_LINUX_GPIO_H
#include_next <linux/gpio.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
#define devm_gpio_request_one LINUX_BACKPORT(devm_gpio_request_one)
#define devm_gpio_request LINUX_BACKPORT(devm_gpio_request)
#ifdef CONFIG_GPIOLIB
int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label);
#else
static inline int devm_gpio_request(struct device *dev, unsigned gpio,
const char *label)
{
WARN_ON(1);
return -EINVAL;
}
static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label)
{
WARN_ON(1);
return -EINVAL;
}
#endif /* CONFIG_GPIOLIB */
#endif
#endif /* __BACKPORT_LINUX_GPIO_H */

View File

@@ -0,0 +1,42 @@
#ifndef __BACKPORT_HASHTABLE_H
#define __BACKPORT_HASHTABLE_H
#include_next <linux/hashtable.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
/**
* backport:
*
* commit 0bbacca7c3911451cea923b0ad6389d58e3d9ce9
* Author: Sasha Levin <sasha.levin@oracle.com>
* Date: Thu Feb 7 12:32:18 2013 +1100
*
* hlist: drop the node parameter from iterators
*/
#include <linux/list.h>
#include <backport/magic.h>
#undef hash_for_each
#define hash_for_each(name, bkt, obj, member) \
for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
(bkt)++)\
hlist_for_each_entry(obj, &name[bkt], member)
#undef hash_for_each_safe
#define hash_for_each_safe(name, bkt, tmp, obj, member) \
for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
(bkt)++)\
hlist_for_each_entry_safe(obj, tmp, &name[bkt], member)
#undef hash_for_each_possible
#define hash_for_each_possible(name, obj, member, key) \
hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
#undef hash_for_each_possible_safe
#define hash_for_each_possible_safe(name, obj, tmp, member, key) \
hlist_for_each_entry_safe(obj, tmp,\
&name[hash_min(key, HASH_BITS(name))], member)
#endif
#endif /* __BACKPORT_HASHTABLE_H */

View File

@@ -0,0 +1,87 @@
#ifndef __BACKPORT_HID_H
#define __BACKPORT_HID_H
#include_next <linux/hid.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
#define hid_ignore LINUX_BACKPORT(hid_ignore)
extern bool hid_ignore(struct hid_device *);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
#define HID_TYPE_USBNONE 2
#endif
#ifndef HID_QUIRK_NO_IGNORE
#define HID_QUIRK_NO_IGNORE 0x40000000
#endif
#ifndef HID_QUIRK_HIDDEV_FORCE
#define HID_QUIRK_HIDDEV_FORCE 0x00000010
#endif
#ifndef HID_QUIRK_IGNORE
#define HID_QUIRK_IGNORE 0x00000004
#endif
#ifndef HID_USB_DEVICE
#define HID_USB_DEVICE(ven, prod) \
.bus = BUS_USB, .vendor = (ven), .product = (prod)
#endif
#ifndef HID_BLUETOOTH_DEVICE
#define HID_BLUETOOTH_DEVICE(ven, prod) \
.bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
#endif
#ifndef hid_printk
#define hid_printk(level, hid, fmt, arg...) \
dev_printk(level, &(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_emerg
#define hid_emerg(hid, fmt, arg...) \
dev_emerg(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_crit
#define hid_crit(hid, fmt, arg...) \
dev_crit(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_alert
#define hid_alert(hid, fmt, arg...) \
dev_alert(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_err
#define hid_err(hid, fmt, arg...) \
dev_err(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_notice
#define hid_notice(hid, fmt, arg...) \
dev_notice(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_warn
#define hid_warn(hid, fmt, arg...) \
dev_warn(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_info
#define hid_info(hid, fmt, arg...) \
dev_info(&(hid)->dev, fmt, ##arg)
#endif
#ifndef hid_dbg
#define hid_dbg(hid, fmt, arg...) \
dev_dbg(&(hid)->dev, fmt, ##arg)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
#define hid_alloc_report_buf LINUX_BACKPORT(hid_alloc_report_buf)
u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
#endif
#endif /* __BACKPORT_HID_H */

View File

@@ -0,0 +1,34 @@
#ifndef __BACKPORT_LINUX_HWMON_H
#define __BACKPORT_LINUX_HWMON_H
#include_next <linux/hwmon.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
/*
* Backports
*
* commit bab2243ce1897865e31ea6d59b0478391f51812b
* Author: Guenter Roeck <linux@roeck-us.net>
* Date: Sat Jul 6 13:57:23 2013 -0700
*
* hwmon: Introduce hwmon_device_register_with_groups
*
* hwmon_device_register_with_groups() lets callers register a hwmon device
* together with all sysfs attributes in a single call.
*
* When using hwmon_device_register_with_groups(), hwmon attributes are attached
* to the hwmon device directly and no longer with its parent device.
*
* Signed-off-by: Guenter Roeck <linux@roeck-us.net>
*/
struct device *
hwmon_device_register_with_groups(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **groups);
struct device *
devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **groups);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */
#endif /* __BACKPORT_LINUX_HWMON_H */

View File

@@ -0,0 +1,14 @@
#ifndef __BACKPORT_LINUX_I2C_MUX_H
#define __BACKPORT_LINUX_I2C_MUX_H
#include_next <linux/i2c-mux.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
#define i2c_add_mux_adapter(parent, mux_dev, mux_priv, force_nr, chan_id, class, select, deselect) \
i2c_add_mux_adapter(parent, mux_priv, force_nr, chan_id, select, deselect)
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
#define i2c_add_mux_adapter(parent, mux_dev, mux_priv, force_nr, chan_id, class, select, deselect) \
i2c_add_mux_adapter(parent, mux_dev, mux_priv, force_nr, chan_id, select, deselect)
#endif
#endif /* __BACKPORT_LINUX_I2C_MUX_H */

View File

@@ -0,0 +1,46 @@
#ifndef __BACKPORT_LINUX_I2C_H
#define __BACKPORT_LINUX_I2C_H
#include_next <linux/i2c.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) && \
LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
#include <linux/i2c.h>
/* Unlocked flavor */
#define __i2c_transfer LINUX_BACKPORT(__i2c_transfer)
extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
int num);
#endif
/* This backports
*
* commit 14674e70119ea01549ce593d8901a797f8a90f74
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Date: Wed May 30 10:55:34 2012 +0200
*
* i2c: Split I2C_M_NOSTART support out of I2C_FUNC_PROTOCOL_MANGLING
*/
#ifndef I2C_FUNC_NOSTART
#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
#endif
/* This backports:
*
* commit 7c92784a546d2945b6d6973a30f7134be78eb7a4
* Author: Lars-Peter Clausen <lars@metafoo.de>
* Date: Wed Nov 16 10:13:36 2011 +0100
*
* I2C: Add helper macro for i2c_driver boilerplate
*/
#ifndef module_i2c_driver
#define module_i2c_driver(__i2c_driver) \
module_driver(__i2c_driver, i2c_add_driver, \
i2c_del_driver)
#endif
#ifndef I2C_CLIENT_SCCB
#define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */
/* Must match I2C_M_STOP|IGNORE_NAK */
#endif
#endif /* __BACKPORT_LINUX_I2C_H */

View File

@@ -0,0 +1,59 @@
#ifndef __BACKPORT_IDR_H
#define __BACKPORT_IDR_H
/* some versions have a broken idr header */
#include <linux/spinlock.h>
#include_next <linux/idr.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
#define ida_simple_get LINUX_BACKPORT(ida_simple_get)
int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask);
#define ida_simple_remove LINUX_BACKPORT(ida_simple_remove)
void ida_simple_remove(struct ida *ida, unsigned int id);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
#include <linux/errno.h>
/**
* backport of idr idr_alloc() usage
*
* This backports a patch series send by Tejun Heo:
* https://lkml.org/lkml/2013/2/2/159
*/
static inline void compat_idr_destroy(struct idr *idp)
{
idr_remove_all(idp);
idr_destroy(idp);
}
#define idr_destroy(idp) compat_idr_destroy(idp)
static inline int idr_alloc(struct idr *idr, void *ptr, int start, int end,
gfp_t gfp_mask)
{
int id, ret;
do {
if (!idr_pre_get(idr, gfp_mask))
return -ENOMEM;
ret = idr_get_new_above(idr, ptr, start, &id);
if (!ret && id > end) {
idr_remove(idr, id);
ret = -ENOSPC;
}
} while (ret == -EAGAIN);
return ret ? ret : id;
}
static inline void idr_preload(gfp_t gfp_mask)
{
}
static inline void idr_preload_end(void)
{
}
#endif
#endif /* __BACKPORT_IDR_H */

View File

@@ -0,0 +1,14 @@
#ifndef _BACKPORTS_LINUX_AF_ARP_H
#define _BACKPORTS_LINUX_AF_ARP_H 1
#include_next <linux/if_arp.h>
#ifndef ARPHRD_IEEE802154_MONITOR
#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */
#endif
#ifndef ARPHRD_6LOWPAN
#define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */
#endif
#endif /* _BACKPORTS_LINUX_AF_ARP_H */

View File

@@ -0,0 +1,42 @@
#ifndef __BACKPORT_IF_ETHER_H
#define __BACKPORT_IF_ETHER_H
#include_next <linux/if_ether.h>
/* See commit b62faf3c in next-20140311 */
#ifndef ETH_P_80221
#define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */
#endif
/*
* backport of:
* commit e5c5d22e8dcf7c2d430336cbf8e180bd38e8daf1
* Author: Simon Horman <horms@verge.net.au>
* Date: Thu Mar 28 13:38:25 2013 +0900
*
* net: add ETH_P_802_3_MIN
*/
#ifndef ETH_P_802_3_MIN
#define ETH_P_802_3_MIN 0x0600
#endif
#ifndef ETH_P_TDLS
#define ETH_P_TDLS 0x890D /* TDLS */
#endif
#ifndef ETH_P_LINK_CTL
#define ETH_P_LINK_CTL 0x886c
#endif
#ifndef ETH_P_PAE
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
#endif
#ifndef ETH_P_TEB
#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
#endif
#ifndef ETH_P_8021AD
#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
#endif
#endif /* __BACKPORT_IF_ETHER_H */

View File

@@ -0,0 +1,39 @@
#ifndef __BACKPORT_LINUX_IF_VLAN_H_
#define __BACKPORT_LINUX_IF_VLAN_H_
#include_next <linux/if_vlan.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
#define vlan_insert_tag(__skb, __vlan_proto, __vlan_tci) vlan_insert_tag(__skb, __vlan_tci)
#define __vlan_put_tag(__skb, __vlan_proto, __vlan_tci) __vlan_put_tag(__skb, __vlan_tci)
#define vlan_put_tag(__skb, __vlan_proto, __vlan_tci) vlan_put_tag(__skb, __vlan_tci)
#define __vlan_hwaccel_put_tag(__skb, __vlan_proto, __vlan_tag) __vlan_hwaccel_put_tag(__skb, __vlan_tag)
#define __vlan_find_dev_deep(__real_dev, __vlan_proto, __vlan_id) __vlan_find_dev_deep(__real_dev, __vlan_id)
#endif
#ifndef VLAN_PRIO_MASK
#define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */
#endif
#ifndef VLAN_PRIO_SHIFT
#define VLAN_PRIO_SHIFT 13
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
#define __vlan_find_dev_deep_rcu(real_dev, vlan_proto, vlan_id) __vlan_find_dev_deep(real_dev, vlan_proto, vlan_id)
#endif
#ifndef skb_vlan_tag_present
#define skb_vlan_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
#endif
#ifndef skb_vlan_tag_get
#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
#endif
#ifndef skb_vlan_tag_get_id
#define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
#endif
#endif /* __BACKPORT_LINUX_IF_VLAN_H_ */

View File

@@ -0,0 +1,19 @@
#ifndef __BACKPORT_INIT_H
#define __BACKPORT_INIT_H
#include_next <linux/init.h>
/*
* Backports 312b1485fb509c9bc32eda28ad29537896658cb8
* Author: Sam Ravnborg <sam@ravnborg.org>
* Date: Mon Jan 28 20:21:15 2008 +0100
*
* Introduce new section reference annotations tags: __ref, __refdata, __refconst
*/
#ifndef __ref
#define __ref __init_refok
#endif
#ifndef __refdata
#define __refdata __initdata_refok
#endif
#endif /* __BACKPORT_INIT_H */

View File

@@ -0,0 +1,21 @@
#ifndef __BACKPORT_INPUT_H
#define __BACKPORT_INPUT_H
#include_next <linux/input.h>
#ifndef KEY_WIMAX
#define KEY_WIMAX 246
#endif
#ifndef KEY_WPS_BUTTON
#define KEY_WPS_BUTTON 0x211
#endif
#ifndef KEY_RFKILL
#define KEY_RFKILL 247
#endif
#ifndef SW_RFKILL_ALL
#define SW_RFKILL_ALL 0x03
#endif
#endif /* __BACKPORT_INPUT_H */

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_LINUX_IOPORT_H
#define __BACKPORT_LINUX_IOPORT_H
#include_next <linux/ioport.h>
#ifndef IORESOURCE_REG
#define IORESOURCE_REG 0x00000300
#endif
#endif /* __BACKPORT_LINUX_IOPORT_H */

View File

@@ -0,0 +1,16 @@
#ifndef __BACKPORT_LINUX_IRQ_H
#define __BACKPORT_LINUX_IRQ_H
#include_next <linux/irq.h>
#ifdef CONFIG_HAVE_GENERIC_HARDIRQS
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
#define irq_get_trigger_type LINUX_BACKPORT(irq_get_trigger_type)
static inline u32 irq_get_trigger_type(unsigned int irq)
{
struct irq_data *d = irq_get_irq_data(irq);
return d ? irqd_get_trigger_type(d) : 0;
}
#endif
#endif /* CONFIG_HAVE_GENERIC_HARDIRQS */
#endif /* __BACKPORT_LINUX_IRQ_H */

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_LINUX_IRQDOMAIN_H
#define __BACKPORT_LINUX_IRQDOMAIN_H
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
#include_next <linux/irqdomain.h>
#endif
#endif /* __BACKPORT_LINUX_IRQDOMAIN_H */

View File

@@ -0,0 +1,21 @@
#ifndef __BACKPORT_LNIUX_JIFFIES_H
#define __BACKPORT_LNIUX_JIFFIES_H
#include_next <linux/jiffies.h>
#ifndef time_is_before_jiffies
#define time_is_before_jiffies(a) time_after(jiffies, a)
#endif
#ifndef time_is_after_jiffies
#define time_is_after_jiffies(a) time_before(jiffies, a)
#endif
#ifndef time_is_before_eq_jiffies
#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
#endif
#ifndef time_is_after_eq_jiffies
#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)
#endif
#endif /* __BACKPORT_LNIUX_JIFFIES_H */

View File

@@ -0,0 +1,38 @@
#ifndef __BACKPORT_LINUX_KCONFIG_H
#define __BACKPORT_LINUX_KCONFIG_H
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
#include_next <linux/kconfig.h>
#endif
#ifndef __ARG_PLACEHOLDER_1
#define __ARG_PLACEHOLDER_1 0,
#define config_enabled(cfg) _config_enabled(cfg)
#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
#define ___config_enabled(__ignored, val, ...) val
/*
* 3.1 - 3.3 had a broken version of this, so undef
* (they didn't have __ARG_PLACEHOLDER_1)
*/
#undef IS_ENABLED
#define IS_ENABLED(option) \
(config_enabled(option) || config_enabled(option##_MODULE))
#endif
#undef IS_BUILTIN
#define IS_BUILTIN(option) config_enabled(option)
#ifndef IS_REACHABLE
/*
* IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled
* code can call a function defined in code compiled based on CONFIG_FOO.
* This is similar to IS_ENABLED(), but returns false when invoked from
* built-in code when CONFIG_FOO is set to 'm'.
*/
#define IS_REACHABLE(option) (config_enabled(option) || \
(config_enabled(option##_MODULE) && config_enabled(MODULE)))
#endif
#endif

View File

@@ -0,0 +1,162 @@
#ifndef __BACKPORT_KERNEL_H
#define __BACKPORT_KERNEL_H
#include_next <linux/kernel.h>
#include <linux/version.h>
/*
* some older kernels don't have this and thus don't
* include it from kernel.h like new kernels
*/
#include <linux/printk.h>
/*
* This backports:
*
* From a3860c1c5dd1137db23d7786d284939c5761d517 Mon Sep 17 00:00:00 2001
* From: Xi Wang <xi.wang@gmail.com>
* Date: Thu, 31 May 2012 16:26:04 -0700
* Subject: [PATCH] introduce SIZE_MAX
*/
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
/* This backports:
*
* commit 36a26c69b4c70396ef569c3452690fba0c1dec08
* Author: Nicholas Bellinger <nab@linux-iscsi.org>
* Date: Tue Jul 26 00:35:26 2011 -0700
*
* kernel.h: Add DIV_ROUND_UP_ULL and DIV_ROUND_UP_SECTOR_T macro usage
*/
#ifndef DIV_ROUND_UP_ULL
#define DIV_ROUND_UP_ULL(ll,d) \
({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })
#endif
#ifndef USHRT_MAX
#define USHRT_MAX ((u16)(~0U))
#endif
#ifndef SHRT_MAX
#define SHRT_MAX ((s16)(USHRT_MAX>>1))
#endif
#ifndef SHRT_MIN
#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
#endif
#ifndef U8_MAX
#define U8_MAX ((u8)~0U)
#endif
#ifndef S8_MAX
#define S8_MAX ((s8)(U8_MAX>>1))
#endif
#ifndef S8_MIN
#define S8_MIN ((s8)(-S8_MAX - 1))
#endif
#ifndef U16_MAX
#define U16_MAX ((u16)~0U)
#endif
#ifndef U32_MAX
#define U32_MAX ((u32)~0U)
#endif
#ifndef __round_mask
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
#define round_down(x, y) ((x) & ~__round_mask(x, y))
#endif
#ifndef DIV_ROUND_CLOSEST
#define DIV_ROUND_CLOSEST(x, divisor)( \
{ \
typeof(x) __x = x; \
typeof(divisor) __d = divisor; \
(((typeof(x))-1) > 0 || \
((typeof(divisor))-1) > 0 || (__x) > 0) ? \
(((__x) + ((__d) / 2)) / (__d)) : \
(((__x) - ((__d) / 2)) / (__d)); \
} \
)
#endif
#ifndef DIV_ROUND_CLOSEST_ULL
#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \
{ \
typeof(divisor) __d = divisor; \
unsigned long long _tmp = (x) + (__d) / 2; \
do_div(_tmp, __d); \
_tmp; \
} \
)
#endif
#ifndef swap
#define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
#endif
#ifndef lower_32_bits
#define lower_32_bits(n) ((u32)(n))
#endif
#ifndef clamp
#define clamp(val, min, max) ({ \
typeof(val) __val = (val); \
typeof(min) __min = (min); \
typeof(max) __max = (max); \
(void) (&__val == &__min); \
(void) (&__val == &__max); \
__val = __val < __min ? __min: __val; \
__val > __max ? __max: __val; })
#endif
#ifndef clamp_t
#define clamp_t(type, val, min, max) ({ \
type __val = (val); \
type __min = (min); \
type __max = (max); \
__val = __val < __min ? __min: __val; \
__val > __max ? __max: __val; })
#endif
#ifndef clamp_val
#define clamp_val(val, min, max) ({ \
typeof(val) __val = (val); \
typeof(val) __min = (min); \
typeof(val) __max = (max); \
__val = __val < __min ? __min: __val; \
__val > __max ? __max: __val; })
#endif
#ifndef rounddown
#define rounddown(x, y) ( \
{ \
typeof(x) __x = (x); \
__x - (__x % (y)); \
} \
)
#endif /* rounddown */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
/* kernels before 3.2 didn't have error checking for the function */
#define hex2bin LINUX_BACKPORT(hex2bin)
int __must_check hex2bin(u8 *dst, const char *src, size_t count);
#endif /* < 3.2 */
#endif /* __BACKPORT_KERNEL_H */
/*
* We have to do this outside the include guard, because
* out own header (linux/export.h) has to include kernel.h
* indirectly (through module.h) and then undef's pr_fmt.
* Then, when the real kernel.h gets included again, it's
* not defined and we get problems ...
*/
#ifndef pr_fmt
#define pr_fmt(msg) msg
#endif

View File

@@ -0,0 +1,51 @@
#ifndef BACKPORT_LINUX_KFIFO_H
#define BACKPORT_LINUX_KFIFO_H
#include <linux/version.h>
#include_next <linux/kfifo.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
#undef kfifo_put
/**
* kfifo_put - put data into the fifo
* @fifo: address of the fifo to be used
* @val: the data to be added
*
* This macro copies the given value into the fifo.
* It returns 0 if the fifo was full. Otherwise it returns the number
* processed elements.
*
* Note that with only one concurrent reader and one concurrent
* writer, you don't need extra locking to use these macro.
*/
#define kfifo_put(fifo, val) \
({ \
typeof((fifo) + 1) __tmp = (fifo); \
typeof((&val) + 1) __val = (&val); \
unsigned int __ret; \
const size_t __recsize = sizeof(*__tmp->rectype); \
struct __kfifo *__kfifo = &__tmp->kfifo; \
if (0) { \
typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
__dummy = (typeof(__val))NULL; \
} \
if (__recsize) \
__ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \
__recsize); \
else { \
__ret = !kfifo_is_full(__tmp); \
if (__ret) { \
(__is_kfifo_ptr(__tmp) ? \
((typeof(__tmp->type))__kfifo->data) : \
(__tmp->buf) \
)[__kfifo->in & __tmp->kfifo.mask] = \
*(typeof(__tmp->type))__val; \
smp_wmb(); \
__kfifo->in++; \
} \
} \
__ret; \
})
#endif
#endif /* BACKPORT_LINUX_KFIFO_H */

View File

@@ -0,0 +1,17 @@
#ifndef __BACKPORT_LINUX_KTIME_H
#define __BACKPORT_LINUX_KTIME_H
#include_next <linux/ktime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
#define ktime_get_raw LINUX_BACKPORT(ktime_get_raw)
extern ktime_t ktime_get_raw(void);
#endif /* < 3.17 */
#ifndef ktime_to_timespec64
/* Map the ktime_t to timespec conversion to ns_to_timespec function */
#define ktime_to_timespec64(kt) ns_to_timespec64((kt).tv64)
#endif
#endif /* __BACKPORT_LINUX_KTIME_H */

View File

@@ -0,0 +1,43 @@
#ifndef __BACKPORT_LINUX_LEDS_H
#define __BACKPORT_LINUX_LEDS_H
#include_next <linux/leds.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
/*
* Backports
*
* commit 959d62fa865d2e616b61a509e1cc5b88741f065e
* Author: Shuah Khan <shuahkhan@gmail.com>
* Date: Thu Jun 14 04:34:30 2012 +0800
*
* leds: Rename led_brightness_set() to led_set_brightness()
*
* Rename leds external interface led_brightness_set() to led_set_brightness().
* This is the second phase of the change to reduce confusion between the
* leds internal and external interfaces that set brightness. With this change,
* now the external interface is led_set_brightness(). The first phase renamed
* the internal interface led_set_brightness() to __led_set_brightness().
* There are no changes to the interface implementations.
*
* Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
* Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
*/
#define led_set_brightness(_dev, _switch) led_brightness_set(_dev, _switch)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
/*
* There is no LINUX_BACKPORT() guard here because we want it to point to
* the original function which is exported normally.
*/
#ifdef CONFIG_LEDS_TRIGGERS
extern void led_trigger_remove(struct led_classdev *led_cdev);
#else
static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
#endif
#endif
#include <backport/leds-disabled.h>
#endif /* __BACKPORT_LINUX_LEDS_H */

View File

@@ -0,0 +1,91 @@
#ifndef __BACKPORT_LIST_H
#define __BACKPORT_LIST_H
#include_next <linux/list.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
/**
* backport:
*
* commit 0bbacca7c3911451cea923b0ad6389d58e3d9ce9
* Author: Sasha Levin <sasha.levin@oracle.com>
* Date: Thu Feb 7 12:32:18 2013 +1100
*
* hlist: drop the node parameter from iterators
*/
#include <backport/magic.h>
#undef hlist_entry_safe
#define hlist_entry_safe(ptr, type, member) \
({ typeof(ptr) ____ptr = (ptr); \
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
})
#define hlist_for_each_entry4(tpos, pos, head, member) \
for (pos = (head)->first; \
pos && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;});\
pos = pos->next)
#define hlist_for_each_entry_safe5(tpos, pos, n, head, member) \
for (pos = (head)->first; \
pos && ({ n = pos->next; 1; }) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;});\
pos = n)
#define hlist_for_each_entry3(pos, head, member) \
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
pos; \
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
#define hlist_for_each_entry_safe4(pos, n, head, member) \
for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
pos && ({ n = pos->member.next; 1; }); \
pos = hlist_entry_safe(n, typeof(*pos), member))
#undef hlist_for_each_entry
#define hlist_for_each_entry(...) \
macro_dispatcher(hlist_for_each_entry, __VA_ARGS__)(__VA_ARGS__)
#undef hlist_for_each_entry_safe
#define hlist_for_each_entry_safe(...) \
macro_dispatcher(hlist_for_each_entry_safe, __VA_ARGS__)(__VA_ARGS__)
#endif
#ifndef list_first_entry_or_null
/**
* list_first_entry_or_null - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note that if the list is empty, it returns NULL.
*/
#define list_first_entry_or_null(ptr, type, member) \
(!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
#endif /* list_first_entry_or_null */
#ifndef list_next_entry
/**
* list_next_entry - get the next element in list
* @pos: the type * to cursor
* @member: the name of the list_struct within the struct.
*/
#define list_next_entry(pos, member) \
list_entry((pos)->member.next, typeof(*(pos)), member)
#endif /* list_next_entry */
#ifndef list_last_entry
/**
* list_last_entry - get the last element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note, that list is expected to be not empty.
*/
#define list_last_entry(ptr, type, member) \
list_entry((ptr)->prev, type, member)
#endif
#endif /* __BACKPORT_LIST_H */

View File

@@ -0,0 +1,9 @@
#ifndef __BACKPORT_LIST_NULLS
#define __BACKPORT_LIST_NULLS
#include_next <linux/list_nulls.h>
#ifndef NULLS_MARKER
#define NULLS_MARKER(value) (1UL | (((long)value) << 1))
#endif
#endif /* __BACKPORT_LIST_NULLS */

View File

@@ -0,0 +1,17 @@
#ifndef __BACKPORT_LINUX_LOCKDEP_H
#define __BACKPORT_LINUX_LOCKDEP_H
#include_next <linux/lockdep.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
#undef lockdep_assert_held
#ifdef CONFIG_LOCKDEP
#define lockdep_assert_held(l) do { \
WARN_ON(debug_locks && !lockdep_is_held(l)); \
} while (0)
#else
#define lockdep_assert_held(l) do { (void)(l); } while (0)
#endif /* CONFIG_LOCKDEP */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
#endif /* __BACKPORT_LINUX_LOCKDEP_H */

View File

@@ -0,0 +1,87 @@
#ifndef __BACKPORT_LINUX_MDIO_H
#define __BACKPORT_LINUX_MDIO_H
#include_next <linux/mdio.h>
#ifndef MDIO_EEE_100TX
/* EEE Supported/Advertisement/LP Advertisement registers.
*
* EEE capability Register (3.20), Advertisement (7.60) and
* Link partner ability (7.61) registers have and can use the same identical
* bit masks.
*/
#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */
#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */
/* Note: the two defines above can be potentially used by the user-land
* and cannot remove them now.
* So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros
* using the previous ones (that can be considered obsolete).
*/
#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */
#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */
#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */
#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */
#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */
#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */
#endif /* MDIO_EEE_100TX */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
/**
* mmd_eee_adv_to_ethtool_adv_t
* @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers
*
* A small helper function that translates the MMD EEE Advertisment (7.60)
* and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
* settings.
*/
#define mmd_eee_adv_to_ethtool_adv_t LINUX_BACKPORT(mmd_eee_adv_to_ethtool_adv_t)
static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
{
u32 adv = 0;
if (eee_adv & MDIO_EEE_100TX)
adv |= ADVERTISED_100baseT_Full;
if (eee_adv & MDIO_EEE_1000T)
adv |= ADVERTISED_1000baseT_Full;
if (eee_adv & MDIO_EEE_10GT)
adv |= ADVERTISED_10000baseT_Full;
if (eee_adv & MDIO_EEE_1000KX)
adv |= ADVERTISED_1000baseKX_Full;
if (eee_adv & MDIO_EEE_10GKX4)
adv |= ADVERTISED_10000baseKX4_Full;
if (eee_adv & MDIO_EEE_10GKR)
adv |= ADVERTISED_10000baseKR_Full;
return adv;
}
#define ethtool_adv_to_mmd_eee_adv_t LINUX_BACKPORT(ethtool_adv_to_mmd_eee_adv_t)
/**
* ethtool_adv_to_mmd_eee_adv_t
* @adv: the ethtool advertisement settings
*
* A small helper function that translates ethtool advertisement settings
* to EEE advertisements for the MMD EEE Advertisement (7.60) and
* MMD EEE Link Partner Ability (7.61) registers.
*/
static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
{
u16 reg = 0;
if (adv & ADVERTISED_100baseT_Full)
reg |= MDIO_EEE_100TX;
if (adv & ADVERTISED_1000baseT_Full)
reg |= MDIO_EEE_1000T;
if (adv & ADVERTISED_10000baseT_Full)
reg |= MDIO_EEE_10GT;
if (adv & ADVERTISED_1000baseKX_Full)
reg |= MDIO_EEE_1000KX;
if (adv & ADVERTISED_10000baseKX4_Full)
reg |= MDIO_EEE_10GKX4;
if (adv & ADVERTISED_10000baseKR_Full)
reg |= MDIO_EEE_10GKR;
return reg;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
#endif /* __BACKPORT_LINUX_MDIO_H */

View File

@@ -0,0 +1,147 @@
#ifndef __BACKPORT_LINUX_MII_H
#define __BACKPORT_LINUX_MII_H
#include_next <linux/mii.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#include <linux/ethtool.h>
#define ethtool_adv_to_mii_adv_t LINUX_BACKPORT(ethtool_adv_to_mii_adv_t)
static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv)
{
u32 result = 0;
if (ethadv & ADVERTISED_10baseT_Half)
result |= ADVERTISE_10HALF;
if (ethadv & ADVERTISED_10baseT_Full)
result |= ADVERTISE_10FULL;
if (ethadv & ADVERTISED_100baseT_Half)
result |= ADVERTISE_100HALF;
if (ethadv & ADVERTISED_100baseT_Full)
result |= ADVERTISE_100FULL;
if (ethadv & ADVERTISED_Pause)
result |= ADVERTISE_PAUSE_CAP;
if (ethadv & ADVERTISED_Asym_Pause)
result |= ADVERTISE_PAUSE_ASYM;
return result;
}
#define mii_adv_to_ethtool_adv_t LINUX_BACKPORT(mii_adv_to_ethtool_adv_t)
static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
{
u32 result = 0;
if (adv & ADVERTISE_10HALF)
result |= ADVERTISED_10baseT_Half;
if (adv & ADVERTISE_10FULL)
result |= ADVERTISED_10baseT_Full;
if (adv & ADVERTISE_100HALF)
result |= ADVERTISED_100baseT_Half;
if (adv & ADVERTISE_100FULL)
result |= ADVERTISED_100baseT_Full;
if (adv & ADVERTISE_PAUSE_CAP)
result |= ADVERTISED_Pause;
if (adv & ADVERTISE_PAUSE_ASYM)
result |= ADVERTISED_Asym_Pause;
return result;
}
#define ethtool_adv_to_mii_ctrl1000_t LINUX_BACKPORT(ethtool_adv_to_mii_ctrl1000_t)
static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv)
{
u32 result = 0;
if (ethadv & ADVERTISED_1000baseT_Half)
result |= ADVERTISE_1000HALF;
if (ethadv & ADVERTISED_1000baseT_Full)
result |= ADVERTISE_1000FULL;
return result;
}
#define mii_ctrl1000_to_ethtool_adv_t LINUX_BACKPORT(mii_ctrl1000_to_ethtool_adv_t)
static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv)
{
u32 result = 0;
if (adv & ADVERTISE_1000HALF)
result |= ADVERTISED_1000baseT_Half;
if (adv & ADVERTISE_1000FULL)
result |= ADVERTISED_1000baseT_Full;
return result;
}
#define mii_lpa_to_ethtool_lpa_t LINUX_BACKPORT(mii_lpa_to_ethtool_lpa_t)
static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
{
u32 result = 0;
if (lpa & LPA_LPACK)
result |= ADVERTISED_Autoneg;
return result | mii_adv_to_ethtool_adv_t(lpa);
}
#define mii_stat1000_to_ethtool_lpa_t LINUX_BACKPORT(mii_stat1000_to_ethtool_lpa_t)
static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
{
u32 result = 0;
if (lpa & LPA_1000HALF)
result |= ADVERTISED_1000baseT_Half;
if (lpa & LPA_1000FULL)
result |= ADVERTISED_1000baseT_Full;
return result;
}
#define ethtool_adv_to_mii_adv_x LINUX_BACKPORT(ethtool_adv_to_mii_adv_x)
static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv)
{
u32 result = 0;
if (ethadv & ADVERTISED_1000baseT_Half)
result |= ADVERTISE_1000XHALF;
if (ethadv & ADVERTISED_1000baseT_Full)
result |= ADVERTISE_1000XFULL;
if (ethadv & ADVERTISED_Pause)
result |= ADVERTISE_1000XPAUSE;
if (ethadv & ADVERTISED_Asym_Pause)
result |= ADVERTISE_1000XPSE_ASYM;
return result;
}
#define mii_adv_to_ethtool_adv_x LINUX_BACKPORT(mii_adv_to_ethtool_adv_x)
static inline u32 mii_adv_to_ethtool_adv_x(u32 adv)
{
u32 result = 0;
if (adv & ADVERTISE_1000XHALF)
result |= ADVERTISED_1000baseT_Half;
if (adv & ADVERTISE_1000XFULL)
result |= ADVERTISED_1000baseT_Full;
if (adv & ADVERTISE_1000XPAUSE)
result |= ADVERTISED_Pause;
if (adv & ADVERTISE_1000XPSE_ASYM)
result |= ADVERTISED_Asym_Pause;
return result;
}
#define mii_lpa_to_ethtool_lpa_x LINUX_BACKPORT(mii_lpa_to_ethtool_lpa_x)
static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
{
u32 result = 0;
if (lpa & LPA_LPACK)
result |= ADVERTISED_Autoneg;
return result | mii_adv_to_ethtool_adv_x(lpa);
}
#endif
#endif /* __BACKPORT_LINUX_MII_H */

View File

@@ -0,0 +1,9 @@
#ifndef _BACKPORT_LINUX_MISCDEVICE_H
#define _BACKPORT_LINUX_MISCDEVICE_H
#include_next <linux/miscdevice.h>
#ifndef VHCI_MINOR
#define VHCI_MINOR 137
#endif
#endif /* _BACKPORT_LINUX_MISCDEVICE_H */

View File

@@ -0,0 +1,98 @@
#ifndef __BACKPORT_MM_H
#define __BACKPORT_MM_H
#include_next <linux/mm.h>
#ifndef VM_NODUMP
/*
* defined here to allow things to compile but technically
* using this for memory regions will yield in a no-op on newer
* kernels but on older kernels (v3.3 and older) this bit was used
* for VM_ALWAYSDUMP. The goal was to remove this bit moving forward
* and since we can't skip the core dump on old kernels we just make
* this bit name now a no-op.
*
* For details see commits: 909af7 accb61fe cdaaa7003
*/
#define VM_NODUMP 0x0
#endif
#ifndef VM_DONTDUMP
#define VM_DONTDUMP VM_NODUMP
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0))
#define vm_iomap_memory LINUX_BACKPORT(vm_iomap_memory)
int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
#define kvfree LINUX_BACKPORT(kvfree)
void kvfree(const void *addr);
#endif /* < 3.15 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,20,0))
#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked)
long get_user_pages_locked(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages,
int *locked);
#define __get_user_pages_unlocked LINUX_BACKPORT(__get_user_pages_unlocked)
long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages,
unsigned int gup_flags);
#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked)
long get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages);
#endif
#ifndef FOLL_TRIED
#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
#endif
#ifdef CONFIG_BACKPORT_BPAUTO_BUILD_FRAME_VECTOR
/* Container for pinned pfns / pages */
struct frame_vector {
unsigned int nr_allocated; /* Number of frames we have space for */
unsigned int nr_frames; /* Number of frames stored in ptrs array */
bool got_ref; /* Did we pin pages by getting page ref? */
bool is_pfns; /* Does array contain pages or pfns? */
void *ptrs[0]; /* Array of pinned pfns / pages. Use
* pfns_vector_pages() or pfns_vector_pfns()
* for access */
};
struct frame_vector *frame_vector_create(unsigned int nr_frames);
void frame_vector_destroy(struct frame_vector *vec);
int get_vaddr_frames(unsigned long start, unsigned int nr_pfns,
bool write, bool force, struct frame_vector *vec);
void put_vaddr_frames(struct frame_vector *vec);
int frame_vector_to_pages(struct frame_vector *vec);
void frame_vector_to_pfns(struct frame_vector *vec);
static inline unsigned int frame_vector_count(struct frame_vector *vec)
{
return vec->nr_frames;
}
static inline struct page **frame_vector_pages(struct frame_vector *vec)
{
if (vec->is_pfns) {
int err = frame_vector_to_pages(vec);
if (err)
return ERR_PTR(err);
}
return (struct page **)(vec->ptrs);
}
static inline unsigned long *frame_vector_pfns(struct frame_vector *vec)
{
if (!vec->is_pfns)
frame_vector_to_pfns(vec);
return (unsigned long *)(vec->ptrs);
}
#endif
#endif /* __BACKPORT_MM_H */

View File

@@ -0,0 +1,16 @@
#ifndef _BACKPORTLINUX_MMC_HOST_H
#define _BACKPORTLINUX_MMC_HOST_H
#include_next <linux/mmc/host.h>
#include <linux/version.h>
#include <linux/mmc/card.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
#define mmc_card_hs LINUX_BACKPORT(mmc_card_hs)
static inline int mmc_card_hs(struct mmc_card *card)
{
return card->host->ios.timing == MMC_TIMING_SD_HS ||
card->host->ios.timing == MMC_TIMING_MMC_HS;
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) */
#endif /* _BACKPORTLINUX_MMC_HOST_H */

View File

@@ -0,0 +1,21 @@
#ifndef __BACKPORT_MMC_SDIO_H
#define __BACKPORT_MMC_SDIO_H
#include <linux/version.h>
#include_next <linux/mmc/sdio.h>
/* backports b4625dab */
#ifndef SDIO_CCCR_REV_3_00
#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
#endif
#ifndef SDIO_SDIO_REV_3_00
#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
#endif
#ifndef SDIO_BUS_ECSI
#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
#endif
#ifndef SDIO_BUS_SCSI
#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
#endif
#endif /* __BACKPORT_MMC_SDIO_H */

View File

@@ -0,0 +1,10 @@
#ifndef __BACKPORT_MMC_SDIO_FUNC_H
#define __BACKPORT_MMC_SDIO_FUNC_H
#include <linux/version.h>
#include_next <linux/mmc/sdio_func.h>
#ifndef dev_to_sdio_func
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
#endif
#endif /* __BACKPORT_MMC_SDIO_FUNC_H */

View File

@@ -0,0 +1,14 @@
#ifndef __BACKPORT_MMC_SDIO_IDS_H
#define __BACKPORT_MMC_SDIO_IDS_H
#include <linux/version.h>
#include_next <linux/mmc/sdio_ids.h>
#ifndef SDIO_CLASS_BT_AMP
#define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */
#endif
#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN
#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
#endif
#endif /* __BACKPORT_MMC_SDIO_IDS_H */

View File

@@ -0,0 +1,17 @@
#ifndef __BACKPORT_MOD_DEVICETABLE_H
#define __BACKPORT_MOD_DEVICETABLE_H
#include_next <linux/mod_devicetable.h>
#ifndef HID_BUS_ANY
#define HID_BUS_ANY 0xffff
#endif
#ifndef HID_GROUP_ANY
#define HID_GROUP_ANY 0x0000
#endif
#ifndef HID_ANY_ID
#define HID_ANY_ID (~0)
#endif
#endif /* __BACKPORT_MOD_DEVICETABLE_H */

View File

@@ -0,0 +1,69 @@
#ifndef __BACKPORT_LINUX_MODULE_H
#define __BACKPORT_LINUX_MODULE_H
#include_next <linux/module.h>
#include <linux/rcupdate.h>
/*
* The define overwriting module_init is based on the original module_init
* which looks like this:
* #define module_init(initfn) \
* static inline initcall_t __inittest(void) \
* { return initfn; } \
* int init_module(void) __attribute__((alias(#initfn)));
*
* To the call to the initfn we added the symbol dependency on compat
* to make sure that compat.ko gets loaded for any compat modules.
*/
extern void backport_dependency_symbol(void);
#ifdef BACKPORTS_GIT_TRACKED
#define BACKPORT_MOD_VERSIONS MODULE_VERSION(BACKPORTS_GIT_TRACKED);
#else
#define BACKPORT_MOD_VERSIONS \
MODULE_VERSION("backported from " CONFIG_BACKPORT_KERNEL_NAME \
" (" CONFIG_BACKPORT_KERNEL_VERSION ")" \
" using backports " CONFIG_BACKPORT_VERSION);
#endif
#ifdef MODULE
#undef module_init
#define module_init(initfn) \
static int __init __init_backport(void) \
{ \
backport_dependency_symbol(); \
return initfn(); \
} \
int init_module(void) __attribute__((alias("__init_backport")));\
BACKPORT_MOD_VERSIONS
/*
* The define overwriting module_exit is based on the original module_exit
* which looks like this:
* #define module_exit(exitfn) \
* static inline exitcall_t __exittest(void) \
* { return exitfn; } \
* void cleanup_module(void) __attribute__((alias(#exitfn)));
*
* We replaced the call to the actual function exitfn() with a call to our
* function which calls the original exitfn() and then rcu_barrier()
*
* As a module will not be unloaded that ofter it should not have a big
* performance impact when rcu_barrier() is called on every module exit,
* also when no kfree_rcu() backport is used in that module.
*/
#undef module_exit
#define module_exit(exitfn) \
static void __exit __exit_compat(void) \
{ \
exitfn(); \
rcu_barrier(); \
} \
void cleanup_module(void) __attribute__((alias("__exit_compat")));
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#undef param_check_bool
#define param_check_bool(name, p) __param_check(name, p, bool)
#endif
#endif /* __BACKPORT_LINUX_MODULE_H */

View File

@@ -0,0 +1,18 @@
#ifndef __BACKPORT_LINUX_MODULEPARAM_H
#define __BACKPORT_LINUX_MODULEPARAM_H
#include_next <linux/moduleparam.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
#define kernel_param_lock LINUX_BACKPORT(kernel_param_lock)
static inline void kernel_param_lock(struct module *mod)
{
__kernel_param_lock();
}
#define kernel_param_unlock LINUX_BACKPORT(kernel_param_unlock)
static inline void kernel_param_unlock(struct module *mod)
{
__kernel_param_unlock();
}
#endif
#endif /* __BACKPORT_LINUX_MODULEPARAM_H */

View File

@@ -0,0 +1,105 @@
#ifndef __BACKPORT_LINUX_NET_H
#define __BACKPORT_LINUX_NET_H
#include_next <linux/net.h>
#include <linux/static_key.h>
/* This backports:
*
* commit 2033e9bf06f07e049bbc77e9452856df846714cc -- from v3.5
* Author: Neil Horman <nhorman@tuxdriver.com>
* Date: Tue May 29 09:30:40 2012 +0000
*
* net: add MODULE_ALIAS_NET_PF_PROTO_NAME
*/
#ifndef MODULE_ALIAS_NET_PF_PROTO_NAME
#define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \
MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
name)
#endif
#ifndef net_ratelimited_function
#define net_ratelimited_function(function, ...) \
do { \
if (net_ratelimit()) \
function(__VA_ARGS__); \
} while (0)
#define net_emerg_ratelimited(fmt, ...) \
net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
#define net_alert_ratelimited(fmt, ...) \
net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
#define net_crit_ratelimited(fmt, ...) \
net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
#define net_err_ratelimited(fmt, ...) \
net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
#define net_notice_ratelimited(fmt, ...) \
net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
#define net_warn_ratelimited(fmt, ...) \
net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
#define net_info_ratelimited(fmt, ...) \
net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
#define net_dbg_ratelimited(fmt, ...) \
net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
#endif
#ifndef DECLARE_SOCKADDR
#define DECLARE_SOCKADDR(type, dst, src) \
type dst = ({ __sockaddr_check_size(sizeof(*dst)); (type) src; })
#endif
/*
* Avoid backporting this if a distro did the work already, this
* takes the check a bit further than just using LINUX_BACKPORT()
* namespace, curious if any distro will hit a wall with this.
* Also curious if any distro will be daring enough to even try
* to backport this to a release older than 3.5.
*/
#ifndef ___NET_RANDOM_STATIC_KEY_INIT
/*
* Backporting this before 3.5 is extremely tricky -- I tried, due
* to the fact that it relies on static keys, which were refactored
* and optimized through a series of generation of patches from jump
* labels. These in turn have also been optimized through kernel revisions
* and have architecture specific code, which if you commit to backporting
* may affect tracing. My recommendation is that if you have a need for
* static keys you just require at least 3.5 to remain sane.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) && !defined(net_get_random_once)
#define __BACKPORT_NET_GET_RANDOM_ONCE 1
#endif
#endif /* ___NET_RANDOM_STATIC_KEY_INIT */
#ifdef __BACKPORT_NET_GET_RANDOM_ONCE
#define __net_get_random_once LINUX_BACKPORT(__net_get_random_once)
bool __net_get_random_once(void *buf, int nbytes, bool *done,
struct static_key *done_key);
#ifdef HAVE_JUMP_LABEL
#define ___NET_RANDOM_STATIC_KEY_INIT ((struct static_key) \
{ .enabled = ATOMIC_INIT(0), .entries = (void *)1 })
#else /* !HAVE_JUMP_LABEL */
#define ___NET_RANDOM_STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
#endif /* HAVE_JUMP_LABEL */
#define net_get_random_once(buf, nbytes) \
({ \
bool ___ret = false; \
static bool ___done = false; \
static struct static_key ___done_key = \
___NET_RANDOM_STATIC_KEY_INIT; \
if (!static_key_true(&___done_key)) \
___ret = __net_get_random_once(buf, \
nbytes, \
&___done, \
&___done_key); \
___ret; \
})
#endif /* __BACKPORT_NET_GET_RANDOM_ONCE */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
#define sock_create_kern(net, family, type, proto, res) \
__sock_create(net, family, type, proto, res, 1)
#endif
#endif /* __BACKPORT_LINUX_NET_H */

View File

@@ -0,0 +1,48 @@
#ifndef __BACKPORT_NETDEV_FEATURES_H
#define __BACKPORT_NETDEV_FEATURES_H
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#include <linux/netdevice.h>
#include <linux/types.h>
/* added via 9356b8fc */
#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
/* added via d314774c */
#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
/* c8f44aff made this u32 but later a861a8b2 changed it to u64 both on v3.3 */
typedef u32 netdev_features_t;
#else
#include_next <linux/netdev_features.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
/* See commit f646968f8f on next-20130423 */
#define NETIF_F_HW_VLAN_CTAG_TX_BIT NETIF_F_HW_VLAN_TX_BIT
#define NETIF_F_HW_VLAN_CTAG_RX_BIT NETIF_F_HW_VLAN_RX_BIT
#define NETIF_F_HW_VLAN_CTAG_FILTER_BIT NETIF_F_HW_VLAN_FILTER_BIT
#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
#endif
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) */
#if !defined(NETIF_F_RXCSUM)
#define NETIF_F_RXCSUM 0
#endif
#if !defined(NETIF_F_RXALL)
#define NETIF_F_RXALL 0
#endif
#if !defined(NETIF_F_RXFCS)
#define NETIF_F_RXFCS 0
#endif
#endif /* __BACKPORT_NETDEV_FEATURES_H */

View File

@@ -0,0 +1,295 @@
#ifndef __BACKPORT_NETDEVICE_H
#define __BACKPORT_NETDEVICE_H
#include_next <linux/netdevice.h>
#include <linux/netdev_features.h>
#include <linux/version.h>
/*
* This is declared implicitly in newer kernels by netdevice.h using
* this pointer in struct net_device, but declare it here anyway so
* pointers to it are accepted as function arguments without warning.
*/
struct inet6_dev;
/* older kernels don't include this here, we need it */
#include <linux/ethtool.h>
#include <linux/rculist.h>
/*
* new kernels include <net/netprio_cgroup.h> which
* has this ... and some drivers rely on it :-(
*/
#include <linux/hardirq.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
/*
* Backports note: if in-kernel support is provided we could then just
* take the kernel's implementation of __dev_kfree_skb_irq() as it requires
* raise_softirq_irqoff() which is not exported. For the backport case we
* just use slightly less optimized version and we don't get the ability
* to distinguish the two different reasons to free the skb -- whether it
* was consumed or dropped.
*
* The upstream documentation for this:
*
* It is not allowed to call kfree_skb() or consume_skb() from hardware
* interrupt context or with hardware interrupts being disabled.
* (in_irq() || irqs_disabled())
*
* We provide four helpers that can be used in following contexts :
*
* dev_kfree_skb_irq(skb) when caller drops a packet from irq context,
* replacing kfree_skb(skb)
*
* dev_consume_skb_irq(skb) when caller consumes a packet from irq context.
* Typically used in place of consume_skb(skb) in TX completion path
*
* dev_kfree_skb_any(skb) when caller doesn't know its current irq context,
* replacing kfree_skb(skb)
*
* dev_consume_skb_any(skb) when caller doesn't know its current irq context,
* and consumed a packet. Used in place of consume_skb(skb)
*/
#define skb_free_reason LINUX_BACKPORT(skb_free_reason)
enum skb_free_reason {
SKB_REASON_CONSUMED,
SKB_REASON_DROPPED,
};
#define __dev_kfree_skb_irq LINUX_BACKPORT(__dev_kfree_skb_irq)
static inline void __dev_kfree_skb_irq(struct sk_buff *skb,
enum skb_free_reason reason)
{
dev_kfree_skb_irq(skb);
}
#define __dev_kfree_skb_any LINUX_BACKPORT(__dev_kfree_skb_any)
static inline void __dev_kfree_skb_any(struct sk_buff *skb,
enum skb_free_reason reason)
{
dev_kfree_skb_any(skb);
}
#define dev_consume_skb_irq LINUX_BACKPORT(dev_consume_skb_irq)
static inline void dev_consume_skb_irq(struct sk_buff *skb)
{
dev_kfree_skb_irq(skb);
}
#define dev_consume_skb_any LINUX_BACKPORT(dev_consume_skb_any)
static inline void dev_consume_skb_any(struct sk_buff *skb)
{
dev_kfree_skb_any(skb);
}
#if (LINUX_VERSION_CODE != KERNEL_VERSION(3,13,11) || UTS_UBUNTU_RELEASE_ABI < 24)
struct pcpu_sw_netstats {
u64 rx_packets;
u64 rx_bytes;
u64 tx_packets;
u64 tx_bytes;
struct u64_stats_sync syncp;
};
#endif
#define netdev_tstats(dev) ((struct pcpu_sw_netstats *)dev->ml_priv)
#define netdev_assign_tstats(dev, e) dev->ml_priv = (e);
#else
#define netdev_tstats(dev) dev->tstats
#define netdev_assign_tstats(dev, e) dev->tstats = (e);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,8)
#define netdev_set_default_ethtool_ops LINUX_BACKPORT(netdev_set_default_ethtool_ops)
extern void netdev_set_default_ethtool_ops(struct net_device *dev,
const struct ethtool_ops *ops);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
/*
* BQL was added as of v3.3 but some Linux distributions
* have backported BQL to their v3.2 kernels or older. To
* address this we assume that they also enabled CONFIG_BQL
* and test for that here and simply avoid adding the static
* inlines if it was defined
*/
#ifndef CONFIG_BQL
#define netdev_tx_sent_queue LINUX_BACKPORT(netdev_tx_sent_queue)
static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
unsigned int bytes)
{
}
#define netdev_sent_queue LINUX_BACKPORT(netdev_sent_queue)
static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
{
}
#define netdev_tx_completed_queue LINUX_BACKPORT(netdev_tx_completed_queue)
static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
unsigned pkts, unsigned bytes)
{
}
#define netdev_completed_queue LINUX_BACKPORT(netdev_completed_queue)
static inline void netdev_completed_queue(struct net_device *dev,
unsigned pkts, unsigned bytes)
{
}
#define netdev_tx_reset_queue LINUX_BACKPORT(netdev_tx_reset_queue)
static inline void netdev_tx_reset_queue(struct netdev_queue *q)
{
}
#define netdev_reset_queue LINUX_BACKPORT(netdev_reset_queue)
static inline void netdev_reset_queue(struct net_device *dev_queue)
{
}
#endif /* CONFIG_BQL */
#endif /* < 3.3 */
#ifndef NETDEV_PRE_UP
#define NETDEV_PRE_UP 0x000D
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
#define netdev_notifier_info_to_dev(ndev) ndev
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#define netdev_notify_peers(dev) netif_notify_peers(dev)
#define napi_gro_flush(napi, old) napi_gro_flush(napi)
#endif
#ifndef IFF_LIVE_ADDR_CHANGE
#define IFF_LIVE_ADDR_CHANGE 0x100000
#endif
#ifndef IFF_SUPP_NOFCS
#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
#endif
#ifndef IFF_UNICAST_FLT
#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
#endif
#ifndef QUEUE_STATE_ANY_XOFF
#define __QUEUE_STATE_DRV_XOFF __QUEUE_STATE_XOFF
#define __QUEUE_STATE_STACK_XOFF __QUEUE_STATE_XOFF
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
#ifndef NET_NAME_UNKNOWN
#define NET_NAME_UNKNOWN 0
#endif
#ifndef NET_NAME_ENUM
#define NET_NAME_ENUM 1
#endif
#ifndef NET_NAME_PREDICTABLE
#define NET_NAME_PREDICTABLE 2
#endif
#ifndef NET_NAME_USER
#define NET_NAME_USER 3
#endif
#ifndef NET_NAME_RENAMED
#define NET_NAME_RENAMED 4
#endif
#define alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, txqs, rxqs) \
alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
#undef alloc_netdev
#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
#undef alloc_netdev_mq
#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \
count)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0) */
/*
* This backports this commit from upstream:
* commit 87757a917b0b3c0787e0563c679762152be81312
* net: force a list_del() in unregister_netdevice_many()
*/
#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,23) && \
LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)) && \
!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,2) && \
LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) && \
(LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
static inline void backport_unregister_netdevice_many(struct list_head *head)
{
unregister_netdevice_many(head);
if (!(head->next == LIST_POISON1 && head->prev == LIST_POISON2))
list_del(head);
}
#define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
#endif
/*
* Complicated way of saying: We only backport netdev_rss_key stuff on kernels
* that either already have net_get_random_once() (>= 3.13) or where we've been
* brave enough to backport it due to static keys, refer to backports commit
* 8cb8816d for details on difficulty to backport that further down.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
#define __BACKPORT_NETDEV_RSS_KEY_FILL 1
#else
#ifdef __BACKPORT_NET_GET_RANDOM_ONCE
#define __BACKPORT_NETDEV_RSS_KEY_FILL 1
#endif
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
#ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
/* RSS keys are 40 or 52 bytes long */
#define NETDEV_RSS_KEY_LEN 52
#define netdev_rss_key LINUX_BACKPORT(netdev_rss_key)
extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
#define netdev_rss_key_fill LINUX_BACKPORT(netdev_rss_key_fill)
void netdev_rss_key_fill(void *buffer, size_t len);
#endif /* __BACKPORT_NETDEV_RSS_KEY_FILL */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
#define napi_alloc_skb LINUX_BACKPORT(napi_alloc_skb)
static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
unsigned int length)
{
return netdev_alloc_skb_ip_align(napi->dev, length);
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
#ifndef IFF_TX_SKB_SHARING
#define IFF_TX_SKB_SHARING 0
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
netdev_features_t passthru_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
#ifndef netdev_alloc_pcpu_stats
#define netdev_alloc_pcpu_stats(type) \
({ \
typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
if (pcpu_stats) { \
int i; \
for_each_possible_cpu(i) { \
typeof(type) *stat; \
stat = per_cpu_ptr(pcpu_stats, i); \
u64_stats_init(&stat->syncp); \
} \
} \
pcpu_stats; \
})
#endif /* netdev_alloc_pcpu_stats */
#endif /* __BACKPORT_NETDEVICE_H */

View File

@@ -0,0 +1,15 @@
#ifndef __BACKPORT_LINUX_NETLINK_H
#define __BACKPORT_LINUX_NETLINK_H
#include_next <linux/netlink.h>
#include <linux/version.h>
/* this is for patches we apply */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#define netlink_notify_portid(__notify) (__notify->pid)
#define NETLINK_CB_PORTID(__skb) NETLINK_CB(__skb).pid
#else
#define netlink_notify_portid(__notify) (__notify->portid)
#define NETLINK_CB_PORTID(__skb) NETLINK_CB(__skb).portid
#endif
#endif /* __BACKPORT_LINUX_NETLINK_H */

View File

@@ -0,0 +1,10 @@
#ifndef __BACKPORT_LINUX_NL80211_H
#define __BACKPORT_LINUX_NL80211_H
#include_next <linux/nl80211.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#define NL80211_FEATURE_SK_TX_STATUS 0
#endif
#endif /* __BACKPORT_LINUX_NL80211_H */

View File

@@ -0,0 +1,170 @@
#ifndef _COMPAT_LINUX_OF_H
#define _COMPAT_LINUX_OF_H 1
#include <linux/version.h>
#include_next <linux/of.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#ifdef CONFIG_OF
extern struct device_node *of_get_child_by_name(const struct device_node *node,
const char *name);
#else
static inline struct device_node *of_get_child_by_name(
const struct device_node *node,
const char *name)
{
return NULL;
}
#endif /* CONFIG_OF */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#ifndef CONFIG_OF
static inline struct device_node *of_find_node_by_name(struct device_node *from,
const char *name)
{
return NULL;
}
#endif /* CONFIG_OF */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
#define of_property_read_u8_array LINUX_BACKPORT(of_property_read_u8_array)
#ifdef CONFIG_OF
extern int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz);
#else
static inline int of_property_read_u8_array(const struct device_node *np,
const char *propname, u8 *out_values, size_t sz)
{
return -ENOSYS;
}
#endif /* CONFIG_OF */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
#define of_property_read_u32_array LINUX_BACKPORT(of_property_read_u32_array)
#ifdef CONFIG_OF
extern int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values,
size_t sz);
#else
static inline int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values, size_t sz)
{
return -ENOSYS;
}
#endif /* CONFIG_OF */
#define of_property_read_u32 LINUX_BACKPORT(of_property_read_u32)
static inline int of_property_read_u32(const struct device_node *np,
const char *propname,
u32 *out_value)
{
return of_property_read_u32_array(np, propname, out_value, 1);
}
#ifndef CONFIG_OF
#define of_get_property LINUX_BACKPORT(of_get_property)
static inline const void *of_get_property(const struct device_node *node,
const char *name,
int *lenp)
{
return NULL;
}
#endif
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
#define of_property_read_u32_index LINUX_BACKPORT(of_property_read_u32_index)
#ifdef CONFIG_OF
extern int of_property_read_u32_index(const struct device_node *np,
const char *propname,
u32 index, u32 *out_value);
/* This is static in the kernel, but we need it in multiple places */
void *of_find_property_value_of_size(const struct device_node *np,
const char *propname, u32 len);
#else
static inline int of_property_read_u32_index(const struct device_node *np,
const char *propname, u32 index, u32 *out_value)
{
return -ENOSYS;
}
#endif /* CONFIG_OF */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
#define of_property_count_elems_of_size LINUX_BACKPORT(of_property_count_elems_of_size)
#ifdef CONFIG_OF
extern int of_property_count_elems_of_size(const struct device_node *np,
const char *propname, int elem_size);
#else
static inline int of_property_count_elems_of_size(const struct device_node *np,
const char *propname, int elem_size)
{
return -ENOSYS;
}
#endif /* CONFIG_OF */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
/**
* of_property_count_u32_elems - Count the number of u32 elements in a property
*
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
*
* Search for a property in a device node and count the number of u32 elements
* in it. Returns number of elements on sucess, -EINVAL if the property does
* not exist or its length does not match a multiple of u32 and -ENODATA if the
* property does not have a value.
*/
#define of_property_count_u32_elems LINUX_BACKPORT(of_property_count_u32_elems)
static inline int of_property_count_u32_elems(const struct device_node *np,
const char *propname)
{
return of_property_count_elems_of_size(np, propname, sizeof(u32));
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#ifndef CONFIG_OF
#define of_node_get LINUX_BACKPORT(of_node_get)
/* Dummy ref counting routines - to be implemented later */
static inline struct device_node *of_node_get(struct device_node *node)
{
return node;
}
static inline void of_node_put(struct device_node *node) { }
#endif /* CONFIG_OF */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) */
#ifndef of_match_ptr
#ifdef CONFIG_OF
#define of_match_ptr(_ptr) (_ptr)
#else
#define of_match_ptr(_ptr) NULL
#endif /* CONFIG_OF */
#endif /* of_match_ptr */
#ifndef for_each_compatible_node
#define for_each_compatible_node(dn, type, compatible) \
for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
dn = of_find_compatible_node(dn, type, compatible))
#endif /* for_each_compatible_node */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#ifndef CONFIG_OF
static inline struct device_node *of_find_compatible_node(
struct device_node *from,
const char *type,
const char *compat)
{
return NULL;
}
#endif
#endif
#endif /* _COMPAT_LINUX_OF_H */

View File

@@ -0,0 +1,10 @@
#ifndef _COMPAT_LINUX_OLPC_EC_H
#define _COMPAT_LINUX_OLPC_EC_H
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
#include_next <linux/olpc-ec.h>
#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(3,6,0)) */
#endif /* _COMPAT_LINUX_OLPC_EC_H */

View File

@@ -0,0 +1,167 @@
#ifndef _BACKPORT_LINUX_PCI_H
#define _BACKPORT_LINUX_PCI_H
#include_next <linux/pci.h>
#include <linux/version.h>
#ifndef module_pci_driver
/**
* module_pci_driver() - Helper macro for registering a PCI driver
* @__pci_driver: pci_driver struct
*
* Helper macro for PCI drivers which do not do anything special in module
* init/exit. This eliminates a lot of boilerplate. Each module may only
* use this macro once, and calling it replaces module_init() and module_exit()
*/
#define module_pci_driver(__pci_driver) \
module_driver(__pci_driver, pci_register_driver, \
pci_unregister_driver)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
#define pcie_capability_read_word LINUX_BACKPORT(pcie_capability_read_word)
int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val);
#define pcie_capability_read_dword LINUX_BACKPORT(pcie_capability_read_dword)
int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val);
#define pcie_capability_write_word LINUX_BACKPORT(pcie_capability_write_word)
int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val);
#define pcie_capability_write_dword LINUX_BACKPORT(pcie_capability_write_dword)
int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val);
#define pcie_capability_clear_and_set_word LINUX_BACKPORT(pcie_capability_clear_and_set_word)
int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
u16 clear, u16 set);
#define pcie_capability_clear_and_set_dword LINUX_BACKPORT(pcie_capability_clear_and_set_dword)
int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos,
u32 clear, u32 set);
#define pcie_capability_set_word LINUX_BACKPORT(pcie_capability_set_word)
static inline int pcie_capability_set_word(struct pci_dev *dev, int pos,
u16 set)
{
return pcie_capability_clear_and_set_word(dev, pos, 0, set);
}
#define pcie_capability_set_dword LINUX_BACKPORT(pcie_capability_set_dword)
static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos,
u32 set)
{
return pcie_capability_clear_and_set_dword(dev, pos, 0, set);
}
#define pcie_capability_clear_word LINUX_BACKPORT(pcie_capability_clear_word)
static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos,
u16 clear)
{
return pcie_capability_clear_and_set_word(dev, pos, clear, 0);
}
#define pcie_capability_clear_dword LINUX_BACKPORT(pcie_capability_clear_dword)
static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos,
u32 clear)
{
return pcie_capability_clear_and_set_dword(dev, pos, clear, 0);
}
#endif
#ifndef PCI_DEVICE_SUB
/**
* PCI_DEVICE_SUB - macro used to describe a specific pci device with subsystem
* @vend: the 16 bit PCI Vendor ID
* @dev: the 16 bit PCI Device ID
* @subvend: the 16 bit PCI Subvendor ID
* @subdev: the 16 bit PCI Subdevice ID
*
* This macro is used to create a struct pci_device_id that matches a
* specific device with subsystem information.
*/
#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \
.vendor = (vend), .device = (dev), \
.subvendor = (subvend), .subdevice = (subdev)
#endif /* PCI_DEVICE_SUB */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
#define pci_dev_flags LINUX_BACKPORT(pci_dev_flags)
#define PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG LINUX_BACKPORT(PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG)
#define PCI_DEV_FLAGS_NO_D3 LINUX_BACKPORT(PCI_DEV_FLAGS_NO_D3)
#define PCI_DEV_FLAGS_ASSIGNED LINUX_BACKPORT(PCI_DEV_FLAGS_ASSIGNED)
enum pci_dev_flags {
/* INTX_DISABLE in PCI_COMMAND register disables MSI
* generation too.
*/
PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
/* Device configuration is irrevocably lost if disabled into D3 */
PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
/* Provide indication device is assigned by a Virtual Machine Manager */
PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
};
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
#define pci_sriov_set_totalvfs LINUX_BACKPORT(pci_sriov_set_totalvfs)
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
/* Taken from drivers/pci/pci.h */
struct pci_sriov {
int pos; /* capability position */
int nres; /* number of resources */
u32 cap; /* SR-IOV Capabilities */
u16 ctrl; /* SR-IOV Control */
u16 total_VFs; /* total VFs associated with the PF */
u16 initial_VFs; /* initial VFs associated with the PF */
u16 num_VFs; /* number of VFs available */
u16 offset; /* first VF Routing ID offset */
u16 stride; /* following VF stride */
u32 pgsz; /* page size for BAR alignment */
u8 link; /* Function Dependency Link */
u16 driver_max_VFs; /* max num VFs driver supports */
struct pci_dev *dev; /* lowest numbered PF */
struct pci_dev *self; /* this PF */
struct mutex lock; /* lock for VF bus */
struct work_struct mtask; /* VF Migration task */
u8 __iomem *mstate; /* VF Migration State Array */
};
#define pci_vfs_assigned LINUX_BACKPORT(pci_vfs_assigned)
#ifdef CONFIG_PCI_IOV
int pci_vfs_assigned(struct pci_dev *dev);
#else
static inline int pci_vfs_assigned(struct pci_dev *dev)
{
return 0;
}
#endif
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0))
#define pci_enable_msi_range LINUX_BACKPORT(pci_enable_msi_range)
#ifdef CONFIG_PCI_MSI
int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
#else
static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,
int maxvec)
{ return -ENOSYS; }
#endif
#endif
#ifdef CONFIG_PCI
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
#define pci_enable_msix_range LINUX_BACKPORT(pci_enable_msix_range)
#ifdef CONFIG_PCI_MSI
int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
int minvec, int maxvec);
#else
static inline int pci_enable_msix_range(struct pci_dev *dev,
struct msix_entry *entries, int minvec, int maxvec)
{ return -ENOSYS; }
#endif
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
#define pci_device_is_present LINUX_BACKPORT(pci_device_is_present)
bool pci_device_is_present(struct pci_dev *pdev);
#endif
#endif /* _BACKPORT_LINUX_PCI_H */

View File

@@ -0,0 +1,11 @@
#ifndef __BACKPORT_LINUX_PHY_H
#define __BACKPORT_LINUX_PHY_H
#include_next <linux/phy.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
#define phy_connect(dev, bus_id, handler, interface) \
phy_connect(dev, bus_id, handler, 0, interface)
#endif
#endif /* __BACKPORT_LINUX_PHY_H */

View File

@@ -0,0 +1,108 @@
#ifndef __BACKPORT_LINUX_PKT_SCHED_H
#define __BACKPORT_LINUX_PKT_SCHED_H
#include_next <linux/pkt_sched.h>
#include <linux/version.h>
/*
* This backports:
*
* From 76e3cc126bb223013a6b9a0e2a51238d1ef2e409 Mon Sep 17 00:00:00 2001
* From: Eric Dumazet <edumazet@google.com>
* Date: Thu, 10 May 2012 07:51:25 +0000
* Subject: [PATCH] codel: Controlled Delay AQM
*
* Added via v3.5
*/
#ifndef TCA_CODEL_MAX
/* CODEL */
#define COMPAT_CODEL_BACKPORT
enum {
TCA_CODEL_UNSPEC,
TCA_CODEL_TARGET,
TCA_CODEL_LIMIT,
TCA_CODEL_INTERVAL,
TCA_CODEL_ECN,
__TCA_CODEL_MAX
};
#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
struct tc_codel_xstats {
__u32 maxpacket; /* largest packet we've seen so far */
__u32 count; /* how many drops we've done since the last time we
* entered dropping state
*/
__u32 lastcount; /* count at entry to dropping state */
__u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
__s32 drop_next; /* time to drop next packet */
__u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
__u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
__u32 dropping; /* are we in dropping state ? */
};
/* This backports:
*
* commit 4b549a2ef4bef9965d97cbd992ba67930cd3e0fe
* Author: Eric Dumazet <edumazet@google.com>
* Date: Fri May 11 09:30:50 2012 +0000
* fq_codel: Fair Queue Codel AQM
*/
/* FQ_CODEL */
enum {
TCA_FQ_CODEL_UNSPEC,
TCA_FQ_CODEL_TARGET,
TCA_FQ_CODEL_LIMIT,
TCA_FQ_CODEL_INTERVAL,
TCA_FQ_CODEL_ECN,
TCA_FQ_CODEL_FLOWS,
TCA_FQ_CODEL_QUANTUM,
__TCA_FQ_CODEL_MAX
};
#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
enum {
TCA_FQ_CODEL_XSTATS_QDISC,
TCA_FQ_CODEL_XSTATS_CLASS,
};
struct tc_fq_codel_qd_stats {
__u32 maxpacket; /* largest packet we've seen so far */
__u32 drop_overlimit; /* number of time max qdisc
* packet limit was hit
*/
__u32 ecn_mark; /* number of packets we ECN marked
* instead of being dropped
*/
__u32 new_flow_count; /* number of time packets
* created a 'new flow'
*/
__u32 new_flows_len; /* count of flows in new list */
__u32 old_flows_len; /* count of flows in old list */
};
struct tc_fq_codel_cl_stats {
__s32 deficit;
__u32 ldelay; /* in-queue delay seen by most recently
* dequeued packet
*/
__u32 count;
__u32 lastcount;
__u32 dropping;
__s32 drop_next;
};
struct tc_fq_codel_xstats {
__u32 type;
union {
struct tc_fq_codel_qd_stats qdisc_stats;
struct tc_fq_codel_cl_stats class_stats;
};
};
#endif /* TCA_CODEL_MAX */
#endif /* __BACKPORT_LINUX_PKT_SCHED_H */

View File

@@ -0,0 +1,36 @@
#ifndef __BACKPORT_PLATFORM_DEVICE_H
#define __BACKPORT_PLATFORM_DEVICE_H
#include_next <linux/platform_device.h>
#include <linux/version.h>
#ifndef module_platform_driver_probe
#define module_platform_driver_probe(__platform_driver, __platform_probe) \
static int __init __platform_driver##_init(void) \
{ \
return platform_driver_probe(&(__platform_driver), \
__platform_probe); \
} \
module_init(__platform_driver##_init); \
static void __exit __platform_driver##_exit(void) \
{ \
platform_driver_unregister(&(__platform_driver)); \
} \
module_exit(__platform_driver##_exit);
#endif
#ifndef PLATFORM_DEVID_NONE
#define PLATFORM_DEVID_NONE (-1)
#endif
#ifndef PLATFORM_DEVID_AUTO
#define PLATFORM_DEVID_AUTO (-1)
#endif
#ifndef module_platform_driver
#define module_platform_driver(__platform_driver) \
module_driver(__platform_driver, platform_driver_register, \
platform_driver_unregister)
#endif
#endif /* __BACKPORT_PLATFORM_DEVICE_H */

View File

@@ -0,0 +1,17 @@
#ifndef __BACKPORT_PM_H
#define __BACKPORT_PM_H
#include_next <linux/pm.h>
#ifndef PM_EVENT_AUTO
#define PM_EVENT_AUTO 0x0400
#endif
#ifndef PM_EVENT_SLEEP
#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND)
#endif
#ifndef PMSG_IS_AUTO
#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
#endif
#endif /* __BACKPORT_PM_H */

View File

@@ -0,0 +1,16 @@
#ifndef _COMPAT_LINUX_PM_QOS_H
#define _COMPAT_LINUX_PM_QOS_H 1
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
#include_next <linux/pm_qos.h>
#else
#include <linux/pm_qos_params.h>
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
#ifndef PM_QOS_DEFAULT_VALUE
#define PM_QOS_DEFAULT_VALUE -1
#endif
#endif /* _COMPAT_LINUX_PM_QOS_H */

View File

@@ -0,0 +1,19 @@
#ifndef __BACKPORT_LINUX_PNP_H
#define __BACKPORT_LINUX_PNP_H
#include_next <linux/pnp.h>
#ifndef module_pnp_driver
/**
* module_pnp_driver() - Helper macro for registering a PnP driver
* @__pnp_driver: pnp_driver struct
*
* Helper macro for PnP drivers which do not do anything special in module
* init/exit. This eliminates a lot of boilerplate. Each module may only
* use this macro once, and calling it replaces module_init() and module_exit()
*/
#define module_pnp_driver(__pnp_driver) \
module_driver(__pnp_driver, pnp_register_driver, \
pnp_unregister_driver)
#endif
#endif /* __BACKPORT_LINUX_PNP_H */

View File

@@ -0,0 +1,20 @@
#ifndef __BACKPORT_LINUX_POLL_H
#define __BACKPORT_LINUX_POLL_H
#include_next <linux/poll.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
#define poll_does_not_wait LINUX_BACKPORT(poll_does_not_wait)
static inline bool poll_does_not_wait(const poll_table *p)
{
return p == NULL || p->qproc == NULL;
}
#define poll_requested_events LINUX_BACKPORT(poll_requested_events)
static inline unsigned long poll_requested_events(const poll_table *p)
{
return p ? p->key : ~0UL;
}
#endif /* < 3.4 */
#endif /* __BACKPORT_LINUX_POLL_H */

View File

@@ -0,0 +1,146 @@
#ifndef _COMPAT_LINUX_PRINTK_H
#define _COMPAT_LINUX_PRINTK_H 1
#include <linux/version.h>
#include_next <linux/printk.h>
/* see pr_fmt at end of file */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
/* backports 7a555613 */
#if defined(CONFIG_DYNAMIC_DEBUG)
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
__builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
print_hex_dump(KERN_DEBUG, prefix_str, \
prefix_type, rowsize, groupsize, \
buf, len, ascii); \
} while (0)
#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii) \
dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii)
#else
#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii) \
print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \
groupsize, buf, len, ascii)
#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
#ifndef pr_warn
#define pr_warn pr_warning
#endif
#ifndef printk_once
#define printk_once(x...) ({ \
static bool __print_once; \
\
if (!__print_once) { \
__print_once = true; \
printk(x); \
} \
})
#endif
#ifndef printk_ratelimited
/*
* ratelimited messages with local ratelimit_state,
* no local ratelimit_state used in the !PRINTK case
*/
#ifdef CONFIG_PRINTK
#define printk_ratelimited(fmt, ...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
\
if (__ratelimit(&_rs)) \
printk(fmt, ##__VA_ARGS__); \
})
#else
#define printk_ratelimited(fmt, ...) \
no_printk(fmt, ##__VA_ARGS__)
#endif
#endif /* printk_ratelimited */
#ifndef pr_emerg_ratelimited
#define pr_emerg_ratelimited(fmt, ...) \
printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_emerg_ratelimited */
#ifndef pr_alert_ratelimited
#define pr_alert_ratelimited(fmt, ...) \
printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_alert_ratelimited */
#ifndef pr_crit_ratelimited
#define pr_crit_ratelimited(fmt, ...) \
printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_crit_ratelimited */
#ifndef pr_err_ratelimited
#define pr_err_ratelimited(fmt, ...) \
printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_err_ratelimited */
#ifndef pr_warn_ratelimited
#define pr_warn_ratelimited(fmt, ...) \
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_warn_ratelimited */
#ifndef pr_notice_ratelimited
#define pr_notice_ratelimited(fmt, ...) \
printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_notice_ratelimited */
#ifndef pr_info_ratelimited
#define pr_info_ratelimited(fmt, ...) \
printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
#endif /* pr_info_ratelimited */
/* no pr_cont_ratelimited, don't do that... */
#ifndef pr_devel_ratelimited
#if defined(DEBUG)
#define pr_devel_ratelimited(fmt, ...) \
printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#else
#define pr_devel_ratelimited(fmt, ...) \
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif
#endif /* pr_devel_ratelimited */
#ifndef pr_debug_ratelimited
/* If you are writing a driver, please use dev_dbg instead */
#if defined(CONFIG_DYNAMIC_DEBUG)
/* descriptor check is first to prevent flooding with "callbacks suppressed" */
#define pr_debug_ratelimited(fmt, ...) \
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
__ratelimit(&_rs)) \
__dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
} while (0)
#elif defined(DEBUG)
#define pr_debug_ratelimited(fmt, ...) \
printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#else
#define pr_debug_ratelimited(fmt, ...) \
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif
#endif /* pr_debug_ratelimited */
#endif /* _COMPAT_LINUX_PRINTK_H */
/* This must be outside -- see also kernel.h */
#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif

View File

@@ -0,0 +1,29 @@
#ifndef __BACKPORT_PROC_FS_H
#define __BACKPORT_PROC_FS_H
#include_next <linux/proc_fs.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
#ifdef CONFIG_PROC_FS
/*
* backport of:
* procfs: new helper - PDE_DATA(inode)
*/
#define PDE_DATA LINUX_BACKPORT(PDE_DATA)
static inline void *PDE_DATA(const struct inode *inode)
{
return PROC_I(inode)->pde->data;
}
extern void proc_set_size(struct proc_dir_entry *, loff_t);
extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
#else
#define PDE_DATA LINUX_BACKPORT(PDE_DATA)
static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
#endif /* CONFIG_PROC_FS */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
#endif /* __BACKPORT_PROC_FS_H */

View File

@@ -0,0 +1,40 @@
#ifndef __BACKPORT_PTP_CLOCK_KERNEL_H
#define __BACKPORT_PTP_CLOCK_KERNEL_H
#include <linux/version.h>
#include_next <linux/ptp_clock_kernel.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
#include <linux/posix-clock.h>
#define PTP_MAX_TIMESTAMPS 128
#define PTP_BUF_TIMESTAMPS 30
struct timestamp_event_queue {
struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS];
int head;
int tail;
spinlock_t lock;
};
struct ptp_clock {
struct posix_clock clock;
struct device *dev;
struct ptp_clock_info *info;
dev_t devid;
int index; /* index into clocks.map */
struct pps_device *pps_source;
struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
struct mutex tsevq_mux; /* one process at a time reading the fifo */
wait_queue_head_t tsev_wq;
int defunct; /* tells readers to go away when clock is being removed */
};
extern int ptp_clock_index(struct ptp_clock *ptp);
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) && !defined(CONFIG_SUSE_KERNEL)
#define ptp_clock_register(info,parent) ptp_clock_register(info)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
#endif /* __BACKPORT_PTP_CLOCK_KERNEL_H */

View File

@@ -0,0 +1,45 @@
#ifndef __BACKPORT_RANDOM_H
#define __BACKPORT_RANDOM_H
#include_next <linux/random.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,4,10)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,2,27)) || \
LINUX_VERSION_CODE < KERNEL_VERSION(3,0,41)
#define add_device_randomness LINUX_BACKPORT(add_device_randomness)
static inline void add_device_randomness(const void *buf, unsigned int size)
{
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
/* backports 496f2f9 */
#define prandom_seed(_seed) srandom32(_seed)
#define prandom_u32() random32()
#define prandom_u32_state(_state) prandom32(_state)
/* backport 6582c665d6b882dad8329e05749fbcf119f1ab88 */
#define prandom_bytes LINUX_BACKPORT(prandom_bytes)
void prandom_bytes(void *buf, int bytes);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
/**
* prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
* @ep_ro: right open interval endpoint
*
* Returns a pseudo-random number that is in interval [0, ep_ro). Note
* that the result depends on PRNG being well distributed in [0, ~0U]
* u32 space. Here we use maximally equidistributed combined Tausworthe
* generator, that is, prandom_u32(). This is useful when requesting a
* random index of an array containing ep_ro elements, for example.
*
* Returns: pseudo-random number in interval [0, ep_ro)
*/
#define prandom_u32_max LINUX_BACKPORT(prandom_u32_max)
static inline u32 prandom_u32_max(u32 ep_ro)
{
return (u32)(((u64) prandom_u32() * ep_ro) >> 32);
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */
#endif /* __BACKPORT_RANDOM_H */

View File

@@ -0,0 +1,57 @@
#ifndef __BACKPORT_RCULIST_H
#define __BACKPORT_RCULIST_H
#include_next <linux/rculist.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
#include <backport/magic.h>
#define hlist_for_each_entry_rcu4(tpos, pos, head, member) \
for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \
pos && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });\
pos = rcu_dereference_raw(hlist_next_rcu(pos)))
#define hlist_for_each_entry_rcu3(pos, head, member) \
for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
typeof(*(pos)), member); \
pos; \
pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
&(pos)->member)), typeof(*(pos)), member))
#undef hlist_for_each_entry_rcu
#define hlist_for_each_entry_rcu(...) \
macro_dispatcher(hlist_for_each_entry_rcu, __VA_ARGS__)(__VA_ARGS__)
#endif /* < 3.9 */
#ifndef list_for_each_entry_continue_rcu
#define list_for_each_entry_continue_rcu(pos, head, member) \
for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
#endif
#ifndef list_entry_rcu
#define list_entry_rcu(ptr, type, member) \
container_of(rcu_dereference(ptr), type, member)
#endif
#ifndef list_first_or_null_rcu
/**
* list_first_or_null_rcu - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note that if the list is empty, it returns NULL.
*
* This primitive may safely run concurrently with the _rcu list-mutation
* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
*/
#define list_first_or_null_rcu(ptr, type, member) \
({ \
struct list_head *__ptr = (ptr); \
struct list_head *__next = ACCESS_ONCE(__ptr->next); \
likely(__ptr != __next) ? list_entry_rcu(__next, type, member) : NULL; \
})
#endif /* list_first_or_null_rcu */
#endif /* __BACKPORT_RCULIST_H */

View File

@@ -0,0 +1,44 @@
#ifndef __BACKPORT_LINUX_RCUPDATE_H
#define __BACKPORT_LINUX_RCUPDATE_H
#include_next <linux/rcupdate.h>
/*
* This adds a nested function everywhere kfree_rcu() was called. This
* function frees the memory and is given as a function to call_rcu().
* The rcu callback could happen every time also after the module was
* unloaded and this will cause problems. To address that problem, we
* put rcu_barrier() into each module_exit() in module.h.
*/
#if !defined(kfree_rcu)
#define kfree_rcu(data, rcuhead) do { \
void __kfree_rcu_fn(struct rcu_head *rcu_head) \
{ \
void *___ptr; \
___ptr = container_of(rcu_head, typeof(*(data)), rcuhead);\
kfree(___ptr); \
} \
call_rcu(&(data)->rcuhead, __kfree_rcu_fn); \
} while (0)
#endif
#ifndef RCU_INIT_POINTER
#define RCU_INIT_POINTER(p, v) \
p = (typeof(*v) __force __rcu *)(v)
#endif
#ifndef rcu_dereference_check
#define rcu_dereference_check(p, c) rcu_dereference(p)
#endif
#ifndef rcu_dereference_protected
#define rcu_dereference_protected(p, c) (p)
#endif
#ifndef rcu_access_pointer
#define rcu_access_pointer(p) ACCESS_ONCE(p)
#endif
#ifndef rcu_dereference_raw
#define rcu_dereference_raw(p) rcu_dereference(p)
#endif
#endif /* __BACKPORT_LINUX_RCUPDATE_H */

View File

@@ -0,0 +1,51 @@
#ifndef __BACKPORT_LINUX_REGMAP_H
#define __BACKPORT_LINUX_REGMAP_H
#include_next <linux/regmap.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
#define dev_get_regmap LINUX_BACKPORT(dev_get_regmap)
static inline
struct regmap *dev_get_regmap(struct device *dev, const char *name)
{
return NULL;
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
#if defined(CONFIG_REGMAP)
#define devm_regmap_init LINUX_BACKPORT(devm_regmap_init)
struct regmap *devm_regmap_init(struct device *dev,
const struct regmap_bus *bus,
const struct regmap_config *config);
#if defined(CONFIG_REGMAP_I2C)
#define devm_regmap_init_i2c LINUX_BACKPORT(devm_regmap_init_i2c)
struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
const struct regmap_config *config);
#endif /* defined(CONFIG_REGMAP_I2C) */
/*
* We can't backport these unless we try to backport
* the full regmap into core so warn if used.
* No drivers are using this yet anyway.
*/
#define regmap_raw_write_async LINUX_BACKPORT(regmap_raw_write_async)
static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
const void *val, size_t val_len)
{
WARN_ONCE(1, "regmap API is disabled");
return -EINVAL;
}
#define regmap_async_complete LINUX_BACKPORT(regmap_async_complete)
static inline void regmap_async_complete(struct regmap *map)
{
WARN_ONCE(1, "regmap API is disabled");
}
#endif /* defined(CONFIG_REGMAP) */
#endif /* 3.2 <= version < 3.4 */
#endif /* __BACKPORT_LINUX_REGMAP_H */

Some files were not shown because too many files have changed in this diff Show More