compat: backport HID_USB_DEVICE() and HID_BLUETOOTH_DEVICE()

commit 070748ed0b52399858a5967026a452bbb903a64c
Author: Henrik Rydberg <rydberg@euromail.se>
Date:   Mon Apr 23 12:07:05 2012 +0200

    HID: Create a generic device group

    Devices that do not have a special driver are handled by the generic
    driver. This patch does the same thing using device groups; Instead of
    forcing a particular driver, the appropriate driver is picked up by
    udev. As a consequence, one can now move a device from generic to
    specific handling by a simple rebind. By adding a new device id to the
    generic driver, the same thing can be done in reverse.

    Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
    Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: backport struct hid_device_id

Kernels older than 2.6.28 did not have this
defined. Add it.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains e8c84f9a
v2.6.28-rc1~571^2~54

commit e8c84f9a5f06912c94c38961096c994da3890a2e
Author: Jiri Slaby <jirislaby@gmail.com>
Date:   Mon May 19 15:50:01 2008 +0200

    modpost: add support for hid

    Generate aliases for hid device modules to support autoloading.

    Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: fix compilation on hid_ignore()

This fixes compilation on the addition of hid_ignore()
for kernels older than 2.6.28.

mcgrof@drvbp1 ~/compat (git::master)$ time ckmake
Trying kernel 3.6.5-030605-generic [OK]
Trying kernel 3.5.7-030507-generic [OK]
Trying kernel 3.4.17-030417-generic [OK]
Trying kernel 3.3.8-030308-generic [OK]
Trying kernel 3.2.33-030233-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.50-030050-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063513-generic [OK]
Trying kernel 2.6.34-02063413-generic [OK]
Trying kernel 2.6.33-02063320-generic [OK]
Trying kernel 2.6.32-02063260-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    1m58.798s
user    3m59.967s
sys     1m25.585s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: backport platform_device_register_data()

Add the helper.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains d8bf254
v2.6.28-rc1~284^2~9

commit d8bf254089a6c31d7d01a4d1d2f1861662900855
Author: Dmitry Baryshkov <dbaryshkov@gmail.com>
Date:   Mon Sep 22 14:41:40 2008 -0700

    platform: add new device registration helper

    Add a helper that registers simple platform_device w/o resources but with
    parent and device data.

    This is usefull to cleanup platform code from code that registers such
    simple devices as leds-gpio, generic-bl, etc.

    Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
    Cc: David Brownell <dbrownell@users.sourceforge.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

mcgrof@drvbp1 ~/compat (git::master)$ time ckmake
Trying kernel 3.6.5-030605-generic [OK]
Trying kernel 3.5.7-030507-generic [OK]
Trying kernel 3.4.17-030417-generic [OK]
Trying kernel 3.3.8-030308-generic [OK]
Trying kernel 3.2.33-030233-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.50-030050-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063513-generic [OK]
Trying kernel 2.6.34-02063413-generic [OK]
Trying kernel 2.6.33-02063320-generic [OK]
Trying kernel 2.6.32-02063260-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    1m58.798s
user    3m59.967s
sys     1m25.585s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: adjust get-compat-kernels for root usage

If the user id is root then don't assume we want it
under / but instead use the current directory.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: adjust get-compat-kernels for root users

Prefix the download / target directory with compat-ksrc/
if root is used.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: add v3.7 to get-compat-kernels

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: add support for forcing get-compat-kernels

Useful for cronjobs.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: fix get-compat-kernels for rebuilding kernel headers

We need to rebuild headers for kernels >= 3.4, and while at
it account for 4.0 and x.y kernels here x > 3.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: add 3.2 and 3.3 kernels to rebuild headers

The 3.2 and 3.3 kernels also require rebuilding
kernel headers for glibc dependencies.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: rewrite ckmake in Python

This rewrites ckmake in Python. I suspected that we can still
improve compilation down by making ckmake multithreaded.
I was right, and in order to make this multithreaded I picked
python and ncurses to display results. This shaves down 6
minutes for compilation of compat-drivers on 24 kernels from
25 minutes down to 19 minutes. This can likely be improved
further.

Before:

real    25m28.705s
user    506m26.003s
sys     69m45.990s

After:

real    19m4.757s
user    486m26.236s
sys     70m5.579s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: add ionice to ckmake again

This adds back the ionice settings on the make
call. The copying of content on the thread is not
yet reniced and although Python has utilities to
modify niceness and ionice there are privileged
requirements on the levels we want and I'm not too
sure yet how to resolve this in a reasonable way.

This for example fails:

	p = psutil.Process(os.getpid())
	delta = -20 - os.nice(0)
	p.set_nice(delta)
	p.set_ionice(psutil.IOPRIO_CLASS_RT)

This improves perfomance by about 1 minute.

real    17m53.079s
user    446m12.733s
sys     66m13.372s

Since ckmake is multithreaded now though it meant that
we had to copy the content of the code that we want to
compile for each kernel on a new directory. This work
is not reprioritized as it is nice so the best thing
I can think of is we renice the ckmake process our
ourselves and therefore children would properly inherit
the priority.

ionice -c 3 nice -n 20 ckmake

Can we do better without networking the solution ?

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: move HID_USB_DEVICE and HID_BLUETOOTH_DEVICE

These were actually introduced in 2.6.28.h and as such
we were getting a lot of redefinition warnings which
can cause delays in compilation. Lets clear this up ;)

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>