backports: check for define in module_driver and not kernel version

In some places backports checked for the kernel version on weather to
add a own define for module_driver or not. This patch makes it check if
there is already one or not.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add backport_ prefix in front of BQL functions

Sometimes these functions are backported in the kernel, add the
backports_ prefix to prevent the names from colliding.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: remove duplicate allyesconfig from help

allyesconfig was mentioned in the help dialog twice.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add backport_ in front of sign_extend32()

sign_extend32() is also backported by the RHEL kernel, this fixes a
compile problem.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: refresh patches on next-20131129

== ckmake-report.log ==

1   2.6.25              [  OK  ]
2   2.6.26              [  OK  ]
3   2.6.27              [  OK  ]
4   2.6.28              [  OK  ]
5   2.6.29              [  OK  ]
6   2.6.30              [  OK  ]
7   2.6.31              [  OK  ]
8   2.6.32              [  OK  ]
9   2.6.33              [  OK  ]
10  2.6.34              [  OK  ]
11  2.6.35              [  OK  ]
12  2.6.36              [  OK  ]
13  2.6.37              [  OK  ]
14  2.6.38              [  OK  ]
15  2.6.39              [  OK  ]
16  3.0.101             [  OK  ]
17  3.1.10              [  OK  ]
18  3.10.20             [  OK  ]
19  3.11.9              [  OK  ]
20  3.12.1              [  OK  ]
21  3.13-rc1            [  OK  ]
22  3.2.52              [  OK  ]
23  3.3.8               [  OK  ]
24  3.4.70              [  OK  ]
25  3.5.7               [  OK  ]
26  3.6.11              [  OK  ]
27  3.7.10              [  OK  ]
28  3.8.13              [  OK  ]
29  3.9.11              [  OK  ]

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
ckmake: sort kernel releases properly

Ever since 3.10, kernel releases weren't sorted properly.
Put them into a parsed list first and then sort them to
get the 3.10/11/12 etc. to the bottom of the list.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add support for prandom_bytes

This was added in 3.8 and not used until now.
Since it it being used by the wireless stack, backport it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[mcgrof: fixed renamed prandom_bytes_state to prandom_bytes on symbol]
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: backport ktime_to_ms()

This backports ktime_to_ms()

mcgrof@cerro ~/linux-next (git::master)$ git describe --contains f56916b9
v2.6.35-rc1~490^2~16

commit f56916b97fe2031761ca611f0a342efd913afb33
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Fri May 7 13:34:37 2010 -0400

    ktime: introduce ktime_to_ms()

    To report ktime statistics to user space in milliseconds, a new helper
    is required.

    When considering how to do this conversion, I didn't immediately see
    why the extra step of converting ktime to a timeval was needed.  To
    make that more clear, introduce a couple of large comments.

    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: backport getrawmonotonic() with do_posix_clock_monotonic_gettime()

We cannot properly backport getrawmonotonic() as it requires some
in-kernel changes which cannot be backported so the best thing we
can do is provide at least the monotonic time. This will only be
done as a compromise for kernels that didn't have getrawmonotonic()
which are kernels < 2.6.28, which hopefully we can just deprecate
completely soon. The example users which pushes us to backport this
is change via linux-next 09d8e315d for ath9k, titled:

"ath9k_hw: fix TSF save/restore around chip reset"

The original commit that added getrawmonotonic() was 2d42244ae.

mcgrof@cerro ~/linux-next (git::master)$ git describe --contains 2d42244ae
v2.6.28-rc1~82^2~1

commit 2d42244ae71d6c7b0884b5664cf2eda30fb2ae68
Author: John Stultz <johnstul@us.ibm.com>
Date:   Wed Aug 20 16:37:30 2008 -0700

    clocksource: introduce CLOCK_MONOTONIC_RAW

    In talking with Josip Loncaric, and his work on clock synchronization (see
    btime.sf.net), he mentioned that for really close synchronization, it is
    useful to have access to "hardware time", that is a notion of time that is
    not in any way adjusted by the clock slewing done to keep close time sync.

    Part of the issue is if we are using the kernel's ntp adjusted
    representation of time in order to measure how we should correct time, we
    can run into what Paul McKenney aptly described as "Painting a road using
    the lines we're painting as the guide".

    I had been thinking of a similar problem, and was trying to come up with a
    way to give users access to a purely hardware based time representation
    that avoided users having to know the underlying frequency and mask values
    needed to deal with the wide variety of possible underlying hardware
    counters.

    My solution is to introduce CLOCK_MONOTONIC_RAW.  This exposes a
    nanosecond based time value, that increments starting at bootup and has no
    frequency adjustments made to it what so ever.

    The time is accessed from userspace via the posix_clock_gettime() syscall,
    passing CLOCK_MONOTONIC_RAW as the clock_id.

    Signed-off-by: John Stultz <johnstul@us.ibm.com>
    Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

Cc: Felix Fietkau <nbd@openwrt.org>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: refresh patches for next-20131206

Run time of generation of release:

real    5m28.543s
user    3m4.536s
sys     2m2.940s

spatch version 1.0.0-rc17 with Python support and with PCRE support

== ckmake-report.log ==

1   2.6.25              [  OK  ]
2   2.6.26              [  OK  ]
3   2.6.27              [  OK  ]
4   2.6.28              [  OK  ]
5   2.6.29              [  OK  ]
6   2.6.30              [  OK  ]
7   2.6.31              [  OK  ]
8   2.6.32              [  OK  ]
9   2.6.33              [  OK  ]
10  2.6.34              [  OK  ]
11  2.6.35              [  OK  ]
12  2.6.36              [  OK  ]
13  2.6.37              [  OK  ]
14  2.6.38              [  OK  ]
15  2.6.39              [  OK  ]
16  3.0.101             [  OK  ]
17  3.1.10              [  OK  ]
18  3.2.52              [  OK  ]
19  3.3.8               [  OK  ]
20  3.4.70              [  OK  ]
21  3.5.7               [  OK  ]
22  3.6.11              [  OK  ]
23  3.7.10              [  OK  ]
24  3.8.13              [  OK  ]
25  3.9.11              [  OK  ]
26  3.10.20             [  OK  ]
27  3.11.9              [  OK  ]
28  3.12.1              [  OK  ]
29  3.13-rc1            [  OK  ]

real    37m43.297s
user    1030m36.392s
sys     138m31.368s

Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: remove DMI_EXACT_MATCH

DMI_EXACT_MATCH was only used by the Intel gpu driver which was removed.
Kernel 3.10.21 also has DMI_EXACT_MATCH which collides with backports
definition.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add missing include for linux/of.h

This fixes a compile error with some config options.
Closes bug: https://bugzilla.kernel.org/show_bug.cgi?id=66601

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reported-by: Richard Röjfors <richard.rojfors@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add LINUX_BACKPORT infront of functions

This is needed to add support for SLES 11 SP3 support.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: remove unused workqueue backports

These backports are not used by any driver code and some of them are
conflicting with code from RHEL 6.5 headers.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: so not add netdev_features_t on RHEL 6.5

RHEL 6.5 already contains netdev_features_t which will collide with
backports definition.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add missing LINUX_BACKPORT() on various places

This fixes lots of compile problems on RHEL 6.5.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: fix skb_add_rx_fragi() for SLES 11 SP3

SLES 11 SP3 backported skb_add_rx_frag() with 6 arguments and we have
to use that function with the truesize parameter. This removes the
define for SLES 11 SP3 like it is done for RHEL.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: do not call dev_hw_addr_random()

SLES 11 SP3 does not have dev_hw_addr_random() so this patch includes
the stuff which would be done in dev_hw_addr_random() in
eth_hw_addr_random().

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: add Python based backports-update-manager

This replaces the old shell scripts:

  * get-compat-kernels
  * get-compat-trees

with a shiny central Python based backpor update manager:

  * backports-update-manager

The new version provides a few features which were
simply a difficult to implement and quite frankly
pointless to try to implement in shell. Things worth
mentioning:

  * This will now monitor your old directories
    and packages and remove any stale old directory
    or packages. You should feel comfortable with
    now just getting the latest code from the repo
    and always just running the script, it will do
    everything you wished it did for you.

  * This will always check the URLs and ensure your
    file size matches the target upstream size, we
    used to only check if you had the file or not

  * The compat-ksrc directory was renamed to
    ksrc-backports which goes inline with our
    rebranding crusade. The tool is smart enough
    to figure out if you had the old name and
    rename it for you. Its also smart enough to
    figure out if you had your old compat-ksrc
    as a symlink and preserve things just as you
    intended following the old real path.

  * The debs/ directory is now moved into
    ksrc-backports, making it easier to manage
    and detect what is or not part of backports.

  * I found no way to deal with objects to extract
    GNU archive items with Python, so we're stuck with
    requiring GNU ar, this provides a simple wrapper
    for our usage.

  * For the tree updater we instead or relying on
    Linus' tree to be a remote we leave it separately
    but always use --reference and allow users to provide
    their own --reference override for new clones.
    It should be easy to extend this should others have
    other custom work spaces through a config file or
    the like.

  * To keep backports up to date on a system after
    an initial run one should only need to run through
    a cronjob:

	backports-update-manager --force

    To only update the git trees:

	backports-update-manager --force --git-trees-only

Relying on an continued update list is dumb though,
in the future we should look into putting out new
builds through without requiring GNU ar and also
updating the list through a json file just as the
kernel has its own now:

	https://www.kernel.org/releases.json

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
backports: convert the 62-usb_driver_lpm patch series to SmPL

This is easily expressed instead as an SmPL patch for
interpretation with Coccinelle. This replaces 336 lines
patch code with 9 lines of SmPL.

Cc: Peter Senna <peter.senna@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>