compat: generate CONFIG_COMPAT_KERNEL_3_8

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

We backport hid_ignore() as of next-20121211, that is now
used by other drivers.

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    2m9.630s
user    8m55.525s
sys     2m2.460s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: backport PCI_EXP_LNKCTL_ASPM_L0S and PCI_EXP_LNKCTL_ASPM_L1

This backports the addition of two defines added by the
commit below.

commit 7508320678b7819ac6aeb89580b8622a424ce586
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Wed Dec 5 13:51:19 2012 -0700

    PCI: Add standard PCIe Capability Link ASPM field names

    Add standard #defines for ASPM fields in PCI Express Link Capability and
    Link Control registers.

    Previously we used PCIE_LINK_STATE_L0S and PCIE_LINK_STATE_L1 directly, but
    these are defined for the Linux ASPM interfaces, e.g.,
    pci_disable_link_state(), and only coincidentally match the actual register
    bits.  PCIE_LINK_STATE_CLKPM, also part of that interface, does not match
    the register bit.

    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
    Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: backport definition of HID_TYPE_USBNONE

This is declared within the enum:

enum hid_type {
       HID_TYPE_OTHER = 0,
       HID_TYPE_USBMOUSE,
       HID_TYPE_USBNONE
};

But we just declare it as a define for 2.

This backports was added with the below commit:

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 6dc1418e
v3.1-rc1~309^2^2~14

commit 6dc1418e13144162e8bc4858789010d8f0e1e65c
Author: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
Date:   Mon May 23 15:45:44 2011 -0700

    HID: yurex: recognize GeneralKeys wireless presenter as generic HID

    Unfortunately, the device seems to have the same Vendor ID and Product ID
    as YUREX leg-shakes sensors, and the commit 6bc235a2e2 ("USB: add driver
    for Meywa-Denki & Kayac YUREX") added the ID to hid_ignore_list.

    I believe that we can distinguish YUREX and the Wireless Presenter by
    device type.  The patch below makes the driver ignore only YUREX
    (bInterfaceProtocol==0), and recognize Wireless Presenter
    (bInterfaceProtocol is keyboard or mouse) as generic HID.  (I don't have
    the Wireless Presenter, so not yet ested.)

    ** YUREX lsusb information:
    Bus 002 Device 007: ID 0c45:1010 Microdia
    Device Descriptor:
       bLength                18
       bDescriptorType         1
       bcdUSB               1.10
       bDeviceClass            0 (Defined at Interface level)
       bDeviceSubClass         0
       bDeviceProtocol         0
       bMaxPacketSize0         8
       idVendor           0x0c45 Microdia
       idProduct          0x1010
       bcdDevice            0.03
       iManufacturer           1 JESS
       iProduct                2 YUREX
       iSerial                 3 10000269
       bNumConfigurations      1
       Configuration Descriptor:
         bLength                 9
         bDescriptorType         2
         wTotalLength           34
         bNumInterfaces          1
         bConfigurationValue     1
         iConfiguration          0
         bmAttributes         0xa0
           (Bus Powered)
           Remote Wakeup
         MaxPower              100mA
         Interface Descriptor:
           bLength                 9
           bDescriptorType         4
           bInterfaceNumber        0
           bAlternateSetting       0
           bNumEndpoints           1
           bInterfaceClass         3 Human Interface Device
           bInterfaceSubClass      1 Boot Interface Subclass
           bInterfaceProtocol      0 None
           iInterface              0
             HID Device Descriptor:
               bLength                 9
               bDescriptorType        33
               bcdHID               1.10
               bCountryCode            0 Not supported
               bNumDescriptors         1
               bDescriptorType        34 Report
               wDescriptorLength      31
              Report Descriptors:
                ** UNAVAILABLE **
           Endpoint Descriptor:
             bLength                 7
             bDescriptorType         5
             bEndpointAddress     0x81  EP 1 IN
             bmAttributes            3
               Transfer Type            Interrupt
               Synch Type               None
               Usage Type               Data
             wMaxPacketSize     0x0008  1x 8 bytes
             bInterval              10
    Device Status:     0x0002
       (Bus Powered)
       Remote Wakeup Enabled

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=26922

    Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
    Cc: Greg KH <gregkh@suse.de>
    Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
    Cc: Maciej Rutecki <maciej.rutecki@gmail.com>
    Reported-by: Thomas B?chler <thomas@archlinux.org>
    Tested-by: Thomas B?chler <thomas@archlinux.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
compat: add HID_QUIRK_HIDDEV_FORCE and HID_QUIRK_NO_IGNORE

We just need the definitions.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains b5e5a37e
v2.6.35-rc1~454^2~5^2~14

commit b5e5a37e36cd4d355b875665312d7aaae4e5833c
Author: Bastien Nocera <hadess@hadess.net>
Date:   Fri Apr 16 17:19:50 2010 +0100

    HID: add HID_QUIRK_HIDDEV_FORCE and HID_QUIRK_NO_IGNORE

    Add two quirks to make it possible for usbhid module options to
    override whether a device is ignored (HID_QUIRK_NO_IGNORE) and
    whether to connect a hiddev device (HID_QUIRK_HIDDEV_FORCE).

    Passing HID_QUIRK_NO_IGNORE for your device means that it will
    not be ignored by the HID layer, even if present in a blacklist.

    HID_QUIRK_HIDDEV_FORCE will force the creation of a hiddev for that
    device, making it accessible from user-space.

    Tested with an Apple IR Receiver, switching it from using appleir
    to using lirc's macmini driver.

    Signed-off-by: Bastien Nocera <hadess@hadess.net>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>

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

Just add the define.

mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 6f4303fb
v2.6.30-rc1~219^2~9

commit 6f4303fb2ec68055e793b84887a7ae0f9ea7cc2d
Author: Jiri Kosina <jkosina@suse.cz>
Date:   Thu Jan 29 00:15:51 2009 +0100

    HID: bring back possibility to specify vid/pid ignore on module load

    When hid quirks were converted to specialized driver, the HID_QUIRK_IGNORE
    has been moved completely, as the hid_ignore_list[] has been moved into the
    generic code.

    However userspace already got used to the possibility that modprobing
    usbhid with

        'quirks=vid:pid:0x4'

    makes the device ignored by usbhid driver. So keep this quirk flag in place
    for backwards compatibility.

    Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
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>
compat: fix compiler warning in nla_get_s64()

This fixes the following warning:

compat/include/linux/compat-3.7.h: In function ‘nla_get_s64’:
compat/include/linux/compat-3.7.h:191:2: warning: passing argument 2 of ‘nla_memcpy’ discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from include/net/genetlink.h:5:0,
                 from compat/include/linux/compat-2.6.32.h:12,
                 from compat/include/linux/compat-2.6.29.h:13,
                 from compat/include/linux/compat-2.6.h:50,
                 from <command-line>:0:

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