]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Mar 2010 21:04:58 +0000 (13:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Mar 2010 21:04:58 +0000 (13:04 -0800)
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (38 commits)
  sata_via: Delay on vt6420 when starting ATAPI DMA write
  ata: Detect Delkin Devices compact flash
  pata_efar: Enable parallel scanning
  pata_atiixp: enable parallel scan
  [libata] pata_atiixp: add locking for parallel scanning
  [libata] pata_efar: add locking for parallel scanning
  libata: Pass host flags into the pci helper
  [libata] pata_marvell: CONFIG_AHCI is really CONFIG_SATA_AHCI
  libata: Allow pata_legacy to be built on non-ISA but PCI systems
  pata_pdc202xx_old: fix UDMA mode for PDC2026x chipsets
  pata_pdc202xx_old: fix UDMA mode for Promise UDMA33 cards
  [libata] pata_at91: fix backslash-continued string
  pata_via: store UDMA masks in via_isa_bridges table
  pata_via: fix address setup timings underlocking
  pata_serverworks: fix error message
  pata_serverworks: fix PIO setup for the second channel
  pata_efar: fix secondary port support
  pata_cypress: fix PIO timings underclocking
  pata_cs5535: use correct values for PIO1 and PIO2 data timings
  pata_cmd64x: remove unused definitions
  ...

270 files changed:
Documentation/feature-removal-schedule.txt
Documentation/input/sentelic.txt
arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h
arch/cris/arch-v10/kernel/irq.c
arch/cris/arch-v32/kernel/irq.c
arch/cris/arch-v32/kernel/pinmux.c
arch/cris/arch-v32/mach-a3/pinmux.c
arch/cris/arch-v32/mach-fs/pinmux.c
arch/cris/kernel/irq.c
arch/ia64/Kconfig
arch/ia64/Makefile
arch/ia64/configs/bigsur_defconfig
arch/ia64/configs/generic_defconfig
arch/ia64/configs/gensparse_defconfig
arch/ia64/configs/sim_defconfig
arch/ia64/configs/tiger_defconfig
arch/ia64/configs/xen_domu_defconfig
arch/ia64/configs/zx1_defconfig
arch/ia64/hp/common/aml_nfw.c
arch/ia64/ia32/Makefile [deleted file]
arch/ia64/ia32/audit.c [deleted file]
arch/ia64/ia32/binfmt_elf32.c [deleted file]
arch/ia64/ia32/elfcore32.h [deleted file]
arch/ia64/ia32/ia32_entry.S [deleted file]
arch/ia64/ia32/ia32_ldt.c [deleted file]
arch/ia64/ia32/ia32_signal.c [deleted file]
arch/ia64/ia32/ia32_support.c [deleted file]
arch/ia64/ia32/ia32_traps.c [deleted file]
arch/ia64/ia32/ia32priv.h [deleted file]
arch/ia64/ia32/sys_ia32.c [deleted file]
arch/ia64/include/asm/acpi.h
arch/ia64/include/asm/ia32.h [deleted file]
arch/ia64/include/asm/processor.h
arch/ia64/include/asm/scatterlist.h
arch/ia64/include/asm/syscall.h
arch/ia64/include/asm/system.h
arch/ia64/include/asm/unistd.h
arch/ia64/kernel/Makefile
arch/ia64/kernel/acpi.c
arch/ia64/kernel/audit.c
arch/ia64/kernel/entry.S
arch/ia64/kernel/ivt.S
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/process.c
arch/ia64/kernel/ptrace.c
arch/ia64/kernel/setup.c
arch/ia64/kernel/signal.c
arch/ia64/kernel/smpboot.c
arch/ia64/kernel/traps.c
arch/ia64/mm/init.c
arch/ia64/uv/kernel/setup.c
arch/ia64/xen/hypercall.S
arch/ia64/xen/xen_pv_ops.c
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
drivers/acpi/acpica/accommon.h
drivers/acpi/acpica/acconfig.h
drivers/acpi/acpica/acdebug.h
drivers/acpi/acpica/acdispat.h
drivers/acpi/acpica/acevents.h
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/achware.h
drivers/acpi/acpica/acinterp.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/acobject.h
drivers/acpi/acpica/acopcode.h
drivers/acpi/acpica/acparser.h
drivers/acpi/acpica/acpredef.h
drivers/acpi/acpica/acresrc.h
drivers/acpi/acpica/acstruct.h
drivers/acpi/acpica/actables.h
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/amlcode.h
drivers/acpi/acpica/amlresrc.h
drivers/acpi/acpica/dsfield.c
drivers/acpi/acpica/dsinit.c
drivers/acpi/acpica/dsmethod.c
drivers/acpi/acpica/dsmthdat.c
drivers/acpi/acpica/dsobject.c
drivers/acpi/acpica/dsopcode.c
drivers/acpi/acpica/dsutils.c
drivers/acpi/acpica/dswexec.c
drivers/acpi/acpica/dswload.c
drivers/acpi/acpica/dswscope.c
drivers/acpi/acpica/dswstate.c
drivers/acpi/acpica/evevent.c
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evgpeblk.c
drivers/acpi/acpica/evmisc.c
drivers/acpi/acpica/evregion.c
drivers/acpi/acpica/evrgnini.c
drivers/acpi/acpica/evsci.c
drivers/acpi/acpica/evxface.c
drivers/acpi/acpica/evxfevnt.c
drivers/acpi/acpica/evxfregn.c
drivers/acpi/acpica/exconfig.c
drivers/acpi/acpica/exconvrt.c
drivers/acpi/acpica/excreate.c
drivers/acpi/acpica/exdump.c
drivers/acpi/acpica/exfield.c
drivers/acpi/acpica/exfldio.c
drivers/acpi/acpica/exmisc.c
drivers/acpi/acpica/exmutex.c
drivers/acpi/acpica/exnames.c
drivers/acpi/acpica/exoparg1.c
drivers/acpi/acpica/exoparg2.c
drivers/acpi/acpica/exoparg3.c
drivers/acpi/acpica/exoparg6.c
drivers/acpi/acpica/exprep.c
drivers/acpi/acpica/exregion.c
drivers/acpi/acpica/exresnte.c
drivers/acpi/acpica/exresolv.c
drivers/acpi/acpica/exresop.c
drivers/acpi/acpica/exstore.c
drivers/acpi/acpica/exstoren.c
drivers/acpi/acpica/exstorob.c
drivers/acpi/acpica/exsystem.c
drivers/acpi/acpica/exutils.c
drivers/acpi/acpica/hwacpi.c
drivers/acpi/acpica/hwgpe.c
drivers/acpi/acpica/hwregs.c
drivers/acpi/acpica/hwsleep.c
drivers/acpi/acpica/hwtimer.c
drivers/acpi/acpica/hwvalid.c
drivers/acpi/acpica/hwxface.c
drivers/acpi/acpica/nsaccess.c
drivers/acpi/acpica/nsalloc.c
drivers/acpi/acpica/nsdump.c
drivers/acpi/acpica/nsdumpdv.c
drivers/acpi/acpica/nseval.c
drivers/acpi/acpica/nsinit.c
drivers/acpi/acpica/nsload.c
drivers/acpi/acpica/nsnames.c
drivers/acpi/acpica/nsobject.c
drivers/acpi/acpica/nsparse.c
drivers/acpi/acpica/nspredef.c
drivers/acpi/acpica/nsrepair.c
drivers/acpi/acpica/nsrepair2.c
drivers/acpi/acpica/nssearch.c
drivers/acpi/acpica/nsutils.c
drivers/acpi/acpica/nswalk.c
drivers/acpi/acpica/nsxfeval.c
drivers/acpi/acpica/nsxfname.c
drivers/acpi/acpica/nsxfobj.c
drivers/acpi/acpica/psargs.c
drivers/acpi/acpica/psloop.c
drivers/acpi/acpica/psopcode.c
drivers/acpi/acpica/psparse.c
drivers/acpi/acpica/psscope.c
drivers/acpi/acpica/pstree.c
drivers/acpi/acpica/psutils.c
drivers/acpi/acpica/pswalk.c
drivers/acpi/acpica/psxface.c
drivers/acpi/acpica/rsaddr.c
drivers/acpi/acpica/rscalc.c
drivers/acpi/acpica/rscreate.c
drivers/acpi/acpica/rsdump.c
drivers/acpi/acpica/rsinfo.c
drivers/acpi/acpica/rsio.c
drivers/acpi/acpica/rsirq.c
drivers/acpi/acpica/rslist.c
drivers/acpi/acpica/rsmemory.c
drivers/acpi/acpica/rsmisc.c
drivers/acpi/acpica/rsutils.c
drivers/acpi/acpica/rsxface.c
drivers/acpi/acpica/tbfadt.c
drivers/acpi/acpica/tbfind.c
drivers/acpi/acpica/tbinstal.c
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/tbxface.c
drivers/acpi/acpica/tbxfroot.c
drivers/acpi/acpica/utalloc.c
drivers/acpi/acpica/utcopy.c
drivers/acpi/acpica/utdebug.c
drivers/acpi/acpica/utdelete.c
drivers/acpi/acpica/uteval.c
drivers/acpi/acpica/utglobal.c
drivers/acpi/acpica/utids.c
drivers/acpi/acpica/utinit.c
drivers/acpi/acpica/utlock.c
drivers/acpi/acpica/utmath.c
drivers/acpi/acpica/utmisc.c
drivers/acpi/acpica/utmutex.c
drivers/acpi/acpica/utobject.c
drivers/acpi/acpica/utresrc.c
drivers/acpi/acpica/utstate.c
drivers/acpi/acpica/utxface.c
drivers/acpi/battery.c
drivers/acpi/ec.c
drivers/acpi/glue.c
drivers/acpi/osl.c
drivers/acpi/power_meter.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_throttling.c
drivers/acpi/utils.c
drivers/acpi/video.c
drivers/ata/libata-acpi.c
drivers/char/keyboard.c
drivers/ide/ide-acpi.c
drivers/input/evdev.c
drivers/input/gameport/emu10k1-gp.c
drivers/input/gameport/fm801-gp.c
drivers/input/gameport/gameport.c
drivers/input/gameport/ns558.c
drivers/input/input-compat.h
drivers/input/input.c
drivers/input/joydev.c
drivers/input/joystick/Kconfig
drivers/input/joystick/gamecon.c
drivers/input/joystick/xpad.c
drivers/input/keyboard/Kconfig
drivers/input/keyboard/Makefile
drivers/input/keyboard/adp5588-keys.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/gpio_keys.c
drivers/input/keyboard/imx_keypad.c [new file with mode: 0644]
drivers/input/keyboard/qt2160.c
drivers/input/keyboard/sh_keysc.c
drivers/input/misc/apanel.c
drivers/input/misc/atlas_btns.c
drivers/input/misc/rotary_encoder.c
drivers/input/misc/uinput.c
drivers/input/misc/winbond-cir.c
drivers/input/mouse/hgpk.c
drivers/input/serio/pcips2.c
drivers/input/serio/serio.c
drivers/input/serio/xilinx_ps2.c
drivers/input/tablet/gtco.c
drivers/input/tablet/wacom.h
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/tablet/wacom_wac.h
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/ads7846.c
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/mainstone-wm97xx.c
drivers/input/touchscreen/s3c2410_ts.c
drivers/input/touchscreen/tsc2007.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/input/touchscreen/zylonite-wm97xx.c
drivers/input/xen-kbdfront.c
drivers/macintosh/Kconfig
drivers/macintosh/mac_hid.c
drivers/pci/pci-acpi.c
drivers/platform/x86/toshiba_bluetooth.c
drivers/platform/x86/wmi.c
include/acpi/acexcep.h
include/acpi/acnames.h
include/acpi/acoutput.h
include/acpi/acpi.h
include/acpi/acpi_bus.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acrestyp.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actypes.h
include/acpi/platform/acenv.h
include/acpi/platform/acgcc.h
include/acpi/platform/aclinux.h
include/acpi/processor.h
include/linux/gameport.h
include/linux/gpio_keys.h
include/linux/input.h
include/linux/input/sh_keysc.h
include/linux/kbd_kern.h
include/linux/serio.h

index ea401495528d1e4e6ccd7042dd0deca7566a189b..732b1fa48cf2d8b927fd4fe395c856b1f5079050 100644 (file)
@@ -538,3 +538,26 @@ Why:       Duplicate functionality with the gspca_zc3xx driver, zc0301 only
        sensors) wich are also supported by the gspca_zc3xx driver
        (which supports 53 USB-ID's in total)
 Who:   Hans de Goede <hdegoede@redhat.com>
+
+----------------------------
+
+What:  corgikbd, spitzkbd, tosakbd driver
+When:  2.6.35
+Files: drivers/input/keyboard/{corgi,spitz,tosa}kbd.c
+Why:   We now have a generic GPIO based matrix keyboard driver that
+       are fully capable of handling all the keys on these devices.
+       The original drivers manipulate the GPIO registers directly
+       and so are difficult to maintain.
+Who:   Eric Miao <eric.y.miao@gmail.com>
+
+----------------------------
+
+What:  corgi_ssp and corgi_ts driver
+When:  2.6.35
+Files: arch/arm/mach-pxa/corgi_ssp.c, drivers/input/touchscreen/corgi_ts.c
+Why:   The corgi touchscreen is now deprecated in favour of the generic
+       ads7846.c driver. The noise reduction technique used in corgi_ts.c,
+       that's to wait till vsync before ADC sampling, is also integrated into
+       ads7846 driver now. Provided that the original driver is not generic
+       and is difficult to maintain, it will be removed later.
+Who:   Eric Miao <eric.y.miao@gmail.com>
index f7160a2fb6a2c91dfb61362362268c50c5b9033a..b35affd5c6496353dbb8e95398f89078671a2efa 100644 (file)
@@ -1,5 +1,5 @@
-Copyright (C) 2002-2008 Sentelic Corporation.
-Last update: Oct-31-2008
+Copyright (C) 2002-2010 Sentelic Corporation.
+Last update: Jan-13-2010
 
 ==============================================================================
 * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons)
@@ -44,7 +44,7 @@ B) MSID 6: Horizontal and Vertical scrolling.
 Packet 1
    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
-  1   |Y|X|y|x|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 | | |B|F|l|r|u|d|
+  1   |Y|X|y|x|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 | | |B|F|r|l|u|d|
       |---------------|     |---------------|    |---------------|    |---------------|
 
 Byte 1: Bit7 => Y overflow
@@ -59,15 +59,15 @@ Byte 2: X Movement(9-bit 2's complement integers)
 Byte 3: Y Movement(9-bit 2's complement integers)
 Byte 4: Bit0 => the Vertical scrolling movement downward.
        Bit1 => the Vertical scrolling movement upward.
-       Bit2 => the Vertical scrolling movement rightward.
-       Bit3 => the Vertical scrolling movement leftward.
+       Bit2 => the Horizontal scrolling movement leftward.
+       Bit3 => the Horizontal scrolling movement rightward.
         Bit4 => 1 = 4th mouse button is pressed, Forward one page.
                 0 = 4th mouse button is not pressed.
         Bit5 => 1 = 5th mouse button is pressed, Backward one page.
                 0 = 5th mouse button is not pressed.
 
 C) MSID 7:
-# FSP uses 2 packets(8 Bytes) data to represent Absolute Position
+# FSP uses 2 packets (8 Bytes) to represent Absolute Position.
   so we have PACKET NUMBER to identify packets.
   If PACKET NUMBER is 0, the packet is Packet 1.
   If PACKET NUMBER is 1, the packet is Packet 2.
@@ -129,7 +129,7 @@ Byte 3: Message Type => 0x00 (Disabled)
 Byte 4: Bit7~Bit0 => Don't Care
 
 ==============================================================================
-* Absolute position for STL3888-A0.
+* Absolute position for STL3888-Ax.
 ==============================================================================
 Packet 1 (ABSOLUTE POSITION)
    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
@@ -179,14 +179,14 @@ Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
         Bit5~Bit4 => y2_g
         Bit7~Bit6 => x2_g
 
-Notify Packet for STL3888-A0
+Notify Packet for STL3888-Ax
    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
   1   |1|0|1|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|d|u|0|0|0|0|
       |---------------|     |---------------|    |---------------|    |---------------|
 
 Byte 1: Bit7~Bit6 => 00, Normal data packet
-                  => 01, Absolute coordination packet
+                  => 01, Absolute coordinates packet
                   => 10, Notify packet
         Bit5 => 1
         Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1):
@@ -205,15 +205,106 @@ Byte 4: Bit7 => scroll right button
         Bit6 => scroll left button
         Bit5 => scroll down button
         Bit4 => scroll up button
-            * Note that if gesture and additional button (Bit4~Bit7)
-             happen at the same time, the button information will not
-             be sent.
+            * Note that if gesture and additional buttoni (Bit4~Bit7)
+              happen at the same time, the button information will not
+              be sent.
+        Bit3~Bit0 => Reserved
+
+Sample sequence of Multi-finger, Multi-coordinate mode:
+
+       notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1,
+       abs pkt 2, ..., notify packet (valid bit == 0)
+
+==============================================================================
+* Absolute position for STL3888-B0.
+==============================================================================
+Packet 1(ABSOLUTE POSITION)
+   Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
+BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
+  1   |0|1|V|F|1|0|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|u|d|X|X|Y|Y|
+      |---------------|     |---------------|    |---------------|    |---------------|
+
+Byte 1: Bit7~Bit6 => 00, Normal data packet
+                  => 01, Absolute coordinates packet
+                  => 10, Notify packet
+        Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
+                When both fingers are up, the last two reports have zero valid
+                bit.
+        Bit4 => finger up/down information. 1: finger down, 0: finger up.
+        Bit3 => 1
+        Bit2 => finger index, 0 is the first finger, 1 is the second finger.
+        Bit1 => Right Button, 1 is pressed, 0 is not pressed.
+        Bit0 => Left Button, 1 is pressed, 0 is not pressed.
+Byte 2: X coordinate (xpos[9:2])
+Byte 3: Y coordinate (ypos[9:2])
+Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
+        Bit3~Bit2 => X coordinate (ypos[1:0])
+        Bit4 => scroll down button
+        Bit5 => scroll up button
+        Bit6 => scroll left button
+        Bit7 => scroll right button
+
+Packet 2 (ABSOLUTE POSITION)
+   Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
+BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
+  1   |0|1|V|F|1|1|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|u|d|X|X|Y|Y|
+      |---------------|     |---------------|    |---------------|    |---------------|
+
+Byte 1: Bit7~Bit6 => 00, Normal data packet
+                  => 01, Absolute coordination packet
+                  => 10, Notify packet
+        Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
+                When both fingers are up, the last two reports have zero valid
+                bit.
+        Bit4 => finger up/down information. 1: finger down, 0: finger up.
+        Bit3 => 1
+        Bit2 => finger index, 0 is the first finger, 1 is the second finger.
+        Bit1 => Right Button, 1 is pressed, 0 is not pressed.
+        Bit0 => Left Button, 1 is pressed, 0 is not pressed.
+Byte 2: X coordinate (xpos[9:2])
+Byte 3: Y coordinate (ypos[9:2])
+Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
+        Bit3~Bit2 => X coordinate (ypos[1:0])
+        Bit4 => scroll down button
+        Bit5 => scroll up button
+        Bit6 => scroll left button
+        Bit7 => scroll right button
+
+Notify Packet for STL3888-B0
+   Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
+BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
+  1   |1|0|1|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|u|d|0|0|0|0|
+      |---------------|     |---------------|    |---------------|    |---------------|
+
+Byte 1: Bit7~Bit6 => 00, Normal data packet
+                  => 01, Absolute coordination packet
+                  => 10, Notify packet
+        Bit5 => 1
+        Bit4 => when in absolute coordinate mode (valid when EN_PKT_GO is 1):
+                0: left button is generated by the on-pad command
+                1: left button is generated by the external button
+        Bit3 => 1
+        Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
+        Bit1 => Right Button, 1 is pressed, 0 is not pressed.
+        Bit0 => Left Button, 1 is pressed, 0 is not pressed.
+Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode)
+Byte 3: Bit7~Bit6 => Don't care
+        Bit5~Bit4 => Number of fingers
+        Bit3~Bit1 => Reserved
+        Bit0 => 1: enter gesture mode; 0: leaving gesture mode
+Byte 4: Bit7 => scroll right button
+        Bit6 => scroll left button
+        Bit5 => scroll up button
+        Bit4 => scroll down button
+            * Note that if gesture and additional button(Bit4~Bit7)
+              happen at the same time, the button information will not
+              be sent.
         Bit3~Bit0 => Reserved
 
 Sample sequence of Multi-finger, Multi-coordinate mode:
 
        notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1,
-       abs pkt 2, ..., notify packet(valid bit == 0)
+       abs pkt 2, ..., notify packet (valid bit == 0)
 
 ==============================================================================
 * FSP Enable/Disable packet
@@ -409,7 +500,8 @@ offset      width           default r/w     name
                                        0: read only, 1: read/write enable
        (Note that following registers does not require clock gating being
        enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e
-       40 41 42 43.)
+       40 41 42 43.  In addition to that, this bit must be 1 when gesture
+       mode is enabled)
 
 0x31                           RW      on-pad command detection
        bit7            0       RW      on-pad command left button down tag
@@ -463,6 +555,10 @@ offset     width           default r/w     name
        absolute coordinates; otherwise, host only receives packets with
        relative coordinate.)
 
+       bit7            0       RW      EN_PS2_F2: PS/2 gesture mode 2nd
+                                       finger packet enable
+                                       0: disable, 1: enable
+
 0x43                           RW      on-pad control
        bit0            0       RW      on-pad control enable
                                        0: disable, 1: enable
index 62d17421e48c0f62a4327b9e0a977f781cd71b10..1e2f4e97f428d072b942a5020ab32f28028d084b 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef __ASM_ARCH_EP93XX_KEYPAD_H
 #define __ASM_ARCH_EP93XX_KEYPAD_H
 
+struct matrix_keymap_data;
+
 /* flags for the ep93xx_keypad driver */
 #define EP93XX_KEYPAD_DISABLE_3_KEY    (1<<0)  /* disable 3-key reset */
 #define EP93XX_KEYPAD_DIAG_MODE                (1<<1)  /* diagnostic mode */
 
 /**
  * struct ep93xx_keypad_platform_data - platform specific device structure
- * @matrix_key_map:            array of keycodes defining the keypad matrix
- * @matrix_key_map_size:       ARRAY_SIZE(matrix_key_map)
- * @debounce:                  debounce start count; terminal count is 0xff
- * @prescale:                  row/column counter pre-scaler load value
- * @flags:                     see above
+ * @keymap_data:       pointer to &matrix_keymap_data
+ * @debounce:          debounce start count; terminal count is 0xff
+ * @prescale:          row/column counter pre-scaler load value
+ * @flags:             see above
  */
 struct ep93xx_keypad_platform_data {
-       unsigned int    *matrix_key_map;
-       int             matrix_key_map_size;
+       struct matrix_keymap_data *keymap_data;
        unsigned int    debounce;
        unsigned int    prescale;
        unsigned int    flags;
index 5d75f77f9c733267d323b309eba85e1df34d8617..1a61efc139826870b156eabc26987f9a3319852a 100644 (file)
@@ -133,7 +133,7 @@ static void end_crisv10_irq(unsigned int irq)
 }
 
 static struct irq_chip crisv10_irq_type = {
-       .typename =    "CRISv10",
+       .name =        "CRISv10",
        .startup =     startup_crisv10_irq,
        .shutdown =    shutdown_crisv10_irq,
        .enable =      enable_crisv10_irq,
index 57668db25031ca34bc965ee5abe1612e9f191e76..b6241198fb98d86c72ab48999e40989fdf552411 100644 (file)
@@ -336,7 +336,7 @@ int set_affinity_crisv32_irq(unsigned int irq, const struct cpumask *dest)
 }
 
 static struct irq_chip crisv32_irq_type = {
-       .typename =    "CRISv32",
+       .name =        "CRISv32",
        .startup =     startup_crisv32_irq,
        .shutdown =    shutdown_crisv32_irq,
        .enable =      enable_crisv32_irq,
index 6eb54ea1c97622a6b652d831691b5f1bf58f2ee1..f6f3637a41942f5e3de93925c4026acd11d5dc3a 100644 (file)
@@ -54,7 +54,7 @@ crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
 
        crisv32_pinmux_init();
 
-       if (port > PORTS)
+       if (port > PORTS || port < 0)
                return -EINVAL;
 
        spin_lock_irqsave(&pinmux_lock, flags);
@@ -197,7 +197,7 @@ crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
 
        crisv32_pinmux_init();
 
-       if (port > PORTS)
+       if (port > PORTS || port < 0)
                return -EINVAL;
 
        spin_lock_irqsave(&pinmux_lock, flags);
index 0a28c9bedfb722321def3f079ea3d8700dd585e3..18648ef2d8741db3ed8144b3e3a628e49b4f8d0b 100644 (file)
@@ -242,7 +242,7 @@ crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
 
        crisv32_pinmux_init();
 
-       if (port > PORTS)
+       if (port > PORTS || port < 0)
                return -EINVAL;
 
        spin_lock_irqsave(&pinmux_lock, flags);
index d722ad9ae6261fb952356cfd7473603d3b91415b..38f29eec14a617af2691c8ce35545f1fcc8a4422 100644 (file)
@@ -54,7 +54,7 @@ crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
 
        crisv32_pinmux_init();
 
-       if (port > PORTS)
+       if (port > PORTS || port < 0)
                return -EINVAL;
 
        spin_lock_irqsave(&pinmux_lock, flags);
@@ -195,7 +195,7 @@ int crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
 
        crisv32_pinmux_init();
 
-       if (port > PORTS)
+       if (port > PORTS || port < 0)
                return -EINVAL;
 
        spin_lock_irqsave(&pinmux_lock, flags);
index b5ce0724a88f6f307292f46601a564f022ddaf2c..6d7b9eda40367c87c4f9e76540e04eab3442f8c8 100644 (file)
@@ -63,7 +63,7 @@ int show_interrupts(struct seq_file *p, void *v)
                for_each_online_cpu(j)
                        seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
 #endif
-               seq_printf(p, " %14s", irq_desc[i].chip->typename);
+               seq_printf(p, " %14s", irq_desc[i].chip->name);
                seq_printf(p, "  %s", action->name);
 
                for (action=action->next; action; action = action->next)
index 2d7f56a98e0f484ce80d544223b4b9923526cb2a..9a50d7dd2a0b65f9b510358ef2016a968aab438a 100644 (file)
@@ -499,23 +499,6 @@ config ARCH_PROC_KCORE_TEXT
        def_bool y
        depends on PROC_KCORE
 
-config IA32_SUPPORT
-       bool "Support for Linux/x86 binaries"
-       help
-         IA-64 processors can execute IA-32 (X86) instructions.  By
-         saying Y here, the kernel will include IA-32 system call
-         emulation support which makes it possible to transparently
-         run IA-32 Linux binaries on an IA-64 Linux system.
-         If in doubt, say Y.
-
-config COMPAT
-       bool
-       depends on IA32_SUPPORT
-       default y
-
-config COMPAT_FOR_U64_ALIGNMENT
-       def_bool COMPAT
-
 config IA64_MCA_RECOVERY
        tristate "MCA recovery from errors other than TLB."
 
index 475e2725fbde6feb6c9d64c024a52a2fd211af35..8ae0d2604ce1201bfe4156b70cc5a47344e8eff7 100644 (file)
@@ -46,7 +46,6 @@ head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
 
 libs-y                         += arch/ia64/lib/
 core-y                         += arch/ia64/kernel/ arch/ia64/mm/
-core-$(CONFIG_IA32_SUPPORT)    += arch/ia64/ia32/
 core-$(CONFIG_IA64_DIG)        += arch/ia64/dig/
 core-$(CONFIG_IA64_DIG_VTD)    += arch/ia64/dig/
 core-$(CONFIG_IA64_GENERIC)    += arch/ia64/dig/
index ace41096b47b57ec5e47fb68178ac7b3e7c59724..312b12094a1de4a734f9edc5ee10cb98e3afde6c 100644 (file)
@@ -131,8 +131,6 @@ CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 # CONFIG_VIRTUAL_MEM_MAP is not set
-CONFIG_IA32_SUPPORT=y
-CONFIG_COMPAT=y
 # CONFIG_IA64_MCA_RECOVERY is not set
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
index 75645495c2ddc491605ca29e9405b71edf8081f4..6a4cc506fb5fc630c03159c949e1ff1ac9b981f1 100644 (file)
@@ -205,8 +205,6 @@ CONFIG_VIRTUAL_MEM_MAP=y
 CONFIG_HOLES_IN_ZONE=y
 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
 CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
-CONFIG_IA32_SUPPORT=y
-CONFIG_COMPAT=y
 CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
 CONFIG_IA64_MCA_RECOVERY=y
 CONFIG_PERFMON=y
index e86fbd39c79509df11bb9720355b7146c28ca903..2dc185b0f9a32f5360f5de05a50ad09f944fb125 100644 (file)
@@ -139,8 +139,6 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
 CONFIG_NUMA=y
 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
-CONFIG_IA32_SUPPORT=y
-CONFIG_COMPAT=y
 CONFIG_IA64_MCA_RECOVERY=y
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
index 546a772f438e9e9e335d7a9d886019ce7f0be126..21a23cdfd41ce2435ba767dd4e2989373357f8eb 100644 (file)
@@ -130,8 +130,6 @@ CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 # CONFIG_VIRTUAL_MEM_MAP is not set
-CONFIG_IA32_SUPPORT=y
-CONFIG_COMPAT=y
 # CONFIG_IA64_MCA_RECOVERY is not set
 # CONFIG_PERFMON is not set
 CONFIG_IA64_PALINFO=m
index c522edf23c623732c06709cd05df178ac794d17e..c5a5ea9d54ae32910536d635ae8936501cd9f643 100644 (file)
@@ -154,7 +154,6 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_VIRTUAL_MEM_MAP=y
 CONFIG_HOLES_IN_ZONE=y
-# CONFIG_IA32_SUPPORT is not set
 CONFIG_IA64_MCA_RECOVERY=y
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
index 0bb0714dc19d1303c48d7df32521d0d7891e1b5d..c67eafc4bb3848da706f5b82e806376793b08800 100644 (file)
@@ -200,8 +200,6 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_VIRTUAL_MEM_MAP=y
 CONFIG_HOLES_IN_ZONE=y
-# CONFIG_IA32_SUPPORT is not set
-# CONFIG_COMPAT_FOR_U64_ALIGNMENT is not set
 CONFIG_IA64_MCA_RECOVERY=y
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
index 514f0635dafe485f6097996fa252c84d4c7b3445..3cec65b534c2227bfeb1ad187a0d769e34e18d08 100644 (file)
@@ -150,8 +150,6 @@ CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_VIRTUAL_MEM_MAP=y
 CONFIG_HOLES_IN_ZONE=y
-CONFIG_IA32_SUPPORT=y
-CONFIG_COMPAT=y
 CONFIG_IA64_MCA_RECOVERY=y
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
index 4abd2c79bb1d738a743deaba611deea743bc6552..22078486d35da9bcb96fe66a35524f4fe31193c1 100644 (file)
@@ -77,7 +77,7 @@ static void aml_nfw_execute(struct ia64_nfw_context *c)
                     c->arg[4], c->arg[5], c->arg[6], c->arg[7]);
 }
 
-static void aml_nfw_read_arg(u8 *offset, u32 bit_width, acpi_integer *value)
+static void aml_nfw_read_arg(u8 *offset, u32 bit_width, u64 *value)
 {
        switch (bit_width) {
        case 8:
@@ -95,7 +95,7 @@ static void aml_nfw_read_arg(u8 *offset, u32 bit_width, acpi_integer *value)
        }
 }
 
-static void aml_nfw_write_arg(u8 *offset, u32 bit_width, acpi_integer *value)
+static void aml_nfw_write_arg(u8 *offset, u32 bit_width, u64 *value)
 {
        switch (bit_width) {
        case 8:
@@ -114,7 +114,7 @@ static void aml_nfw_write_arg(u8 *offset, u32 bit_width, acpi_integer *value)
 }
 
 static acpi_status aml_nfw_handler(u32 function, acpi_physical_address address,
-       u32 bit_width, acpi_integer *value, void *handler_context,
+       u32 bit_width, u64 *value, void *handler_context,
        void *region_context)
 {
        struct ia64_nfw_context *context = handler_context;
diff --git a/arch/ia64/ia32/Makefile b/arch/ia64/ia32/Makefile
deleted file mode 100644 (file)
index baad8c7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# Makefile for the ia32 kernel emulation subsystem.
-#
-
-obj-y := ia32_entry.o sys_ia32.o ia32_signal.o \
-        ia32_support.o ia32_traps.o binfmt_elf32.o ia32_ldt.o
-obj-$(CONFIG_AUDIT) += audit.o
-
-# Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and
-# restore_ia32_fpstate_live() can be sure the live register contain user-level state.
-CFLAGS_ia32_signal.o += -mfixed-range=f16-f31
diff --git a/arch/ia64/ia32/audit.c b/arch/ia64/ia32/audit.c
deleted file mode 100644 (file)
index 5c93ddd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "../../x86/include/asm/unistd_32.h"
-
-unsigned ia32_dir_class[] = {
-#include <asm-generic/audit_dir_write.h>
-~0U
-};
-
-unsigned ia32_chattr_class[] = {
-#include <asm-generic/audit_change_attr.h>
-~0U
-};
-
-unsigned ia32_write_class[] = {
-#include <asm-generic/audit_write.h>
-~0U
-};
-
-unsigned ia32_read_class[] = {
-#include <asm-generic/audit_read.h>
-~0U
-};
-
-unsigned ia32_signal_class[] = {
-#include <asm-generic/audit_signal.h>
-~0U
-};
-
-int ia32_classify_syscall(unsigned syscall)
-{
-       switch(syscall) {
-       case __NR_open:
-               return 2;
-       case __NR_openat:
-               return 3;
-       case __NR_socketcall:
-               return 4;
-       case __NR_execve:
-               return 5;
-       default:
-               return 1;
-       }
-}
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
deleted file mode 100644 (file)
index c69552b..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * IA-32 ELF support.
- *
- * Copyright (C) 1999 Arun Sharma <arun.sharma@intel.com>
- * Copyright (C) 2001 Hewlett-Packard Co
- *     David Mosberger-Tang <davidm@hpl.hp.com>
- *
- * 06/16/00    A. Mallick      initialize csd/ssd/tssd/cflg for ia32_load_state
- * 04/13/01    D. Mosberger    dropped saving tssd in ar.k1---it's not needed
- * 09/14/01    D. Mosberger    fixed memory management for gdt/tss page
- */
-
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/security.h>
-
-#include <asm/param.h>
-#include <asm/signal.h>
-
-#include "ia32priv.h"
-#include "elfcore32.h"
-
-/* Override some function names */
-#undef start_thread
-#define start_thread                   ia32_start_thread
-#define elf_format                     elf32_format
-#define init_elf_binfmt                        init_elf32_binfmt
-#define exit_elf_binfmt                        exit_elf32_binfmt
-
-#undef CLOCKS_PER_SEC
-#define CLOCKS_PER_SEC IA32_CLOCKS_PER_SEC
-
-extern void ia64_elf32_init (struct pt_regs *regs);
-
-static void elf32_set_personality (void);
-
-static unsigned long __attribute ((unused))
-randomize_stack_top(unsigned long stack_top);
-
-#define setup_arg_pages(bprm,tos,exec)         ia32_setup_arg_pages(bprm,exec)
-#define elf_map                                elf32_map
-
-#undef SET_PERSONALITY
-#define SET_PERSONALITY(ex)    elf32_set_personality()
-
-#define elf_read_implies_exec(ex, have_pt_gnu_stack)   (!(have_pt_gnu_stack))
-
-/* Ugly but avoids duplication */
-#include "../../../fs/binfmt_elf.c"
-
-extern struct page *ia32_shared_page[];
-extern unsigned long *ia32_gdt;
-extern struct page *ia32_gate_page;
-
-int
-ia32_install_shared_page (struct vm_area_struct *vma, struct vm_fault *vmf)
-{
-       vmf->page = ia32_shared_page[smp_processor_id()];
-       get_page(vmf->page);
-       return 0;
-}
-
-int
-ia32_install_gate_page (struct vm_area_struct *vma, struct vm_fault *vmf)
-{
-       vmf->page = ia32_gate_page;
-       get_page(vmf->page);
-       return 0;
-}
-
-
-static const struct vm_operations_struct ia32_shared_page_vm_ops = {
-       .fault = ia32_install_shared_page
-};
-
-static const struct vm_operations_struct ia32_gate_page_vm_ops = {
-       .fault = ia32_install_gate_page
-};
-
-void
-ia64_elf32_init (struct pt_regs *regs)
-{
-       struct vm_area_struct *vma;
-
-       /*
-        * Map GDT below 4GB, where the processor can find it.  We need to map
-        * it with privilege level 3 because the IVE uses non-privileged accesses to these
-        * tables.  IA-32 segmentation is used to protect against IA-32 accesses to them.
-        */
-       vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
-       if (vma) {
-               vma->vm_mm = current->mm;
-               vma->vm_start = IA32_GDT_OFFSET;
-               vma->vm_end = vma->vm_start + PAGE_SIZE;
-               vma->vm_page_prot = PAGE_SHARED;
-               vma->vm_flags = VM_READ|VM_MAYREAD|VM_RESERVED;
-               vma->vm_ops = &ia32_shared_page_vm_ops;
-               down_write(&current->mm->mmap_sem);
-               {
-                       if (insert_vm_struct(current->mm, vma)) {
-                               kmem_cache_free(vm_area_cachep, vma);
-                               up_write(&current->mm->mmap_sem);
-                               BUG();
-                       }
-               }
-               up_write(&current->mm->mmap_sem);
-       }
-
-       /*
-        * When user stack is not executable, push sigreturn code to stack makes
-        * segmentation fault raised when returning to kernel. So now sigreturn
-        * code is locked in specific gate page, which is pointed by pretcode
-        * when setup_frame_ia32
-        */
-       vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
-       if (vma) {
-               vma->vm_mm = current->mm;
-               vma->vm_start = IA32_GATE_OFFSET;
-               vma->vm_end = vma->vm_start + PAGE_SIZE;
-               vma->vm_page_prot = PAGE_COPY_EXEC;
-               vma->vm_flags = VM_READ | VM_MAYREAD | VM_EXEC
-                               | VM_MAYEXEC | VM_RESERVED;
-               vma->vm_ops = &ia32_gate_page_vm_ops;
-               down_write(&current->mm->mmap_sem);
-               {
-                       if (insert_vm_struct(current->mm, vma)) {
-                               kmem_cache_free(vm_area_cachep, vma);
-                               up_write(&current->mm->mmap_sem);
-                               BUG();
-                       }
-               }
-               up_write(&current->mm->mmap_sem);
-       }
-
-       /*
-        * Install LDT as anonymous memory.  This gives us all-zero segment descriptors
-        * until a task modifies them via modify_ldt().
-        */
-       vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
-       if (vma) {
-               vma->vm_mm = current->mm;
-               vma->vm_start = IA32_LDT_OFFSET;
-               vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE);
-               vma->vm_page_prot = PAGE_SHARED;
-               vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE;
-               down_write(&current->mm->mmap_sem);
-               {
-                       if (insert_vm_struct(current->mm, vma)) {
-                               kmem_cache_free(vm_area_cachep, vma);
-                               up_write(&current->mm->mmap_sem);
-                               BUG();
-                       }
-               }
-               up_write(&current->mm->mmap_sem);
-       }
-
-       ia64_psr(regs)->ac = 0;         /* turn off alignment checking */
-       regs->loadrs = 0;
-       /*
-        *  According to the ABI %edx points to an `atexit' handler.  Since we don't have
-        *  one we'll set it to 0 and initialize all the other registers just to make
-        *  things more deterministic, ala the i386 implementation.
-        */
-       regs->r8 = 0;   /* %eax */
-       regs->r11 = 0;  /* %ebx */
-       regs->r9 = 0;   /* %ecx */
-       regs->r10 = 0;  /* %edx */
-       regs->r13 = 0;  /* %ebp */
-       regs->r14 = 0;  /* %esi */
-       regs->r15 = 0;  /* %edi */
-
-       current->thread.eflag = IA32_EFLAG;
-       current->thread.fsr = IA32_FSR_DEFAULT;
-       current->thread.fcr = IA32_FCR_DEFAULT;
-       current->thread.fir = 0;
-       current->thread.fdr = 0;
-
-       /*
-        * Setup GDTD.  Note: GDTD is the descrambled version of the pseudo-descriptor
-        * format defined by Figure 3-11 "Pseudo-Descriptor Format" in the IA-32
-        * architecture manual. Also note that the only fields that are not ignored are
-        * `base', `limit', 'G', `P' (must be 1) and `S' (must be 0).
-        */
-       regs->r31 = IA32_SEG_UNSCRAMBLE(IA32_SEG_DESCRIPTOR(IA32_GDT_OFFSET, IA32_PAGE_SIZE - 1,
-                                                           0, 0, 0, 1, 0, 0, 0));
-       /* Setup the segment selectors */
-       regs->r16 = (__USER_DS << 16) | __USER_DS; /* ES == DS, GS, FS are zero */
-       regs->r17 = (__USER_DS << 16) | __USER_CS; /* SS, CS; ia32_load_state() sets TSS and LDT */
-
-       ia32_load_segment_descriptors(current);
-       ia32_load_state(current);
-}
-
-/*
- * Undo the override of setup_arg_pages() without this ia32_setup_arg_pages()
- * will suffer infinite self recursion.
- */
-#undef setup_arg_pages
-
-int
-ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
-{
-       int ret;
-
-       ret = setup_arg_pages(bprm, IA32_STACK_TOP, executable_stack);
-       if (!ret) {
-               /*
-                * Can't do it in ia64_elf32_init(). Needs to be done before
-                * calls to elf32_map()
-                */
-               current->thread.ppl = ia32_init_pp_list();
-       }
-
-       return ret;
-}
-
-static void
-elf32_set_personality (void)
-{
-       set_personality(PER_LINUX32);
-       current->thread.map_base  = IA32_PAGE_OFFSET/3;
-}
-
-static unsigned long
-elf32_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt,
-               int prot, int type, unsigned long unused)
-{
-       unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK;
-
-       return ia32_do_mmap(filep, (addr & IA32_PAGE_MASK), eppnt->p_filesz + pgoff, prot, type,
-                           eppnt->p_offset - pgoff);
-}
-
-#define cpu_uses_ia32el()      (local_cpu_data->family > 0x1f)
-
-static int __init check_elf32_binfmt(void)
-{
-       if (cpu_uses_ia32el()) {
-               printk("Please use IA-32 EL for executing IA-32 binaries\n");
-               unregister_binfmt(&elf_format);
-       }
-       return 0;
-}
-
-module_init(check_elf32_binfmt)
diff --git a/arch/ia64/ia32/elfcore32.h b/arch/ia64/ia32/elfcore32.h
deleted file mode 100644 (file)
index 6577257..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * IA-32 ELF core dump support.
- *
- * Copyright (C) 2003 Arun Sharma <arun.sharma@intel.com>
- *
- * Derived from the x86_64 version
- */
-#ifndef _ELFCORE32_H_
-#define _ELFCORE32_H_
-
-#include <asm/intrinsics.h>
-#include <asm/uaccess.h>
-
-/* Override elfcore.h */
-#define _LINUX_ELFCORE_H 1
-typedef unsigned int elf_greg_t;
-
-#define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct ia32_user_i387_struct elf_fpregset_t;
-typedef struct ia32_user_fxsr_struct elf_fpxregset_t;
-
-struct elf_siginfo
-{
-       int     si_signo;                       /* signal number */
-       int     si_code;                        /* extra code */
-       int     si_errno;                       /* errno */
-};
-
-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-/*
- * Hacks are here since types between compat_timeval (= pair of s32) and
- * ia64-native timeval (= pair of s64) are not compatible, at least a file
- * arch/ia64/ia32/../../../fs/binfmt_elf.c will get warnings from compiler on
- * use of cputime_to_timeval(), which usually an alias of jiffies_to_timeval().
- */
-#define cputime_to_timeval(a,b) \
-       do { (b)->tv_usec = 0; (b)->tv_sec = (a)/NSEC_PER_SEC; } while(0)
-#else
-#define jiffies_to_timeval(a,b) \
-       do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; } while(0)
-#endif
-
-struct elf_prstatus
-{
-       struct elf_siginfo pr_info;     /* Info associated with signal */
-       short   pr_cursig;              /* Current signal */
-       unsigned int pr_sigpend;        /* Set of pending signals */
-       unsigned int pr_sighold;        /* Set of held signals */
-       pid_t   pr_pid;
-       pid_t   pr_ppid;
-       pid_t   pr_pgrp;
-       pid_t   pr_sid;
-       struct compat_timeval pr_utime; /* User time */
-       struct compat_timeval pr_stime; /* System time */
-       struct compat_timeval pr_cutime;        /* Cumulative user time */
-       struct compat_timeval pr_cstime;        /* Cumulative system time */
-       elf_gregset_t pr_reg;   /* GP registers */
-       int pr_fpvalid;         /* True if math co-processor being used.  */
-};
-
-#define ELF_PRARGSZ    (80)    /* Number of chars for args */
-
-struct elf_prpsinfo
-{
-       char    pr_state;       /* numeric process state */
-       char    pr_sname;       /* char for pr_state */
-       char    pr_zomb;        /* zombie */
-       char    pr_nice;        /* nice val */
-       unsigned int pr_flag;   /* flags */
-       __u16   pr_uid;
-       __u16   pr_gid;
-       pid_t   pr_pid, pr_ppid, pr_pgrp, pr_sid;
-       /* Lots missing */
-       char    pr_fname[16];   /* filename of executable */
-       char    pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
-};
-
-#define ELF_CORE_COPY_REGS(pr_reg, regs)                       \
-       pr_reg[0] = regs->r11;                          \
-       pr_reg[1] = regs->r9;                           \
-       pr_reg[2] = regs->r10;                          \
-       pr_reg[3] = regs->r14;                          \
-       pr_reg[4] = regs->r15;                          \
-       pr_reg[5] = regs->r13;                          \
-       pr_reg[6] = regs->r8;                           \
-       pr_reg[7] = regs->r16 & 0xffff;                 \
-       pr_reg[8] = (regs->r16 >> 16) & 0xffff;         \
-       pr_reg[9] = (regs->r16 >> 32) & 0xffff;         \
-       pr_reg[10] = (regs->r16 >> 48) & 0xffff;        \
-       pr_reg[11] = regs->r1;                          \
-       pr_reg[12] = regs->cr_iip;                      \
-       pr_reg[13] = regs->r17 & 0xffff;                \
-       pr_reg[14] = ia64_getreg(_IA64_REG_AR_EFLAG);   \
-       pr_reg[15] = regs->r12;                         \
-       pr_reg[16] = (regs->r17 >> 16) & 0xffff;
-
-static inline void elf_core_copy_regs(elf_gregset_t *elfregs,
-                                     struct pt_regs *regs)
-{
-       ELF_CORE_COPY_REGS((*elfregs), regs)
-}
-
-static inline int elf_core_copy_task_regs(struct task_struct *t,
-                                         elf_gregset_t* elfregs)
-{
-       ELF_CORE_COPY_REGS((*elfregs), task_pt_regs(t));
-       return 1;
-}
-
-static inline int
-elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu)
-{
-       struct ia32_user_i387_struct *fpstate = (void*)fpu;
-       mm_segment_t old_fs;
-
-       if (!tsk_used_math(tsk))
-               return 0;
-       
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       save_ia32_fpstate(tsk, (struct ia32_user_i387_struct __user *) fpstate);
-       set_fs(old_fs);
-
-       return 1;
-}
-
-#define ELF_CORE_COPY_XFPREGS 1
-#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
-static inline int
-elf_core_copy_task_xfpregs(struct task_struct *tsk, elf_fpxregset_t *xfpu)
-{
-       struct ia32_user_fxsr_struct *fpxstate = (void*) xfpu;
-       mm_segment_t old_fs;
-
-       if (!tsk_used_math(tsk))
-               return 0;
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       save_ia32_fpxstate(tsk, (struct ia32_user_fxsr_struct __user *) fpxstate);
-       set_fs(old_fs);
-
-       return 1;
-}
-
-#endif /* _ELFCORE32_H_ */
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
deleted file mode 100644 (file)
index 2fd7479..0000000
+++ /dev/null
@@ -1,468 +0,0 @@
-#include <asm/asmmacro.h>
-#include <asm/ia32.h>
-#include <asm/asm-offsets.h>
-#include <asm/signal.h>
-#include <asm/thread_info.h>
-
-#include "../kernel/minstate.h"
-
-       /*
-        * execve() is special because in case of success, we need to
-        * setup a null register window frame (in case an IA-32 process
-        * is exec'ing an IA-64 program).
-        */
-ENTRY(ia32_execve)
-       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(3)
-       alloc loc1=ar.pfs,3,2,4,0
-       mov loc0=rp
-       .body
-       zxt4 out0=in0                   // filename
-       ;;                              // stop bit between alloc and call
-       zxt4 out1=in1                   // argv
-       zxt4 out2=in2                   // envp
-       add out3=16,sp                  // regs
-       br.call.sptk.few rp=sys32_execve
-1:     cmp.ge p6,p0=r8,r0
-       mov ar.pfs=loc1                 // restore ar.pfs
-       ;;
-(p6)   mov ar.pfs=r0                   // clear ar.pfs in case of success
-       sxt4 r8=r8                      // return 64-bit result
-       mov rp=loc0
-       br.ret.sptk.few rp
-END(ia32_execve)
-
-ENTRY(ia32_clone)
-       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
-       alloc r16=ar.pfs,5,2,6,0
-       DO_SAVE_SWITCH_STACK
-       mov loc0=rp
-       mov loc1=r16                            // save ar.pfs across do_fork
-       .body
-       zxt4 out1=in1                           // newsp
-       mov out3=16                             // stacksize (compensates for 16-byte scratch area)
-       adds out2=IA64_SWITCH_STACK_SIZE+16,sp  // out2 = &regs
-       mov out0=in0                            // out0 = clone_flags
-       zxt4 out4=in2                           // out4 = parent_tidptr
-       zxt4 out5=in4                           // out5 = child_tidptr
-       br.call.sptk.many rp=do_fork
-.ret0: .restore sp
-       adds sp=IA64_SWITCH_STACK_SIZE,sp       // pop the switch stack
-       mov ar.pfs=loc1
-       mov rp=loc0
-       br.ret.sptk.many rp
-END(ia32_clone)
-
-GLOBAL_ENTRY(ia32_ret_from_clone)
-       PT_REGS_UNWIND_INFO(0)
-{      /*
-        * Some versions of gas generate bad unwind info if the first instruction of a
-        * procedure doesn't go into the first slot of a bundle.  This is a workaround.
-        */
-       nop.m 0
-       nop.i 0
-       /*
-        * We need to call schedule_tail() to complete the scheduling process.
-        * Called by ia64_switch_to after do_fork()->copy_thread().  r8 contains the
-        * address of the previously executing task.
-        */
-       br.call.sptk.many rp=ia64_invoke_schedule_tail
-}
-.ret1:
-       adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
-       ;;
-       ld4 r2=[r2]
-       ;;
-       mov r8=0
-       and r2=_TIF_SYSCALL_TRACEAUDIT,r2
-       ;;
-       cmp.ne p6,p0=r2,r0
-(p6)   br.cond.spnt .ia32_strace_check_retval
-       ;;                                      // prevent RAW on r8
-END(ia32_ret_from_clone)
-       // fall through
-GLOBAL_ENTRY(ia32_ret_from_syscall)
-       PT_REGS_UNWIND_INFO(0)
-
-       cmp.ge p6,p7=r8,r0                      // syscall executed successfully?
-       adds r2=IA64_PT_REGS_R8_OFFSET+16,sp    // r2 = &pt_regs.r8
-       ;;
-       alloc r3=ar.pfs,0,0,0,0                 // drop the syscall argument frame
-       st8 [r2]=r8                             // store return value in slot for r8
-       br.cond.sptk.many ia64_leave_kernel
-END(ia32_ret_from_syscall)
-
-       //
-       // Invoke a system call, but do some tracing before and after the call.
-       // We MUST preserve the current register frame throughout this routine
-       // because some system calls (such as ia64_execve) directly
-       // manipulate ar.pfs.
-       //
-       // Input:
-       //      r8 = syscall number
-       //      b6 = syscall entry point
-       //
-GLOBAL_ENTRY(ia32_trace_syscall)
-       PT_REGS_UNWIND_INFO(0)
-       mov r3=-38
-       adds r2=IA64_PT_REGS_R8_OFFSET+16,sp
-       ;;
-       st8 [r2]=r3                             // initialize return code to -ENOSYS
-       br.call.sptk.few rp=syscall_trace_enter // give parent a chance to catch syscall args
-       cmp.lt p6,p0=r8,r0                      // check tracehook
-       adds r2=IA64_PT_REGS_R8_OFFSET+16,sp    // r2 = &pt_regs.r8
-       ;;
-(p6)   st8.spill [r2]=r8                       // store return value in slot for r8
-(p6)   br.spnt.few .ret4
-.ret2: // Need to reload arguments (they may be changed by the tracing process)
-       adds r2=IA64_PT_REGS_R1_OFFSET+16,sp    // r2 = &pt_regs.r1
-       adds r3=IA64_PT_REGS_R13_OFFSET+16,sp   // r3 = &pt_regs.r13
-       mov r15=IA32_NR_syscalls
-       ;;
-       ld4 r8=[r2],IA64_PT_REGS_R9_OFFSET-IA64_PT_REGS_R1_OFFSET
-       movl r16=ia32_syscall_table
-       ;;
-       ld4 r33=[r2],8                          // r9 == ecx
-       ld4 r37=[r3],16                         // r13 == ebp
-       cmp.ltu.unc p6,p7=r8,r15
-       ;;
-       ld4 r34=[r2],8                          // r10 == edx
-       ld4 r36=[r3],8                          // r15 == edi
-(p6)   shladd r16=r8,3,r16     // force ni_syscall if not valid syscall number
-       ;;
-       ld8 r16=[r16]
-       ;;
-       ld4 r32=[r2],8                          // r11 == ebx
-       mov b6=r16
-       ld4 r35=[r3],8                          // r14 == esi
-       br.call.sptk.few rp=b6                  // do the syscall
-.ia32_strace_check_retval:
-       cmp.lt p6,p0=r8,r0                      // syscall failed?
-       adds r2=IA64_PT_REGS_R8_OFFSET+16,sp    // r2 = &pt_regs.r8
-       ;;
-       st8.spill [r2]=r8                       // store return value in slot for r8
-       br.call.sptk.few rp=syscall_trace_leave // give parent a chance to catch return value
-.ret4: alloc r2=ar.pfs,0,0,0,0                 // drop the syscall argument frame
-       br.cond.sptk.many ia64_leave_kernel
-END(ia32_trace_syscall)
-
-GLOBAL_ENTRY(sys32_vfork)
-       alloc r16=ar.pfs,2,2,4,0;;
-       mov out0=IA64_CLONE_VFORK|IA64_CLONE_VM|SIGCHLD // out0 = clone_flags
-       br.cond.sptk.few .fork1                 // do the work
-END(sys32_vfork)
-
-GLOBAL_ENTRY(sys32_fork)
-       .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-       alloc r16=ar.pfs,2,2,4,0
-       mov out0=SIGCHLD                        // out0 = clone_flags
-       ;;
-.fork1:
-       mov loc0=rp
-       mov loc1=r16                            // save ar.pfs across do_fork
-       DO_SAVE_SWITCH_STACK
-
-       .body
-
-       mov out1=0
-       mov out3=0
-       adds out2=IA64_SWITCH_STACK_SIZE+16,sp  // out2 = &regs
-       br.call.sptk.few rp=do_fork
-.ret5: .restore sp
-       adds sp=IA64_SWITCH_STACK_SIZE,sp       // pop the switch stack
-       mov ar.pfs=loc1
-       mov rp=loc0
-       br.ret.sptk.many rp
-END(sys32_fork)
-
-       .rodata
-       .align 8
-       .globl ia32_syscall_table
-ia32_syscall_table:
-       data8 sys_ni_syscall      /* 0  -  old "setup(" system call*/
-       data8 sys_exit
-       data8 sys32_fork
-       data8 sys_read
-       data8 sys_write
-       data8 compat_sys_open     /* 5 */
-       data8 sys_close
-       data8 sys32_waitpid
-       data8 sys_creat
-       data8 sys_link
-       data8 sys_unlink          /* 10 */
-       data8 ia32_execve
-       data8 sys_chdir
-       data8 compat_sys_time
-       data8 sys_mknod
-       data8 sys_chmod           /* 15 */
-       data8 sys_lchown        /* 16-bit version */
-       data8 sys_ni_syscall      /* old break syscall holder */
-       data8 sys_ni_syscall
-       data8 sys32_lseek
-       data8 sys_getpid          /* 20 */
-       data8 compat_sys_mount
-       data8 sys_oldumount
-       data8 sys_setuid        /* 16-bit version */
-       data8 sys_getuid        /* 16-bit version */
-       data8 compat_sys_stime    /* 25 */
-       data8 compat_sys_ptrace
-       data8 sys32_alarm
-       data8 sys_ni_syscall
-       data8 sys_pause
-       data8 compat_sys_utime    /* 30 */
-       data8 sys_ni_syscall      /* old stty syscall holder */
-       data8 sys_ni_syscall      /* old gtty syscall holder */
-       data8 sys_access
-       data8 sys_nice
-       data8 sys_ni_syscall      /* 35 */        /* old ftime syscall holder */
-       data8 sys_sync
-       data8 sys_kill
-       data8 sys_rename
-       data8 sys_mkdir
-       data8 sys_rmdir           /* 40 */
-       data8 sys_dup
-       data8 sys_ia64_pipe
-       data8 compat_sys_times
-       data8 sys_ni_syscall      /* old prof syscall holder */
-       data8 sys32_brk           /* 45 */
-       data8 sys_setgid        /* 16-bit version */
-       data8 sys_getgid        /* 16-bit version */
-       data8 sys32_signal
-       data8 sys_geteuid       /* 16-bit version */
-       data8 sys_getegid       /* 16-bit version */      /* 50 */
-       data8 sys_acct
-       data8 sys_umount          /* recycled never used phys( */
-       data8 sys_ni_syscall      /* old lock syscall holder */
-       data8 compat_sys_ioctl
-       data8 compat_sys_fcntl    /* 55 */
-       data8 sys_ni_syscall      /* old mpx syscall holder */
-       data8 sys_setpgid
-       data8 sys_ni_syscall      /* old ulimit syscall holder */
-       data8 sys_ni_syscall
-       data8 sys_umask           /* 60 */
-       data8 sys_chroot
-       data8 compat_sys_ustat
-       data8 sys_dup2
-       data8 sys_getppid
-       data8 sys_getpgrp         /* 65 */
-       data8 sys_setsid
-       data8 sys32_sigaction
-       data8 sys_ni_syscall
-       data8 sys_ni_syscall
-       data8 sys_setreuid      /* 16-bit version */      /* 70 */
-       data8 sys_setregid      /* 16-bit version */
-       data8 sys32_sigsuspend
-       data8 compat_sys_sigpending
-       data8 sys_sethostname
-       data8 compat_sys_setrlimit        /* 75 */
-       data8 compat_sys_old_getrlimit
-       data8 compat_sys_getrusage
-       data8 compat_sys_gettimeofday
-       data8 compat_sys_settimeofday
-       data8 sys32_getgroups16   /* 80 */
-       data8 sys32_setgroups16
-       data8 sys32_old_select
-       data8 sys_symlink
-       data8 sys_ni_syscall
-       data8 sys_readlink        /* 85 */
-       data8 sys_uselib
-       data8 sys_swapon
-       data8 sys_reboot
-       data8 compat_sys_old_readdir
-       data8 sys32_mmap          /* 90 */
-       data8 sys32_munmap
-       data8 sys_truncate
-       data8 sys_ftruncate
-       data8 sys_fchmod
-       data8 sys_fchown        /* 16-bit version */      /* 95 */
-       data8 sys_getpriority
-       data8 sys_setpriority
-       data8 sys_ni_syscall      /* old profil syscall holder */
-       data8 compat_sys_statfs
-       data8 compat_sys_fstatfs          /* 100 */
-       data8 sys_ni_syscall    /* ioperm */
-       data8 compat_sys_socketcall
-       data8 sys_syslog
-       data8 compat_sys_setitimer
-       data8 compat_sys_getitimer        /* 105 */
-       data8 compat_sys_newstat
-       data8 compat_sys_newlstat
-       data8 compat_sys_newfstat
-       data8 sys_ni_syscall
-       data8 sys_ni_syscall    /* iopl */      /* 110 */
-       data8 sys_vhangup
-       data8 sys_ni_syscall            /* used to be sys_idle */
-       data8 sys_ni_syscall
-       data8 compat_sys_wait4
-       data8 sys_swapoff         /* 115 */
-       data8 compat_sys_sysinfo
-       data8 sys32_ipc
-       data8 sys_fsync
-       data8 sys32_sigreturn
-       data8 ia32_clone          /* 120 */
-       data8 sys_setdomainname
-       data8 sys32_newuname
-       data8 sys32_modify_ldt
-       data8 compat_sys_adjtimex
-       data8 sys32_mprotect      /* 125 */
-       data8 compat_sys_sigprocmask
-       data8 sys_ni_syscall    /* create_module */
-       data8 sys_ni_syscall    /* init_module */
-       data8 sys_ni_syscall    /* delete_module */
-       data8 sys_ni_syscall    /* get_kernel_syms */  /* 130 */
-       data8 sys32_quotactl
-       data8 sys_getpgid
-       data8 sys_fchdir
-       data8 sys_ni_syscall    /* sys_bdflush */
-       data8 sys_sysfs         /* 135 */
-       data8 sys32_personality
-       data8 sys_ni_syscall      /* for afs_syscall */
-       data8 sys_setfsuid      /* 16-bit version */
-       data8 sys_setfsgid      /* 16-bit version */
-       data8 sys_llseek          /* 140 */
-       data8 compat_sys_getdents
-       data8 compat_sys_select
-       data8 sys_flock
-       data8 sys32_msync
-       data8 compat_sys_readv    /* 145 */
-       data8 compat_sys_writev
-       data8 sys_getsid
-       data8 sys_fdatasync
-       data8 compat_sys_sysctl
-       data8 sys_mlock           /* 150 */
-       data8 sys_munlock
-       data8 sys_mlockall
-       data8 sys_munlockall
-       data8 sys_sched_setparam
-       data8 sys_sched_getparam  /* 155 */
-       data8 sys_sched_setscheduler
-       data8 sys_sched_getscheduler
-       data8 sys_sched_yield
-       data8 sys_sched_get_priority_max
-       data8 sys_sched_get_priority_min         /* 160 */
-       data8 sys32_sched_rr_get_interval
-       data8 compat_sys_nanosleep
-       data8 sys32_mremap
-       data8 sys_setresuid     /* 16-bit version */
-       data8 sys32_getresuid16 /* 16-bit version */      /* 165 */
-       data8 sys_ni_syscall    /* vm86 */
-       data8 sys_ni_syscall    /* sys_query_module */
-       data8 sys_poll
-       data8 sys_ni_syscall    /* nfsservctl */
-       data8 sys_setresgid       /* 170 */
-       data8 sys32_getresgid16
-       data8 sys_prctl
-       data8 sys32_rt_sigreturn
-       data8 sys32_rt_sigaction
-       data8 sys32_rt_sigprocmask /* 175 */
-       data8 sys_rt_sigpending
-       data8 compat_sys_rt_sigtimedwait
-       data8 sys32_rt_sigqueueinfo
-       data8 compat_sys_rt_sigsuspend
-       data8 sys32_pread         /* 180 */
-       data8 sys32_pwrite
-       data8 sys_chown /* 16-bit version */
-       data8 sys_getcwd
-       data8 sys_capget
-       data8 sys_capset          /* 185 */
-       data8 sys32_sigaltstack
-       data8 sys32_sendfile
-       data8 sys_ni_syscall              /* streams1 */
-       data8 sys_ni_syscall              /* streams2 */
-       data8 sys32_vfork         /* 190 */
-       data8 compat_sys_getrlimit
-       data8 sys32_mmap2
-       data8 sys32_truncate64
-       data8 sys32_ftruncate64
-       data8 sys32_stat64        /* 195 */
-       data8 sys32_lstat64
-       data8 sys32_fstat64
-       data8 sys_lchown
-       data8 sys_getuid
-       data8 sys_getgid          /* 200 */
-       data8 sys_geteuid
-       data8 sys_getegid
-       data8 sys_setreuid
-       data8 sys_setregid
-       data8 sys_getgroups       /* 205 */
-       data8 sys_setgroups
-       data8 sys_fchown
-       data8 sys_setresuid
-       data8 sys_getresuid
-       data8 sys_setresgid       /* 210 */
-       data8 sys_getresgid
-       data8 sys_chown
-       data8 sys_setuid
-       data8 sys_setgid
-       data8 sys_setfsuid        /* 215 */
-       data8 sys_setfsgid
-       data8 sys_pivot_root
-       data8 sys_mincore
-       data8 sys_madvise
-       data8 compat_sys_getdents64       /* 220 */
-       data8 compat_sys_fcntl64
-       data8 sys_ni_syscall            /* reserved for TUX */
-       data8 sys_ni_syscall            /* reserved for Security */
-       data8 sys_gettid
-       data8 sys_readahead       /* 225 */
-       data8 sys_setxattr
-       data8 sys_lsetxattr
-       data8 sys_fsetxattr
-       data8 sys_getxattr
-       data8 sys_lgetxattr     /* 230 */
-       data8 sys_fgetxattr
-       data8 sys_listxattr
-       data8 sys_llistxattr
-       data8 sys_flistxattr
-       data8 sys_removexattr   /* 235 */
-       data8 sys_lremovexattr
-       data8 sys_fremovexattr
-       data8 sys_tkill
-       data8 sys_sendfile64
-       data8 compat_sys_futex  /* 240 */
-       data8 compat_sys_sched_setaffinity
-       data8 compat_sys_sched_getaffinity
-       data8 sys32_set_thread_area
-       data8 sys32_get_thread_area
-       data8 compat_sys_io_setup       /* 245 */
-       data8 sys_io_destroy
-       data8 compat_sys_io_getevents
-       data8 compat_sys_io_submit
-       data8 sys_io_cancel
-       data8 sys_fadvise64     /* 250 */
-       data8 sys_ni_syscall
-       data8 sys_exit_group
-       data8 sys_lookup_dcookie
-       data8 sys_epoll_create
-       data8 sys32_epoll_ctl   /* 255 */
-       data8 sys32_epoll_wait
-       data8 sys_remap_file_pages
-       data8 sys_set_tid_address
-       data8 compat_sys_timer_create
-       data8 compat_sys_timer_settime  /* 260 */
-       data8 compat_sys_timer_gettime
-       data8 sys_timer_getoverrun
-       data8 sys_timer_delete
-       data8 compat_sys_clock_settime
-       data8 compat_sys_clock_gettime /* 265 */
-       data8 compat_sys_clock_getres
-       data8 compat_sys_clock_nanosleep
-       data8 compat_sys_statfs64
-       data8 compat_sys_fstatfs64
-       data8 sys_tgkill        /* 270 */
-       data8 compat_sys_utimes
-       data8 sys32_fadvise64_64
-       data8 sys_ni_syscall
-       data8 sys_ni_syscall
-       data8 sys_ni_syscall    /* 275 */
-       data8 sys_ni_syscall
-       data8 compat_sys_mq_open
-       data8 sys_mq_unlink
-       data8 compat_sys_mq_timedsend
-       data8 compat_sys_mq_timedreceive        /* 280 */
-       data8 compat_sys_mq_notify
-       data8 compat_sys_mq_getsetattr
-       data8 sys_ni_syscall            /* reserved for kexec */
-       data8 compat_sys_waitid
-
-       // guard against failures to increase IA32_NR_syscalls
-       .org ia32_syscall_table + 8*IA32_NR_syscalls
diff --git a/arch/ia64/ia32/ia32_ldt.c b/arch/ia64/ia32/ia32_ldt.c
deleted file mode 100644 (file)
index 16d51c1..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2001, 2004 Hewlett-Packard Co
- *     David Mosberger-Tang <davidm@hpl.hp.com>
- *
- * Adapted from arch/i386/kernel/ldt.c
- */
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/vmalloc.h>
-
-#include <asm/uaccess.h>
-
-#include "ia32priv.h"
-
-/*
- * read_ldt() is not really atomic - this is not a problem since synchronization of reads
- * and writes done to the LDT has to be assured by user-space anyway. Writes are atomic,
- * to protect the security checks done on new descriptors.
- */
-static int
-read_ldt (void __user *ptr, unsigned long bytecount)
-{
-       unsigned long bytes_left, n;
-       char __user *src, *dst;
-       char buf[256];  /* temporary buffer (don't overflow kernel stack!) */
-
-       if (bytecount > IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE)
-               bytecount = IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE;
-
-       bytes_left = bytecount;
-
-       src = (void __user *) IA32_LDT_OFFSET;
-       dst = ptr;
-
-       while (bytes_left) {
-               n = sizeof(buf);
-               if (n > bytes_left)
-                       n = bytes_left;
-
-               /*
-                * We know we're reading valid memory, but we still must guard against
-                * running out of memory.
-                */
-               if (__copy_from_user(buf, src, n))
-                       return -EFAULT;
-
-               if (copy_to_user(dst, buf, n))
-                       return -EFAULT;
-
-               src += n;
-               dst += n;
-               bytes_left -= n;
-       }
-       return bytecount;
-}
-
-static int
-read_default_ldt (void __user * ptr, unsigned long bytecount)
-{
-       unsigned long size;
-       int err;
-
-       /* XXX fix me: should return equivalent of default_ldt[0] */
-       err = 0;
-       size = 8;
-       if (size > bytecount)
-               size = bytecount;
-
-       err = size;
-       if (clear_user(ptr, size))
-               err = -EFAULT;
-
-       return err;
-}
-
-static int
-write_ldt (void __user * ptr, unsigned long bytecount, int oldmode)
-{
-       struct ia32_user_desc ldt_info;
-       __u64 entry;
-       int ret;
-
-       if (bytecount != sizeof(ldt_info))
-               return -EINVAL;
-       if (copy_from_user(&ldt_info, ptr, sizeof(ldt_info)))
-               return -EFAULT;
-
-       if (ldt_info.entry_number >= IA32_LDT_ENTRIES)
-               return -EINVAL;
-       if (ldt_info.contents == 3) {
-               if (oldmode)
-                       return -EINVAL;
-               if (ldt_info.seg_not_present == 0)
-                       return -EINVAL;
-       }
-
-       if (ldt_info.base_addr == 0 && ldt_info.limit == 0
-           && (oldmode || (ldt_info.contents == 0 && ldt_info.read_exec_only == 1
-                           && ldt_info.seg_32bit == 0 && ldt_info.limit_in_pages == 0
-                           && ldt_info.seg_not_present == 1 && ldt_info.useable == 0)))
-               /* allow LDTs to be cleared by the user */
-               entry = 0;
-       else
-               /* we must set the "Accessed" bit as IVE doesn't emulate it */
-               entry = IA32_SEG_DESCRIPTOR(ldt_info.base_addr, ldt_info.limit,
-                                           (((ldt_info.read_exec_only ^ 1) << 1)
-                                            | (ldt_info.contents << 2)) | 1,
-                                           1, 3, ldt_info.seg_not_present ^ 1,
-                                           (oldmode ? 0 : ldt_info.useable),
-                                           ldt_info.seg_32bit,
-                                           ldt_info.limit_in_pages);
-       /*
-        * Install the new entry.  We know we're accessing valid (mapped) user-level
-        * memory, but we still need to guard against out-of-memory, hence we must use
-        * put_user().
-        */
-       ret = __put_user(entry, (__u64 __user *) IA32_LDT_OFFSET + ldt_info.entry_number);
-       ia32_load_segment_descriptors(current);
-       return ret;
-}
-
-asmlinkage int
-sys32_modify_ldt (int func, unsigned int ptr, unsigned int bytecount)
-{
-       int ret = -ENOSYS;
-
-       switch (func) {
-             case 0:
-               ret = read_ldt(compat_ptr(ptr), bytecount);
-               break;
-             case 1:
-               ret = write_ldt(compat_ptr(ptr), bytecount, 1);
-               break;
-             case 2:
-               ret = read_default_ldt(compat_ptr(ptr), bytecount);
-               break;
-             case 0x11:
-               ret = write_ldt(compat_ptr(ptr), bytecount, 0);
-               break;
-       }
-       return ret;
-}
diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
deleted file mode 100644 (file)
index b763ca1..0000000
+++ /dev/null
@@ -1,1010 +0,0 @@
-/*
- * IA32 Architecture-specific signal handling support.
- *
- * Copyright (C) 1999, 2001-2002, 2005 Hewlett-Packard Co
- *     David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999 Arun Sharma <arun.sharma@intel.com>
- * Copyright (C) 2000 VA Linux Co
- * Copyright (C) 2000 Don Dugger <n0ano@valinux.com>
- *
- * Derived from i386 and Alpha versions.
- */
-
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/personality.h>
-#include <linux/ptrace.h>
-#include <linux/sched.h>
-#include <linux/signal.h>
-#include <linux/smp.h>
-#include <linux/stddef.h>
-#include <linux/syscalls.h>
-#include <linux/unistd.h>
-#include <linux/wait.h>
-#include <linux/compat.h>
-
-#include <asm/intrinsics.h>
-#include <asm/uaccess.h>
-#include <asm/rse.h>
-#include <asm/sigcontext.h>
-
-#include "ia32priv.h"
-
-#include "../kernel/sigframe.h"
-
-#define A(__x)         ((unsigned long)(__x))
-
-#define DEBUG_SIG      0
-#define _BLOCKABLE     (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
-
-#define __IA32_NR_sigreturn            119
-#define __IA32_NR_rt_sigreturn         173
-
-struct sigframe_ia32
-{
-       int pretcode;
-       int sig;
-       struct sigcontext_ia32 sc;
-       struct _fpstate_ia32 fpstate;
-       unsigned int extramask[_COMPAT_NSIG_WORDS-1];
-       char retcode[8];
-};
-
-struct rt_sigframe_ia32
-{
-       int pretcode;
-       int sig;
-       int pinfo;
-       int puc;
-       compat_siginfo_t info;
-       struct ucontext_ia32 uc;
-       struct _fpstate_ia32 fpstate;
-       char retcode[8];
-};
-
-int
-copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
-{
-       unsigned long tmp;
-       int err;
-
-       if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t)))
-               return -EFAULT;
-
-       err = __get_user(to->si_signo, &from->si_signo);
-       err |= __get_user(to->si_errno, &from->si_errno);
-       err |= __get_user(to->si_code, &from->si_code);
-
-       if (to->si_code < 0)
-               err |= __copy_from_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
-       else {
-               switch (to->si_code >> 16) {
-                     case __SI_CHLD >> 16:
-                       err |= __get_user(to->si_utime, &from->si_utime);
-                       err |= __get_user(to->si_stime, &from->si_stime);
-                       err |= __get_user(to->si_status, &from->si_status);
-                     default:
-                       err |= __get_user(to->si_pid, &from->si_pid);
-                       err |= __get_user(to->si_uid, &from->si_uid);
-                       break;
-                     case __SI_FAULT >> 16:
-                       err |= __get_user(tmp, &from->si_addr);
-                       to->si_addr = (void __user *) tmp;
-                       break;
-                     case __SI_POLL >> 16:
-                       err |= __get_user(to->si_band, &from->si_band);
-                       err |= __get_user(to->si_fd, &from->si_fd);
-                       break;
-                     case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-                     case __SI_MESGQ >> 16:
-                       err |= __get_user(to->si_pid, &from->si_pid);
-                       err |= __get_user(to->si_uid, &from->si_uid);
-                       err |= __get_user(to->si_int, &from->si_int);
-                       break;
-               }
-       }
-       return err;
-}
-
-int
-copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
-{
-       unsigned int addr;
-       int err;
-
-       if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
-               return -EFAULT;
-
-       /* If you change siginfo_t structure, please be sure
-          this code is fixed accordingly.
-          It should never copy any pad contained in the structure
-          to avoid security leaks, but must copy the generic
-          3 ints plus the relevant union member.
-          This routine must convert siginfo from 64bit to 32bit as well
-          at the same time.  */
-       err = __put_user(from->si_signo, &to->si_signo);
-       err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
-       if (from->si_code < 0)
-               err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
-       else {
-               switch (from->si_code >> 16) {
-               case __SI_CHLD >> 16:
-                       err |= __put_user(from->si_utime, &to->si_utime);
-                       err |= __put_user(from->si_stime, &to->si_stime);
-                       err |= __put_user(from->si_status, &to->si_status);
-               default:
-                       err |= __put_user(from->si_pid, &to->si_pid);
-                       err |= __put_user(from->si_uid, &to->si_uid);
-                       break;
-               case __SI_FAULT >> 16:
-                       /* avoid type-checking warnings by copying _pad[0] in lieu of si_addr... */
-                       err |= __put_user(from->_sifields._pad[0], &to->si_addr);
-                       break;
-               case __SI_POLL >> 16:
-                       err |= __put_user(from->si_band, &to->si_band);
-                       err |= __put_user(from->si_fd, &to->si_fd);
-                       break;
-               case __SI_TIMER >> 16:
-                       err |= __put_user(from->si_tid, &to->si_tid);
-                       err |= __put_user(from->si_overrun, &to->si_overrun);
-                       addr = (unsigned long) from->si_ptr;
-                       err |= __put_user(addr, &to->si_ptr);
-                       break;
-               case __SI_RT >> 16:     /* Not generated by the kernel as of now.  */
-               case __SI_MESGQ >> 16:
-                       err |= __put_user(from->si_uid, &to->si_uid);
-                       err |= __put_user(from->si_pid, &to->si_pid);
-                       addr = (unsigned long) from->si_ptr;
-                       err |= __put_user(addr, &to->si_ptr);
-                       break;
-               }
-       }
-       return err;
-}
-
-
-/*
- *  SAVE and RESTORE of ia32 fpstate info, from ia64 current state
- *  Used in exception handler to pass the fpstate to the user, and restore
- *  the fpstate while returning from the exception handler.
- *
- *    fpstate info and their mapping to IA64 regs:
- *    fpstate    REG(BITS)      Attribute    Comments
- *    cw         ar.fcr(0:12)                with bits 7 and 6 not used
- *    sw         ar.fsr(0:15)
- *    tag        ar.fsr(16:31)               with odd numbered bits not used
- *                                           (read returns 0, writes ignored)
- *    ipoff      ar.fir(0:31)
- *    cssel      ar.fir(32:47)
- *    dataoff    ar.fdr(0:31)
- *    datasel    ar.fdr(32:47)
- *
- *    _st[(0+TOS)%8]   f8
- *    _st[(1+TOS)%8]   f9
- *    _st[(2+TOS)%8]   f10
- *    _st[(3+TOS)%8]   f11                   (f8..f11 from ptregs)
- *      : :            :                     (f12..f15 from live reg)
- *      : :            :
- *    _st[(7+TOS)%8]   f15                   TOS=sw.top(bits11:13)
- *
- *    status     Same as sw     RO
- *    magic      0                           as X86_FXSR_MAGIC in ia32
- *    mxcsr      Bits(7:15)=ar.fcr(39:47)
- *               Bits(0:5) =ar.fsr(32:37)    with bit 6 reserved
- *    _xmm[0..7] f16..f31                    (live registers)
- *                                           with _xmm[0]
- *                                             Bit(64:127)=f17(0:63)
- *                                             Bit(0:63)=f16(0:63)
- *    All other fields unused...
- */
-
-static int
-save_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
-{
-       struct task_struct *tsk = current;
-       struct pt_regs *ptp;
-       struct _fpreg_ia32 *fpregp;
-       char buf[32];
-       unsigned long fsr, fcr, fir, fdr;
-       unsigned long new_fsr;
-       unsigned long num128[2];
-       unsigned long mxcsr=0;
-       int fp_tos, fr8_st_map;
-
-       if (!access_ok(VERIFY_WRITE, save, sizeof(*save)))
-               return -EFAULT;
-
-       /* Read in fsr, fcr, fir, fdr and copy onto fpstate */
-       fsr = ia64_getreg(_IA64_REG_AR_FSR);
-       fcr = ia64_getreg(_IA64_REG_AR_FCR);
-       fir = ia64_getreg(_IA64_REG_AR_FIR);
-       fdr = ia64_getreg(_IA64_REG_AR_FDR);
-
-       /*
-        * We need to clear the exception state before calling the signal handler. Clear
-        * the bits 15, bits 0-7 in fp status word. Similar to the functionality of fnclex
-        * instruction.
-        */
-       new_fsr = fsr & ~0x80ff;
-       ia64_setreg(_IA64_REG_AR_FSR, new_fsr);
-
-       __put_user(fcr & 0xffff, &save->cw);
-       __put_user(fsr & 0xffff, &save->sw);
-       __put_user((fsr>>16) & 0xffff, &save->tag);
-       __put_user(fir, &save->ipoff);
-       __put_user((fir>>32) & 0xffff, &save->cssel);
-       __put_user(fdr, &save->dataoff);
-       __put_user((fdr>>32) & 0xffff, &save->datasel);
-       __put_user(fsr & 0xffff, &save->status);
-
-       mxcsr = ((fcr>>32) & 0xff80) | ((fsr>>32) & 0x3f);
-       __put_user(mxcsr & 0xffff, &save->mxcsr);
-       __put_user( 0, &save->magic); //#define X86_FXSR_MAGIC   0x0000
-
-       /*
-        * save f8..f11  from pt_regs
-        * save f12..f15 from live register set
-        */
-       /*
-        *  Find the location where f8 has to go in fp reg stack.  This depends on
-        *  TOP(11:13) field of sw. Other f reg continue sequentially from where f8 maps
-        *  to.
-        */
-       fp_tos = (fsr>>11)&0x7;
-       fr8_st_map = (8-fp_tos)&0x7;
-       ptp = task_pt_regs(tsk);
-       fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
-       ia64f2ia32f(fpregp, &ptp->f8);
-       copy_to_user(&save->_st[(0+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-       ia64f2ia32f(fpregp, &ptp->f9);
-       copy_to_user(&save->_st[(1+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-       ia64f2ia32f(fpregp, &ptp->f10);
-       copy_to_user(&save->_st[(2+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-       ia64f2ia32f(fpregp, &ptp->f11);
-       copy_to_user(&save->_st[(3+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-
-       ia64_stfe(fpregp, 12);
-       copy_to_user(&save->_st[(4+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-       ia64_stfe(fpregp, 13);
-       copy_to_user(&save->_st[(5+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-       ia64_stfe(fpregp, 14);
-       copy_to_user(&save->_st[(6+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-       ia64_stfe(fpregp, 15);
-       copy_to_user(&save->_st[(7+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
-
-       ia64_stf8(&num128[0], 16);
-       ia64_stf8(&num128[1], 17);
-       copy_to_user(&save->_xmm[0], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 18);
-       ia64_stf8(&num128[1], 19);
-       copy_to_user(&save->_xmm[1], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 20);
-       ia64_stf8(&num128[1], 21);
-       copy_to_user(&save->_xmm[2], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 22);
-       ia64_stf8(&num128[1], 23);
-       copy_to_user(&save->_xmm[3], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 24);
-       ia64_stf8(&num128[1], 25);
-       copy_to_user(&save->_xmm[4], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 26);
-       ia64_stf8(&num128[1], 27);
-       copy_to_user(&save->_xmm[5], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 28);
-       ia64_stf8(&num128[1], 29);
-       copy_to_user(&save->_xmm[6], num128, sizeof(struct _xmmreg_ia32));
-
-       ia64_stf8(&num128[0], 30);
-       ia64_stf8(&num128[1], 31);
-       copy_to_user(&save->_xmm[7], num128, sizeof(struct _xmmreg_ia32));
-       return 0;
-}
-
-static int
-restore_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
-{
-       struct task_struct *tsk = current;
-       struct pt_regs *ptp;
-       unsigned int lo, hi;
-       unsigned long num128[2];
-       unsigned long num64, mxcsr;
-       struct _fpreg_ia32 *fpregp;
-       char buf[32];
-       unsigned long fsr, fcr, fir, fdr;
-       int fp_tos, fr8_st_map;
-
-       if (!access_ok(VERIFY_READ, save, sizeof(*save)))
-               return(-EFAULT);
-
-       /*
-        * Updating fsr, fcr, fir, fdr.
-        * Just a bit more complicated than save.
-        * - Need to make sure that we don't write any value other than the
-        *   specific fpstate info
-        * - Need to make sure that the untouched part of frs, fdr, fir, fcr
-        *   should remain same while writing.
-        * So, we do a read, change specific fields and write.
-        */
-       fsr = ia64_getreg(_IA64_REG_AR_FSR);
-       fcr = ia64_getreg(_IA64_REG_AR_FCR);
-       fir = ia64_getreg(_IA64_REG_AR_FIR);
-       fdr = ia64_getreg(_IA64_REG_AR_FDR);
-
-       __get_user(mxcsr, (unsigned int __user *)&save->mxcsr);
-       /* setting bits 0..5 8..12 with cw and 39..47 from mxcsr */
-       __get_user(lo, (unsigned int __user *)&save->cw);
-       num64 = mxcsr & 0xff10;
-       num64 = (num64 << 32) | (lo & 0x1f3f);
-       fcr = (fcr & (~0xff1000001f3fUL)) | num64;
-
-       /* setting bits 0..31 with sw and tag and 32..37 from mxcsr */
-       __get_user(lo, (unsigned int __user *)&save->sw);
-       /* set bits 15,7 (fsw.b, fsw.es) to reflect the current error status */
-       if ( !(lo & 0x7f) )
-               lo &= (~0x8080);
-       __get_user(hi, (unsigned int __user *)&save->tag);
-       num64 = mxcsr & 0x3f;
-       num64 = (num64 << 16) | (hi & 0xffff);
-       num64 = (num64 << 16) | (lo & 0xffff);
-       fsr = (fsr & (~0x3fffffffffUL)) | num64;
-
-       /* setting bits 0..47 with cssel and ipoff */
-       __get_user(lo, (unsigned int __user *)&save->ipoff);
-       __get_user(hi, (unsigned int __user *)&save->cssel);
-       num64 = hi & 0xffff;
-       num64 = (num64 << 32) | lo;
-       fir = (fir & (~0xffffffffffffUL)) | num64;
-
-       /* setting bits 0..47 with datasel and dataoff */
-       __get_user(lo, (unsigned int __user *)&save->dataoff);
-       __get_user(hi, (unsigned int __user *)&save->datasel);
-       num64 = hi & 0xffff;
-       num64 = (num64 << 32) | lo;
-       fdr = (fdr & (~0xffffffffffffUL)) | num64;
-
-       ia64_setreg(_IA64_REG_AR_FSR, fsr);
-       ia64_setreg(_IA64_REG_AR_FCR, fcr);
-       ia64_setreg(_IA64_REG_AR_FIR, fir);
-       ia64_setreg(_IA64_REG_AR_FDR, fdr);
-
-       /*
-        * restore f8..f11 onto pt_regs
-        * restore f12..f15 onto live registers
-        */
-       /*
-        *  Find the location where f8 has to go in fp reg stack.  This depends on
-        *  TOP(11:13) field of sw. Other f reg continue sequentially from where f8 maps
-        *  to.
-        */
-       fp_tos = (fsr>>11)&0x7;
-       fr8_st_map = (8-fp_tos)&0x7;
-       fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
-
-       ptp = task_pt_regs(tsk);
-       copy_from_user(fpregp, &save->_st[(0+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia32f2ia64f(&ptp->f8, fpregp);
-       copy_from_user(fpregp, &save->_st[(1+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia32f2ia64f(&ptp->f9, fpregp);
-       copy_from_user(fpregp, &save->_st[(2+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia32f2ia64f(&ptp->f10, fpregp);
-       copy_from_user(fpregp, &save->_st[(3+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia32f2ia64f(&ptp->f11, fpregp);
-
-       copy_from_user(fpregp, &save->_st[(4+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia64_ldfe(12, fpregp);
-       copy_from_user(fpregp, &save->_st[(5+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia64_ldfe(13, fpregp);
-       copy_from_user(fpregp, &save->_st[(6+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia64_ldfe(14, fpregp);
-       copy_from_user(fpregp, &save->_st[(7+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
-       ia64_ldfe(15, fpregp);
-
-       copy_from_user(num128, &save->_xmm[0], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(16, &num128[0]);
-       ia64_ldf8(17, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[1], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(18, &num128[0]);
-       ia64_ldf8(19, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[2], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(20, &num128[0]);
-       ia64_ldf8(21, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[3], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(22, &num128[0]);
-       ia64_ldf8(23, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[4], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(24, &num128[0]);
-       ia64_ldf8(25, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[5], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(26, &num128[0]);
-       ia64_ldf8(27, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[6], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(28, &num128[0]);
-       ia64_ldf8(29, &num128[1]);
-
-       copy_from_user(num128, &save->_xmm[7], sizeof(struct _xmmreg_ia32));
-       ia64_ldf8(30, &num128[0]);
-       ia64_ldf8(31, &num128[1]);
-       return 0;
-}
-
-static inline void
-sigact_set_handler (struct k_sigaction *sa, unsigned int handler, unsigned int restorer)
-{
-       if (handler + 1 <= 2)
-               /* SIG_DFL, SIG_IGN, or SIG_ERR: must sign-extend to 64-bits */
-               sa->sa.sa_handler = (__sighandler_t) A((int) handler);
-       else
-               sa->sa.sa_handler = (__sighandler_t) (((unsigned long) restorer << 32) | handler);
-}
-
-asmlinkage long
-sys32_sigsuspend (int history0, int history1, old_sigset_t mask)
-{
-       mask &= _BLOCKABLE;
-       spin_lock_irq(&current->sighand->siglock);
-       current->saved_sigmask = current->blocked;
-       siginitset(&current->blocked, mask);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       current->state = TASK_INTERRUPTIBLE;
-       schedule();
-       set_restore_sigmask();
-       return -ERESTARTNOHAND;
-}
-
-asmlinkage long
-sys32_signal (int sig, unsigned int handler)
-{
-       struct k_sigaction new_sa, old_sa;
-       int ret;
-
-       sigact_set_handler(&new_sa, handler, 0);
-       new_sa.sa.sa_flags = SA_ONESHOT | SA_NOMASK;
-       sigemptyset(&new_sa.sa.sa_mask);
-
-       ret = do_sigaction(sig, &new_sa, &old_sa);
-
-       return ret ? ret : IA32_SA_HANDLER(&old_sa);
-}
-
-asmlinkage long
-sys32_rt_sigaction (int sig, struct sigaction32 __user *act,
-                   struct sigaction32 __user *oact, unsigned int sigsetsize)
-{
-       struct k_sigaction new_ka, old_ka;
-       unsigned int handler, restorer;
-       int ret;
-
-       /* XXX: Don't preclude handling different sized sigset_t's.  */
-       if (sigsetsize != sizeof(compat_sigset_t))
-               return -EINVAL;
-
-       if (act) {
-               ret = get_user(handler, &act->sa_handler);
-               ret |= get_user(new_ka.sa.sa_flags, &act->sa_flags);
-               ret |= get_user(restorer, &act->sa_restorer);
-               ret |= copy_from_user(&new_ka.sa.sa_mask, &act->sa_mask, sizeof(compat_sigset_t));
-               if (ret)
-                       return -EFAULT;
-
-               sigact_set_handler(&new_ka, handler, restorer);
-       }
-
-       ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-       if (!ret && oact) {
-               ret = put_user(IA32_SA_HANDLER(&old_ka), &oact->sa_handler);
-               ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-               ret |= put_user(IA32_SA_RESTORER(&old_ka), &oact->sa_restorer);
-               ret |= copy_to_user(&oact->sa_mask, &old_ka.sa.sa_mask, sizeof(compat_sigset_t));
-       }
-       return ret;
-}
-
-
-asmlinkage long
-sys32_rt_sigprocmask (int how, compat_sigset_t __user *set, compat_sigset_t __user *oset,
-                     unsigned int sigsetsize)
-{
-       mm_segment_t old_fs = get_fs();
-       sigset_t s;
-       long ret;
-
-       if (sigsetsize > sizeof(s))
-               return -EINVAL;
-
-       if (set) {
-               memset(&s, 0, sizeof(s));
-               if (copy_from_user(&s.sig, set, sigsetsize))
-                       return -EFAULT;
-       }
-       set_fs(KERNEL_DS);
-       ret = sys_rt_sigprocmask(how,
-                                set ? (sigset_t __user *) &s : NULL,
-                                oset ? (sigset_t __user *) &s : NULL, sizeof(s));
-       set_fs(old_fs);
-       if (ret)
-               return ret;
-       if (oset) {
-               if (copy_to_user(oset, &s.sig, sigsetsize))
-                       return -EFAULT;
-       }
-       return 0;
-}
-
-asmlinkage long
-sys32_rt_sigqueueinfo (int pid, int sig, compat_siginfo_t __user *uinfo)
-{
-       mm_segment_t old_fs = get_fs();
-       siginfo_t info;
-       int ret;
-
-       if (copy_siginfo_from_user32(&info, uinfo))
-               return -EFAULT;
-       set_fs(KERNEL_DS);
-       ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
-       set_fs(old_fs);
-       return ret;
-}
-
-asmlinkage long
-sys32_sigaction (int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact)
-{
-       struct k_sigaction new_ka, old_ka;
-       unsigned int handler, restorer;
-       int ret;
-
-       if (act) {
-               compat_old_sigset_t mask;
-
-               ret = get_user(handler, &act->sa_handler);
-               ret |= get_user(new_ka.sa.sa_flags, &act->sa_flags);
-               ret |= get_user(restorer, &act->sa_restorer);
-               ret |= get_user(mask, &act->sa_mask);
-               if (ret)
-                       return ret;
-
-               sigact_set_handler(&new_ka, handler, restorer);
-               siginitset(&new_ka.sa.sa_mask, mask);
-       }
-
-       ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-       if (!ret && oact) {
-               ret = put_user(IA32_SA_HANDLER(&old_ka), &oact->sa_handler);
-               ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-               ret |= put_user(IA32_SA_RESTORER(&old_ka), &oact->sa_restorer);
-               ret |= put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
-       }
-
-       return ret;
-}
-
-static int
-setup_sigcontext_ia32 (struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __user *fpstate,
-                      struct pt_regs *regs, unsigned long mask)
-{
-       int  err = 0;
-       unsigned long flag;
-
-       if (!access_ok(VERIFY_WRITE, sc, sizeof(*sc)))
-               return -EFAULT;
-
-       err |= __put_user((regs->r16 >> 32) & 0xffff, (unsigned int __user *)&sc->fs);
-       err |= __put_user((regs->r16 >> 48) & 0xffff, (unsigned int __user *)&sc->gs);
-       err |= __put_user((regs->r16 >> 16) & 0xffff, (unsigned int __user *)&sc->es);
-       err |= __put_user(regs->r16 & 0xffff, (unsigned int __user *)&sc->ds);
-       err |= __put_user(regs->r15, &sc->edi);
-       err |= __put_user(regs->r14, &sc->esi);
-       err |= __put_user(regs->r13, &sc->ebp);
-       err |= __put_user(regs->r12, &sc->esp);
-       err |= __put_user(regs->r11, &sc->ebx);
-       err |= __put_user(regs->r10, &sc->edx);
-       err |= __put_user(regs->r9, &sc->ecx);
-       err |= __put_user(regs->r8, &sc->eax);
-#if 0
-       err |= __put_user(current->tss.trap_no, &sc->trapno);
-       err |= __put_user(current->tss.error_code, &sc->err);
-#endif
-       err |= __put_user(regs->cr_iip, &sc->eip);
-       err |= __put_user(regs->r17 & 0xffff, (unsigned int __user *)&sc->cs);
-       /*
-        *  `eflags' is in an ar register for this context
-        */
-       flag = ia64_getreg(_IA64_REG_AR_EFLAG);
-       err |= __put_user((unsigned int)flag, &sc->eflags);
-       err |= __put_user(regs->r12, &sc->esp_at_signal);
-       err |= __put_user((regs->r17 >> 16) & 0xffff, (unsigned int __user *)&sc->ss);
-
-       if ( save_ia32_fpstate_live(fpstate) < 0 )
-               err = -EFAULT;
-       else
-               err |= __put_user((u32)(u64)fpstate, &sc->fpstate);
-
-#if 0
-       tmp = save_i387(fpstate);
-       if (tmp < 0)
-               err = 1;
-       else
-               err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);
-
-       /* non-iBCS2 extensions.. */
-#endif
-       err |= __put_user(mask, &sc->oldmask);
-#if 0
-       err |= __put_user(current->tss.cr2, &sc->cr2);
-#endif
-       return err;
-}
-
-static int
-restore_sigcontext_ia32 (struct pt_regs *regs, struct sigcontext_ia32 __user *sc, int *peax)
-{
-       unsigned int err = 0;
-
-       /* Always make any pending restarted system calls return -EINTR */
-       current_thread_info()->restart_block.fn = do_no_restart_syscall;
-
-       if (!access_ok(VERIFY_READ, sc, sizeof(*sc)))
-               return(-EFAULT);
-
-#define COPY(ia64x, ia32x)     err |= __get_user(regs->ia64x, &sc->ia32x)
-
-#define copyseg_gs(tmp)                (regs->r16 |= (unsigned long) (tmp) << 48)
-#define copyseg_fs(tmp)                (regs->r16 |= (unsigned long) (tmp) << 32)
-#define copyseg_cs(tmp)                (regs->r17 |= tmp)
-#define copyseg_ss(tmp)                (regs->r17 |= (unsigned long) (tmp) << 16)
-#define copyseg_es(tmp)                (regs->r16 |= (unsigned long) (tmp) << 16)
-#define copyseg_ds(tmp)                (regs->r16 |= tmp)
-
-#define COPY_SEG(seg)                                  \
-       {                                               \
-               unsigned short tmp;                     \
-               err |= __get_user(tmp, &sc->seg);       \
-               copyseg_##seg(tmp);                     \
-       }
-#define COPY_SEG_STRICT(seg)                           \
-       {                                               \
-               unsigned short tmp;                     \
-               err |= __get_user(tmp, &sc->seg);       \
-               copyseg_##seg(tmp|3);                   \
-       }
-
-       /* To make COPY_SEGs easier, we zero r16, r17 */
-       regs->r16 = 0;
-       regs->r17 = 0;
-
-       COPY_SEG(gs);
-       COPY_SEG(fs);
-       COPY_SEG(es);
-       COPY_SEG(ds);
-       COPY(r15, edi);
-       COPY(r14, esi);
-       COPY(r13, ebp);
-       COPY(r12, esp);
-       COPY(r11, ebx);
-       COPY(r10, edx);
-       COPY(r9, ecx);
-       COPY(cr_iip, eip);
-       COPY_SEG_STRICT(cs);
-       COPY_SEG_STRICT(ss);
-       ia32_load_segment_descriptors(current);
-       {
-               unsigned int tmpflags;
-               unsigned long flag;
-
-               /*
-                *  IA32 `eflags' is not part of `pt_regs', it's in an ar register which
-                *  is part of the thread context.  Fortunately, we are executing in the
-                *  IA32 process's context.
-                */
-               err |= __get_user(tmpflags, &sc->eflags);
-               flag = ia64_getreg(_IA64_REG_AR_EFLAG);
-               flag &= ~0x40DD5;
-               flag |= (tmpflags & 0x40DD5);
-               ia64_setreg(_IA64_REG_AR_EFLAG, flag);
-
-               regs->r1 = -1;  /* disable syscall checks, r1 is orig_eax */
-       }
-
-       {
-               struct _fpstate_ia32 __user *buf = NULL;
-               u32    fpstate_ptr;
-               err |= get_user(fpstate_ptr, &(sc->fpstate));
-               buf = compat_ptr(fpstate_ptr);
-               if (buf) {
-                       err |= restore_ia32_fpstate_live(buf);
-               }
-       }
-
-#if 0
-       {
-               struct _fpstate * buf;
-               err |= __get_user(buf, &sc->fpstate);
-               if (buf) {
-                       if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
-                               goto badframe;
-                       err |= restore_i387(buf);
-               }
-       }
-#endif
-
-       err |= __get_user(*peax, &sc->eax);
-       return err;
-
-#if 0
-  badframe:
-       return 1;
-#endif
-}
-
-/*
- * Determine which stack to use..
- */
-static inline void __user *
-get_sigframe (struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
-{
-       unsigned long esp;
-
-       /* Default to using normal stack (truncate off sign-extension of bit 31: */
-       esp = (unsigned int) regs->r12;
-
-       /* This is the X/Open sanctioned signal stack switching.  */
-       if (ka->sa.sa_flags & SA_ONSTACK) {
-               int onstack = sas_ss_flags(esp);
-
-               if (onstack == 0)
-                       esp = current->sas_ss_sp + current->sas_ss_size;
-               else if (onstack == SS_ONSTACK) {
-                       /*
-                        * If we are on the alternate signal stack and would
-                        * overflow it, don't. Return an always-bogus address
-                        * instead so we will die with SIGSEGV.
-                        */
-                       if (!likely(on_sig_stack(esp - frame_size)))
-                               return (void __user *) -1L;
-               }
-       }
-       /* Legacy stack switching not supported */
-
-       esp -= frame_size;
-       /* Align the stack pointer according to the i386 ABI,
-        * i.e. so that on function entry ((sp + 4) & 15) == 0. */
-       esp = ((esp + 4) & -16ul) - 4;
-       return (void __user *) esp;
-}
-
-static int
-setup_frame_ia32 (int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs)
-{
-       struct exec_domain *ed = current_thread_info()->exec_domain;
-       struct sigframe_ia32 __user *frame;
-       int err = 0;
-
-       frame = get_sigframe(ka, regs, sizeof(*frame));
-
-       if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
-               goto give_sigsegv;
-
-       err |= __put_user((ed && ed->signal_invmap && sig < 32
-                          ? (int)(ed->signal_invmap[sig]) : sig), &frame->sig);
-
-       err |= setup_sigcontext_ia32(&frame->sc, &frame->fpstate, regs, set->sig[0]);
-
-       if (_COMPAT_NSIG_WORDS > 1)
-               err |= __copy_to_user(frame->extramask, (char *) &set->sig + 4,
-                                     sizeof(frame->extramask));
-
-       /* Set up to return from userspace.  If provided, use a stub
-          already in userspace.  */
-       if (ka->sa.sa_flags & SA_RESTORER) {
-               unsigned int restorer = IA32_SA_RESTORER(ka);
-               err |= __put_user(restorer, &frame->pretcode);
-       } else {
-               /* Pointing to restorer in ia32 gate page */
-               err |= __put_user(IA32_GATE_OFFSET, &frame->pretcode);
-       }
-
-       /* This is popl %eax ; movl $,%eax ; int $0x80
-        * and there for historical reasons only.
-        * See arch/i386/kernel/signal.c
-        */
-
-       err |= __put_user(0xb858, (short __user *)(frame->retcode+0));
-       err |= __put_user(__IA32_NR_sigreturn, (int __user *)(frame->retcode+2));
-       err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
-
-       if (err)
-               goto give_sigsegv;
-
-       /* Set up registers for signal handler */
-       regs->r12 = (unsigned long) frame;
-       regs->cr_iip = IA32_SA_HANDLER(ka);
-
-       set_fs(USER_DS);
-
-#if 0
-       regs->eflags &= ~TF_MASK;
-#endif
-
-#if 0
-       printk("SIG deliver (%s:%d): sig=%d sp=%p pc=%lx ra=%x\n",
-               current->comm, current->pid, sig, (void *) frame, regs->cr_iip, frame->pretcode);
-#endif
-
-       return 1;
-
-  give_sigsegv:
-       force_sigsegv(sig, current);
-       return 0;
-}
-
-static int
-setup_rt_frame_ia32 (int sig, struct k_sigaction *ka, siginfo_t *info,
-                    sigset_t *set, struct pt_regs * regs)
-{
-       struct exec_domain *ed = current_thread_info()->exec_domain;
-       compat_uptr_t pinfo, puc;
-       struct rt_sigframe_ia32 __user *frame;
-       int err = 0;
-
-       frame = get_sigframe(ka, regs, sizeof(*frame));
-
-       if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
-               goto give_sigsegv;
-
-       err |= __put_user((ed && ed->signal_invmap
-                          && sig < 32 ? ed->signal_invmap[sig] : sig), &frame->sig);
-
-       pinfo = (long __user) &frame->info;
-       puc = (long __user) &frame->uc;
-       err |= __put_user(pinfo, &frame->pinfo);
-       err |= __put_user(puc, &frame->puc);
-       err |= copy_siginfo_to_user32(&frame->info, info);
-
-       /* Create the ucontext.  */
-       err |= __put_user(0, &frame->uc.uc_flags);
-       err |= __put_user(0, &frame->uc.uc_link);
-       err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
-       err |= __put_user(sas_ss_flags(regs->r12), &frame->uc.uc_stack.ss_flags);
-       err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
-       err |= setup_sigcontext_ia32(&frame->uc.uc_mcontext, &frame->fpstate, regs, set->sig[0]);
-       err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
-       if (err)
-               goto give_sigsegv;
-
-       /* Set up to return from userspace.  If provided, use a stub
-          already in userspace.  */
-       if (ka->sa.sa_flags & SA_RESTORER) {
-               unsigned int restorer = IA32_SA_RESTORER(ka);
-               err |= __put_user(restorer, &frame->pretcode);
-       } else {
-               /* Pointing to rt_restorer in ia32 gate page */
-               err |= __put_user(IA32_GATE_OFFSET + 8, &frame->pretcode);
-       }
-
-       /* This is movl $,%eax ; int $0x80
-        * and there for historical reasons only.
-        * See arch/i386/kernel/signal.c
-        */
-
-       err |= __put_user(0xb8, (char __user *)(frame->retcode+0));
-       err |= __put_user(__IA32_NR_rt_sigreturn, (int __user *)(frame->retcode+1));
-       err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
-
-       if (err)
-               goto give_sigsegv;
-
-       /* Set up registers for signal handler */
-       regs->r12 = (unsigned long) frame;
-       regs->cr_iip = IA32_SA_HANDLER(ka);
-
-       set_fs(USER_DS);
-
-#if 0
-       regs->eflags &= ~TF_MASK;
-#endif
-
-#if 0
-       printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%x\n",
-               current->comm, current->pid, (void *) frame, regs->cr_iip, frame->pretcode);
-#endif
-
-       return 1;
-
-give_sigsegv:
-       force_sigsegv(sig, current);
-       return 0;
-}
-
-int
-ia32_setup_frame1 (int sig, struct k_sigaction *ka, siginfo_t *info,
-                  sigset_t *set, struct pt_regs *regs)
-{
-       /* Set up the stack frame */
-       if (ka->sa.sa_flags & SA_SIGINFO)
-               return setup_rt_frame_ia32(sig, ka, info, set, regs);
-       else
-               return setup_frame_ia32(sig, ka, set, regs);
-}
-
-asmlinkage long
-sys32_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5,
-                int arg6, int arg7, struct pt_regs regs)
-{
-       unsigned long esp = (unsigned int) regs.r12;
-       struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(esp - 8);
-       sigset_t set;
-       int eax;
-
-       if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
-               goto badframe;
-
-       if (__get_user(set.sig[0], &frame->sc.oldmask)
-           || (_COMPAT_NSIG_WORDS > 1 && __copy_from_user((char *) &set.sig + 4, &frame->extramask,
-                                                        sizeof(frame->extramask))))
-               goto badframe;
-
-       sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       if (restore_sigcontext_ia32(&regs, &frame->sc, &eax))
-               goto badframe;
-       return eax;
-
-  badframe:
-       force_sig(SIGSEGV, current);
-       return 0;
-}
-
-asmlinkage long
-sys32_rt_sigreturn (int arg0, int arg1, int arg2, int arg3, int arg4,
-                   int arg5, int arg6, int arg7, struct pt_regs regs)
-{
-       unsigned long esp = (unsigned int) regs.r12;
-       struct rt_sigframe_ia32 __user *frame = (struct rt_sigframe_ia32 __user *)(esp - 4);
-       sigset_t set;
-       int eax;
-
-       if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
-               goto badframe;
-       if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
-               goto badframe;
-
-       sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked =  set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       if (restore_sigcontext_ia32(&regs, &frame->uc.uc_mcontext, &eax))
-               goto badframe;
-
-       /* It is more difficult to avoid calling this function than to
-          call it and ignore errors.  */
-       do_sigaltstack((stack_t __user *) &frame->uc.uc_stack, NULL, esp);
-
-       return eax;
-
-  badframe:
-       force_sig(SIGSEGV, current);
-       return 0;
-}
diff --git a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c
deleted file mode 100644 (file)
index a6965dd..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * IA32 helper functions
- *
- * Copyright (C) 1999 Arun Sharma <arun.sharma@intel.com>
- * Copyright (C) 2000 Asit K. Mallick <asit.k.mallick@intel.com>
- * Copyright (C) 2001-2002 Hewlett-Packard Co
- *     David Mosberger-Tang <davidm@hpl.hp.com>
- *
- * 06/16/00    A. Mallick      added csd/ssd/tssd for ia32 thread context
- * 02/19/01    D. Mosberger    dropped tssd; it's not needed
- * 09/14/01    D. Mosberger    fixed memory management for gdt/tss page
- * 09/29/01    D. Mosberger    added ia32_load_segment_descriptors()
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/mm.h>
-#include <linux/sched.h>
-
-#include <asm/intrinsics.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-
-#include "ia32priv.h"
-
-extern int die_if_kernel (char *str, struct pt_regs *regs, long err);
-
-struct page *ia32_shared_page[NR_CPUS];
-unsigned long *ia32_boot_gdt;
-unsigned long *cpu_gdt_table[NR_CPUS];
-struct page *ia32_gate_page;
-
-static unsigned long
-load_desc (u16 selector)
-{
-       unsigned long *table, limit, index;
-
-       if (!selector)
-               return 0;
-       if (selector & IA32_SEGSEL_TI) {
-               table = (unsigned long *) IA32_LDT_OFFSET;
-               limit = IA32_LDT_ENTRIES;
-       } else {
-               table = cpu_gdt_table[smp_processor_id()];
-               limit = IA32_PAGE_SIZE / sizeof(ia32_boot_gdt[0]);
-       }
-       index = selector >> IA32_SEGSEL_INDEX_SHIFT;
-       if (index >= limit)
-               return 0;
-       return IA32_SEG_UNSCRAMBLE(table[index]);
-}
-
-void
-ia32_load_segment_descriptors (struct task_struct *task)
-{
-       struct pt_regs *regs = task_pt_regs(task);
-
-       /* Setup the segment descriptors */
-       regs->r24 = load_desc(regs->r16 >> 16);         /* ESD */
-       regs->r27 = load_desc(regs->r16 >>  0);         /* DSD */
-       regs->r28 = load_desc(regs->r16 >> 32);         /* FSD */
-       regs->r29 = load_desc(regs->r16 >> 48);         /* GSD */
-       regs->ar_csd = load_desc(regs->r17 >>  0);      /* CSD */
-       regs->ar_ssd = load_desc(regs->r17 >> 16);      /* SSD */
-}
-
-int
-ia32_clone_tls (struct task_struct *child, struct pt_regs *childregs)
-{
-       struct desc_struct *desc;
-       struct ia32_user_desc info;
-       int idx;
-
-       if (copy_from_user(&info, (void __user *)(childregs->r14 & 0xffffffff), sizeof(info)))
-               return -EFAULT;
-       if (LDT_empty(&info))
-               return -EINVAL;
-
-       idx = info.entry_number;
-       if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
-               return -EINVAL;
-
-       desc = child->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
-       desc->a = LDT_entry_a(&info);
-       desc->b = LDT_entry_b(&info);
-
-       /* XXX: can this be done in a cleaner way ? */
-       load_TLS(&child->thread, smp_processor_id());
-       ia32_load_segment_descriptors(child);
-       load_TLS(&current->thread, smp_processor_id());
-
-       return 0;
-}
-
-void
-ia32_save_state (struct task_struct *t)
-{
-       t->thread.eflag = ia64_getreg(_IA64_REG_AR_EFLAG);
-       t->thread.fsr   = ia64_getreg(_IA64_REG_AR_FSR);
-       t->thread.fcr   = ia64_getreg(_IA64_REG_AR_FCR);
-       t->thread.fir   = ia64_getreg(_IA64_REG_AR_FIR);
-       t->thread.fdr   = ia64_getreg(_IA64_REG_AR_FDR);
-       ia64_set_kr(IA64_KR_IO_BASE, t->thread.old_iob);
-       ia64_set_kr(IA64_KR_TSSD, t->thread.old_k1);
-}
-
-void
-ia32_load_state (struct task_struct *t)
-{
-       unsigned long eflag, fsr, fcr, fir, fdr, tssd;
-       struct pt_regs *regs = task_pt_regs(t);
-
-       eflag = t->thread.eflag;
-       fsr = t->thread.fsr;
-       fcr = t->thread.fcr;
-       fir = t->thread.fir;
-       fdr = t->thread.fdr;
-       tssd = load_desc(_TSS);                                 /* TSSD */
-
-       ia64_setreg(_IA64_REG_AR_EFLAG, eflag);
-       ia64_setreg(_IA64_REG_AR_FSR, fsr);
-       ia64_setreg(_IA64_REG_AR_FCR, fcr);
-       ia64_setreg(_IA64_REG_AR_FIR, fir);
-       ia64_setreg(_IA64_REG_AR_FDR, fdr);
-       current->thread.old_iob = ia64_get_kr(IA64_KR_IO_BASE);
-       current->thread.old_k1 = ia64_get_kr(IA64_KR_TSSD);
-       ia64_set_kr(IA64_KR_IO_BASE, IA32_IOBASE);
-       ia64_set_kr(IA64_KR_TSSD, tssd);
-
-       regs->r17 = (_TSS << 48) | (_LDT << 32) | (__u32) regs->r17;
-       regs->r30 = load_desc(_LDT);                            /* LDTD */
-       load_TLS(&t->thread, smp_processor_id());
-}
-
-/*
- * Setup IA32 GDT and TSS
- */
-void
-ia32_gdt_init (void)
-{
-       int cpu = smp_processor_id();
-
-       ia32_shared_page[cpu] = alloc_page(GFP_KERNEL);
-       if (!ia32_shared_page[cpu])
-               panic("failed to allocate ia32_shared_page[%d]\n", cpu);
-
-       cpu_gdt_table[cpu] = page_address(ia32_shared_page[cpu]);
-
-       /* Copy from the boot cpu's GDT */
-       memcpy(cpu_gdt_table[cpu], ia32_boot_gdt, PAGE_SIZE);
-}
-
-
-/*
- * Setup IA32 GDT and TSS
- */
-static void
-ia32_boot_gdt_init (void)
-{
-       unsigned long ldt_size;
-
-       ia32_shared_page[0] = alloc_page(GFP_KERNEL);
-       if (!ia32_shared_page[0])
-               panic("failed to allocate ia32_shared_page[0]\n");
-
-       ia32_boot_gdt = page_address(ia32_shared_page[0]);
-       cpu_gdt_table[0] = ia32_boot_gdt;
-
-       /* CS descriptor in IA-32 (scrambled) format */
-       ia32_boot_gdt[__USER_CS >> 3]
-               = IA32_SEG_DESCRIPTOR(0, (IA32_GATE_END-1) >> IA32_PAGE_SHIFT,
-                                     0xb, 1, 3, 1, 1, 1, 1);
-
-       /* DS descriptor in IA-32 (scrambled) format */
-       ia32_boot_gdt[__USER_DS >> 3]
-               = IA32_SEG_DESCRIPTOR(0, (IA32_GATE_END-1) >> IA32_PAGE_SHIFT,
-                                     0x3, 1, 3, 1, 1, 1, 1);
-
-       ldt_size = PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE);
-       ia32_boot_gdt[TSS_ENTRY] = IA32_SEG_DESCRIPTOR(IA32_TSS_OFFSET, 235,
-                                                      0xb, 0, 3, 1, 1, 1, 0);
-       ia32_boot_gdt[LDT_ENTRY] = IA32_SEG_DESCRIPTOR(IA32_LDT_OFFSET, ldt_size - 1,
-                                                      0x2, 0, 3, 1, 1, 1, 0);
-}
-
-static void
-ia32_gate_page_init(void)
-{
-       unsigned long *sr;
-
-       ia32_gate_page = alloc_page(GFP_KERNEL);
-       sr = page_address(ia32_gate_page);
-       /* This is popl %eax ; movl $,%eax ; int $0x80 */
-       *sr++ = 0xb858 | (__IA32_NR_sigreturn << 16) | (0x80cdUL << 48);
-
-       /* This is movl $,%eax ; int $0x80 */
-       *sr = 0xb8 | (__IA32_NR_rt_sigreturn << 8) | (0x80cdUL << 40);
-}
-
-void
-ia32_mem_init(void)
-{
-       ia32_boot_gdt_init();
-       ia32_gate_page_init();
-}
-
-/*
- * Handle bad IA32 interrupt via syscall
- */
-void
-ia32_bad_interrupt (unsigned long int_num, struct pt_regs *regs)
-{
-       siginfo_t siginfo;
-
-       if (die_if_kernel("Bad IA-32 interrupt", regs, int_num))
-               return;
-
-       siginfo.si_signo = SIGTRAP;
-       siginfo.si_errno = int_num;     /* XXX is it OK to abuse si_errno like this? */
-       siginfo.si_flags = 0;
-       siginfo.si_isr = 0;
-       siginfo.si_addr = NULL;
-       siginfo.si_imm = 0;
-       siginfo.si_code = TRAP_BRKPT;
-       force_sig_info(SIGTRAP, &siginfo, current);
-}
-
-void
-ia32_cpu_init (void)
-{
-       /* initialize global ia32 state - CR0 and CR4 */
-       ia64_setreg(_IA64_REG_AR_CFLAG, (((ulong) IA32_CR4 << 32) | IA32_CR0));
-}
-
-static int __init
-ia32_init (void)
-{
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-       {
-               extern struct kmem_cache *ia64_partial_page_cachep;
-
-               ia64_partial_page_cachep = kmem_cache_create("ia64_partial_page_cache",
-                                       sizeof(struct ia64_partial_page),
-                                       0, SLAB_PANIC, NULL);
-       }
-#endif
-       return 0;
-}
-
-__initcall(ia32_init);
diff --git a/arch/ia64/ia32/ia32_traps.c b/arch/ia64/ia32/ia32_traps.c
deleted file mode 100644 (file)
index e486042..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * IA-32 exception handlers
- *
- * Copyright (C) 2000 Asit K. Mallick <asit.k.mallick@intel.com>
- * Copyright (C) 2001-2002 Hewlett-Packard Co
- *     David Mosberger-Tang <davidm@hpl.hp.com>
- *
- * 06/16/00    A. Mallick      added siginfo for most cases (close to IA32)
- * 09/29/00    D. Mosberger    added ia32_intercept()
- */
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-
-#include "ia32priv.h"
-
-#include <asm/intrinsics.h>
-#include <asm/ptrace.h>
-
-int
-ia32_intercept (struct pt_regs *regs, unsigned long isr)
-{
-       switch ((isr >> 16) & 0xff) {
-             case 0:   /* Instruction intercept fault */
-             case 4:   /* Locked Data reference fault */
-             case 1:   /* Gate intercept trap */
-               return -1;
-
-             case 2:   /* System flag trap */
-               if (((isr >> 14) & 0x3) >= 2) {
-                       /* MOV SS, POP SS instructions */
-                       ia64_psr(regs)->id = 1;
-                       return 0;
-               } else
-                       return -1;
-       }
-       return -1;
-}
-
-int
-ia32_exception (struct pt_regs *regs, unsigned long isr)
-{
-       struct siginfo siginfo;
-
-       /* initialize these fields to avoid leaking kernel bits to user space: */
-       siginfo.si_errno = 0;
-       siginfo.si_flags = 0;
-       siginfo.si_isr = 0;
-       siginfo.si_imm = 0;
-       switch ((isr >> 16) & 0xff) {
-             case 1:
-             case 2:
-               siginfo.si_signo = SIGTRAP;
-               if (isr == 0)
-                       siginfo.si_code = TRAP_TRACE;
-               else if (isr & 0x4)
-                       siginfo.si_code = TRAP_BRANCH;
-               else
-                       siginfo.si_code = TRAP_BRKPT;
-               break;
-
-             case 3:
-               siginfo.si_signo = SIGTRAP;
-               siginfo.si_code = TRAP_BRKPT;
-               break;
-
-             case 0:   /* Divide fault */
-               siginfo.si_signo = SIGFPE;
-               siginfo.si_code = FPE_INTDIV;
-               break;
-
-             case 4:   /* Overflow */
-             case 5:   /* Bounds fault */
-               siginfo.si_signo = SIGFPE;
-               siginfo.si_code = 0;
-               break;
-
-             case 6:   /* Invalid Op-code */
-               siginfo.si_signo = SIGILL;
-               siginfo.si_code = ILL_ILLOPN;
-               break;
-
-             case 7:   /* FP DNA */
-             case 8:   /* Double Fault */
-             case 9:   /* Invalid TSS */
-             case 11:  /* Segment not present */
-             case 12:  /* Stack fault */
-             case 13:  /* General Protection Fault */
-               siginfo.si_signo = SIGSEGV;
-               siginfo.si_code = 0;
-               break;
-
-             case 16:  /* Pending FP error */
-               {
-                       unsigned long fsr, fcr;
-
-                       fsr = ia64_getreg(_IA64_REG_AR_FSR);
-                       fcr = ia64_getreg(_IA64_REG_AR_FCR);
-
-                       siginfo.si_signo = SIGFPE;
-                       /*
-                        * (~cwd & swd) will mask out exceptions that are not set to unmasked
-                        * status.  0x3f is the exception bits in these regs, 0x200 is the
-                        * C1 reg you need in case of a stack fault, 0x040 is the stack
-                        * fault bit.  We should only be taking one exception at a time,
-                        * so if this combination doesn't produce any single exception,
-                        * then we have a bad program that isn't synchronizing its FPU usage
-                        * and it will suffer the consequences since we won't be able to
-                        * fully reproduce the context of the exception
-                        */
-                       siginfo.si_isr = isr;
-                       siginfo.si_flags = __ISR_VALID;
-                       switch(((~fcr) & (fsr & 0x3f)) | (fsr & 0x240)) {
-                               case 0x000:
-                               default:
-                                       siginfo.si_code = 0;
-                                       break;
-                               case 0x001: /* Invalid Op */
-                               case 0x040: /* Stack Fault */
-                               case 0x240: /* Stack Fault | Direction */
-                                       siginfo.si_code = FPE_FLTINV;
-                                       break;
-                               case 0x002: /* Denormalize */
-                               case 0x010: /* Underflow */
-                                       siginfo.si_code = FPE_FLTUND;
-                                       break;
-                               case 0x004: /* Zero Divide */
-                                       siginfo.si_code = FPE_FLTDIV;
-                                       break;
-                               case 0x008: /* Overflow */
-                                       siginfo.si_code = FPE_FLTOVF;
-                                       break;
-                               case 0x020: /* Precision */
-                                       siginfo.si_code = FPE_FLTRES;
-                                       break;
-                       }
-
-                       break;
-               }
-
-             case 17:  /* Alignment check */
-               siginfo.si_signo = SIGSEGV;
-               siginfo.si_code = BUS_ADRALN;
-               break;
-
-             case 19:  /* SSE Numeric error */
-               siginfo.si_signo = SIGFPE;
-               siginfo.si_code = 0;
-               break;
-
-             default:
-               return -1;
-       }
-       force_sig_info(siginfo.si_signo, &siginfo, current);
-       return 0;
-}
diff --git a/arch/ia64/ia32/ia32priv.h b/arch/ia64/ia32/ia32priv.h
deleted file mode 100644 (file)
index 0f15349..0000000
+++ /dev/null
@@ -1,532 +0,0 @@
-#ifndef _ASM_IA64_IA32_PRIV_H
-#define _ASM_IA64_IA32_PRIV_H
-
-
-#include <asm/ia32.h>
-
-#ifdef CONFIG_IA32_SUPPORT
-
-#include <linux/binfmts.h>
-#include <linux/compat.h>
-#include <linux/rbtree.h>
-
-#include <asm/processor.h>
-
-/*
- * 32 bit structures for IA32 support.
- */
-
-#define IA32_PAGE_SIZE         (1UL << IA32_PAGE_SHIFT)
-#define IA32_PAGE_MASK         (~(IA32_PAGE_SIZE - 1))
-#define IA32_PAGE_ALIGN(addr)  (((addr) + IA32_PAGE_SIZE - 1) & IA32_PAGE_MASK)
-#define IA32_CLOCKS_PER_SEC    100     /* Cast in stone for IA32 Linux */
-
-/*
- * partially mapped pages provide precise accounting of which 4k sub pages
- * are mapped and which ones are not, thereby improving IA-32 compatibility.
- */
-struct ia64_partial_page {
-       struct ia64_partial_page *next; /* linked list, sorted by address */
-       struct rb_node          pp_rb;
-       /* 64K is the largest "normal" page supported by ia64 ABI. So 4K*64
-        * should suffice.*/
-       unsigned long           bitmap;
-       unsigned int            base;
-};
-
-struct ia64_partial_page_list {
-       struct ia64_partial_page *pp_head; /* list head, points to the lowest
-                                          * addressed partial page */
-       struct rb_root          ppl_rb;
-       struct ia64_partial_page *pp_hint; /* pp_hint->next is the last
-                                          * accessed partial page */
-       atomic_t                pp_count; /* reference count */
-};
-
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-struct ia64_partial_page_list* ia32_init_pp_list (void);
-#else
-# define ia32_init_pp_list()   0
-#endif
-
-/* sigcontext.h */
-/*
- * As documented in the iBCS2 standard..
- *
- * The first part of "struct _fpstate" is just the
- * normal i387 hardware setup, the extra "status"
- * word is used to save the coprocessor status word
- * before entering the handler.
- */
-struct _fpreg_ia32 {
-       unsigned short significand[4];
-       unsigned short exponent;
-};
-
-struct _fpxreg_ia32 {
-        unsigned short significand[4];
-        unsigned short exponent;
-        unsigned short padding[3];
-};
-
-struct _xmmreg_ia32 {
-        unsigned int element[4];
-};
-
-
-struct _fpstate_ia32 {
-       unsigned int    cw,
-                      sw,
-                      tag,
-                      ipoff,
-                      cssel,
-                      dataoff,
-                      datasel;
-       struct _fpreg_ia32      _st[8];
-       unsigned short  status;
-       unsigned short  magic;          /* 0xffff = regular FPU data only */
-
-       /* FXSR FPU environment */
-       unsigned int         _fxsr_env[6];   /* FXSR FPU env is ignored */
-       unsigned int         mxcsr;
-       unsigned int         reserved;
-       struct _fpxreg_ia32  _fxsr_st[8];    /* FXSR FPU reg data is ignored */
-       struct _xmmreg_ia32  _xmm[8];
-       unsigned int         padding[56];
-};
-
-struct sigcontext_ia32 {
-       unsigned short gs, __gsh;
-       unsigned short fs, __fsh;
-       unsigned short es, __esh;
-       unsigned short ds, __dsh;
-       unsigned int edi;
-       unsigned int esi;
-       unsigned int ebp;
-       unsigned int esp;
-       unsigned int ebx;
-       unsigned int edx;
-       unsigned int ecx;
-       unsigned int eax;
-       unsigned int trapno;
-       unsigned int err;
-       unsigned int eip;
-       unsigned short cs, __csh;
-       unsigned int eflags;
-       unsigned int esp_at_signal;
-       unsigned short ss, __ssh;
-       unsigned int fpstate;           /* really (struct _fpstate_ia32 *) */
-       unsigned int oldmask;
-       unsigned int cr2;
-};
-
-/* user.h */
-/*
- * IA32 (Pentium III/4) FXSR, SSE support
- *
- * Provide support for the GDB 5.0+ PTRACE_{GET|SET}FPXREGS requests for
- * interacting with the FXSR-format floating point environment.  Floating
- * point data can be accessed in the regular format in the usual manner,
- * and both the standard and SIMD floating point data can be accessed via
- * the new ptrace requests.  In either case, changes to the FPU environment
- * will be reflected in the task's state as expected.
- */
-struct ia32_user_i387_struct {
-       int     cwd;
-       int     swd;
-       int     twd;
-       int     fip;
-       int     fcs;
-       int     foo;
-       int     fos;
-       /* 8*10 bytes for each FP-reg = 80 bytes */
-       struct _fpreg_ia32      st_space[8];
-};
-
-struct ia32_user_fxsr_struct {
-       unsigned short  cwd;
-       unsigned short  swd;
-       unsigned short  twd;
-       unsigned short  fop;
-       int     fip;
-       int     fcs;
-       int     foo;
-       int     fos;
-       int     mxcsr;
-       int     reserved;
-       int     st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
-       int     xmm_space[32];  /* 8*16 bytes for each XMM-reg = 128 bytes */
-       int     padding[56];
-};
-
-/* signal.h */
-#define IA32_SET_SA_HANDLER(ka,handler,restorer)                               \
-                               ((ka)->sa.sa_handler = (__sighandler_t)         \
-                                       (((unsigned long)(restorer) << 32)      \
-                                        | ((handler) & 0xffffffff)))
-#define IA32_SA_HANDLER(ka)    ((unsigned long) (ka)->sa.sa_handler & 0xffffffff)
-#define IA32_SA_RESTORER(ka)   ((unsigned long) (ka)->sa.sa_handler >> 32)
-
-#define __IA32_NR_sigreturn 119
-#define __IA32_NR_rt_sigreturn 173
-
-struct sigaction32 {
-       unsigned int sa_handler;                /* Really a pointer, but need to deal with 32 bits */
-       unsigned int sa_flags;
-       unsigned int sa_restorer;       /* Another 32 bit pointer */
-       compat_sigset_t sa_mask;                /* A 32 bit mask */
-};
-
-struct old_sigaction32 {
-       unsigned int  sa_handler;       /* Really a pointer, but need to deal
-                                            with 32 bits */
-       compat_old_sigset_t sa_mask;            /* A 32 bit mask */
-       unsigned int sa_flags;
-       unsigned int sa_restorer;       /* Another 32 bit pointer */
-};
-
-typedef struct sigaltstack_ia32 {
-       unsigned int    ss_sp;
-       int             ss_flags;
-       unsigned int    ss_size;
-} stack_ia32_t;
-
-struct ucontext_ia32 {
-       unsigned int      uc_flags;
-       unsigned int      uc_link;
-       stack_ia32_t      uc_stack;
-       struct sigcontext_ia32 uc_mcontext;
-       sigset_t          uc_sigmask;   /* mask last for extensibility */
-};
-
-struct stat64 {
-       unsigned long long      st_dev;
-       unsigned char   __pad0[4];
-       unsigned int    __st_ino;
-       unsigned int    st_mode;
-       unsigned int    st_nlink;
-       unsigned int    st_uid;
-       unsigned int    st_gid;
-       unsigned long long      st_rdev;
-       unsigned char   __pad3[4];
-       unsigned int    st_size_lo;
-       unsigned int    st_size_hi;
-       unsigned int    st_blksize;
-       unsigned int    st_blocks;      /* Number 512-byte blocks allocated. */
-       unsigned int    __pad4;         /* future possible st_blocks high bits */
-       unsigned int    st_atime;
-       unsigned int    st_atime_nsec;
-       unsigned int    st_mtime;
-       unsigned int    st_mtime_nsec;
-       unsigned int    st_ctime;
-       unsigned int    st_ctime_nsec;
-       unsigned int    st_ino_lo;
-       unsigned int    st_ino_hi;
-};
-
-typedef struct compat_siginfo {
-       int si_signo;
-       int si_errno;
-       int si_code;
-
-       union {
-               int _pad[((128/sizeof(int)) - 3)];
-
-               /* kill() */
-               struct {
-                       unsigned int _pid;      /* sender's pid */
-                       unsigned int _uid;      /* sender's uid */
-               } _kill;
-
-               /* POSIX.1b timers */
-               struct {
-                       compat_timer_t _tid;            /* timer id */
-                       int _overrun;           /* overrun count */
-                       char _pad[sizeof(unsigned int) - sizeof(int)];
-                       compat_sigval_t _sigval;        /* same as below */
-                       int _sys_private;       /* not to be passed to user */
-               } _timer;
-
-               /* POSIX.1b signals */
-               struct {
-                       unsigned int _pid;      /* sender's pid */
-                       unsigned int _uid;      /* sender's uid */
-                       compat_sigval_t _sigval;
-               } _rt;
-
-               /* SIGCHLD */
-               struct {
-                       unsigned int _pid;      /* which child */
-                       unsigned int _uid;      /* sender's uid */
-                       int _status;            /* exit code */
-                       compat_clock_t _utime;
-                       compat_clock_t _stime;
-               } _sigchld;
-
-               /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-               struct {
-                       unsigned int _addr;     /* faulting insn/memory ref. */
-               } _sigfault;
-
-               /* SIGPOLL */
-               struct {
-                       int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
-                       int _fd;
-               } _sigpoll;
-       } _sifields;
-} compat_siginfo_t;
-
-/*
- * IA-32 ELF specific definitions for IA-64.
- */
-
-#define _ASM_IA64_ELF_H                /* Don't include elf.h */
-
-#include <linux/sched.h>
-
-/*
- * This is used to ensure we don't load something for the wrong architecture.
- */
-#define elf_check_arch(x) ((x)->e_machine == EM_386)
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS      ELFCLASS32
-#define ELF_DATA       ELFDATA2LSB
-#define ELF_ARCH       EM_386
-
-#define IA32_STACK_TOP         IA32_PAGE_OFFSET
-#define IA32_GATE_OFFSET       IA32_PAGE_OFFSET
-#define IA32_GATE_END          IA32_PAGE_OFFSET + PAGE_SIZE
-
-/*
- * The system segments (GDT, TSS, LDT) have to be mapped below 4GB so the IA-32 engine can
- * access them.
- */
-#define IA32_GDT_OFFSET                (IA32_PAGE_OFFSET + PAGE_SIZE)
-#define IA32_TSS_OFFSET                (IA32_PAGE_OFFSET + 2*PAGE_SIZE)
-#define IA32_LDT_OFFSET                (IA32_PAGE_OFFSET + 3*PAGE_SIZE)
-
-#define ELF_EXEC_PAGESIZE      IA32_PAGE_SIZE
-
-/*
- * This is the location that an ET_DYN program is loaded if exec'ed.
- * Typical use of this is to invoke "./ld.so someprog" to test out a
- * new version of the loader.  We need to make sure that it is out of
- * the way of the program that it will "exec", and that there is
- * sufficient room for the brk.
- */
-#define ELF_ET_DYN_BASE                (IA32_PAGE_OFFSET/3 + 0x1000000)
-
-void ia64_elf32_init(struct pt_regs *regs);
-#define ELF_PLAT_INIT(_r, load_addr)   ia64_elf32_init(_r)
-
-/* This macro yields a bitmask that programs can use to figure out
-   what instruction set this CPU supports.  */
-#define ELF_HWCAP      0
-
-/* This macro yields a string that ld.so will use to load
-   implementation specific libraries for optimization.  Not terribly
-   relevant until we have real hardware to play with... */
-#define ELF_PLATFORM   NULL
-
-#ifdef __KERNEL__
-# define SET_PERSONALITY(EX)                           \
-       (current->personality = PER_LINUX)
-#endif
-
-#define IA32_EFLAG     0x200
-
-/*
- * IA-32 ELF specific definitions for IA-64.
- */
-
-#define __USER_CS      0x23
-#define __USER_DS      0x2B
-
-/*
- * The per-cpu GDT has 32 entries: see <asm-i386/segment.h>
- */
-#define GDT_ENTRIES 32
-
-#define GDT_SIZE       (GDT_ENTRIES * 8)
-
-#define TSS_ENTRY 14
-#define LDT_ENTRY      (TSS_ENTRY + 1)
-
-#define IA32_SEGSEL_RPL                (0x3 << 0)
-#define IA32_SEGSEL_TI         (0x1 << 2)
-#define IA32_SEGSEL_INDEX_SHIFT        3
-
-#define _TSS                   ((unsigned long) TSS_ENTRY << IA32_SEGSEL_INDEX_SHIFT)
-#define _LDT                   ((unsigned long) LDT_ENTRY << IA32_SEGSEL_INDEX_SHIFT)
-
-#define IA32_SEG_BASE          16
-#define IA32_SEG_TYPE          40
-#define IA32_SEG_SYS           44
-#define IA32_SEG_DPL           45
-#define IA32_SEG_P             47
-#define IA32_SEG_HIGH_LIMIT    48
-#define IA32_SEG_AVL           52
-#define IA32_SEG_DB            54
-#define IA32_SEG_G             55
-#define IA32_SEG_HIGH_BASE     56
-
-#define IA32_SEG_DESCRIPTOR(base, limit, segtype, nonsysseg, dpl, segpresent, avl, segdb, gran)        \
-              (((limit) & 0xffff)                                                              \
-               | (((unsigned long) (base) & 0xffffff) << IA32_SEG_BASE)                        \
-               | ((unsigned long) (segtype) << IA32_SEG_TYPE)                                  \
-               | ((unsigned long) (nonsysseg) << IA32_SEG_SYS)                                 \
-               | ((unsigned long) (dpl) << IA32_SEG_DPL)                                       \
-               | ((unsigned long) (segpresent) << IA32_SEG_P)                                  \
-               | ((((unsigned long) (limit) >> 16) & 0xf) << IA32_SEG_HIGH_LIMIT)              \
-               | ((unsigned long) (avl) << IA32_SEG_AVL)                                       \
-               | ((unsigned long) (segdb) << IA32_SEG_DB)                                      \
-               | ((unsigned long) (gran) << IA32_SEG_G)                                        \
-               | ((((unsigned long) (base) >> 24) & 0xff) << IA32_SEG_HIGH_BASE))
-
-#define SEG_LIM                32
-#define SEG_TYPE       52
-#define SEG_SYS                56
-#define SEG_DPL                57
-#define SEG_P          59
-#define SEG_AVL                60
-#define SEG_DB         62
-#define SEG_G          63
-
-/* Unscramble an IA-32 segment descriptor into the IA-64 format.  */
-#define IA32_SEG_UNSCRAMBLE(sd)                                                                         \
-       (   (((sd) >> IA32_SEG_BASE) & 0xffffff) | ((((sd) >> IA32_SEG_HIGH_BASE) & 0xff) << 24) \
-        | ((((sd) & 0xffff) | ((((sd) >> IA32_SEG_HIGH_LIMIT) & 0xf) << 16)) << SEG_LIM)        \
-        | ((((sd) >> IA32_SEG_TYPE) & 0xf) << SEG_TYPE)                                         \
-        | ((((sd) >> IA32_SEG_SYS) & 0x1) << SEG_SYS)                                           \
-        | ((((sd) >> IA32_SEG_DPL) & 0x3) << SEG_DPL)                                           \
-        | ((((sd) >> IA32_SEG_P) & 0x1) << SEG_P)                                               \
-        | ((((sd) >> IA32_SEG_AVL) & 0x1) << SEG_AVL)                                           \
-        | ((((sd) >> IA32_SEG_DB) & 0x1) << SEG_DB)                                             \
-        | ((((sd) >> IA32_SEG_G) & 0x1) << SEG_G))
-
-#define IA32_IOBASE    0x2000000000000000UL /* Virtual address for I/O space */
-
-#define IA32_CR0       0x80000001      /* Enable PG and PE bits */
-#define IA32_CR4       0x600           /* MMXEX and FXSR on */
-
-/*
- *  IA32 floating point control registers starting values
- */
-
-#define IA32_FSR_DEFAULT       0x55550000              /* set all tag bits */
-#define IA32_FCR_DEFAULT       0x17800000037fUL        /* extended precision, all masks */
-
-#define IA32_PTRACE_GETREGS    12
-#define IA32_PTRACE_SETREGS    13
-#define IA32_PTRACE_GETFPREGS  14
-#define IA32_PTRACE_SETFPREGS  15
-#define IA32_PTRACE_GETFPXREGS 18
-#define IA32_PTRACE_SETFPXREGS 19
-
-#define ia32_start_thread(regs,new_ip,new_sp) do {                             \
-       set_fs(USER_DS);                                                        \
-       ia64_psr(regs)->cpl = 3;        /* set user mode */                     \
-       ia64_psr(regs)->ri = 0;         /* clear return slot number */          \
-       ia64_psr(regs)->is = 1;         /* IA-32 instruction set */             \
-       regs->cr_iip = new_ip;                                                  \
-       regs->ar_rsc = 0xc;             /* enforced lazy mode, priv. level 3 */ \
-       regs->ar_rnat = 0;                                                      \
-       regs->loadrs = 0;                                                       \
-       regs->r12 = new_sp;                                                     \
-} while (0)
-
-/*
- * Local Descriptor Table (LDT) related declarations.
- */
-
-#define IA32_LDT_ENTRIES       8192            /* Maximum number of LDT entries supported. */
-#define IA32_LDT_ENTRY_SIZE    8               /* The size of each LDT entry. */
-
-#define LDT_entry_a(info) \
-       ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
-
-#define LDT_entry_b(info)                              \
-       (((info)->base_addr & 0xff000000) |             \
-       (((info)->base_addr & 0x00ff0000) >> 16) |      \
-       ((info)->limit & 0xf0000) |                     \
-       (((info)->read_exec_only ^ 1) << 9) |           \
-       ((info)->contents << 10) |                      \
-       (((info)->seg_not_present ^ 1) << 15) |         \
-       ((info)->seg_32bit << 22) |                     \
-       ((info)->limit_in_pages << 23) |                \
-       ((info)->useable << 20) |                       \
-       0x7100)
-
-#define LDT_empty(info) (                      \
-       (info)->base_addr       == 0    &&      \
-       (info)->limit           == 0    &&      \
-       (info)->contents        == 0    &&      \
-       (info)->read_exec_only  == 1    &&      \
-       (info)->seg_32bit       == 0    &&      \
-       (info)->limit_in_pages  == 0    &&      \
-       (info)->seg_not_present == 1    &&      \
-       (info)->useable         == 0    )
-
-static inline void
-load_TLS (struct thread_struct *t, unsigned int cpu)
-{
-       extern unsigned long *cpu_gdt_table[NR_CPUS];
-
-       memcpy(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN + 0, &t->tls_array[0], sizeof(long));
-       memcpy(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN + 1, &t->tls_array[1], sizeof(long));
-       memcpy(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN + 2, &t->tls_array[2], sizeof(long));
-}
-
-struct ia32_user_desc {
-       unsigned int entry_number;
-       unsigned int base_addr;
-       unsigned int limit;
-       unsigned int seg_32bit:1;
-       unsigned int contents:2;
-       unsigned int read_exec_only:1;
-       unsigned int limit_in_pages:1;
-       unsigned int seg_not_present:1;
-       unsigned int useable:1;
-};
-
-struct linux_binprm;
-
-extern void ia32_init_addr_space (struct pt_regs *regs);
-extern int ia32_setup_arg_pages (struct linux_binprm *bprm, int exec_stack);
-extern unsigned long ia32_do_mmap (struct file *, unsigned long, unsigned long, int, int, loff_t);
-extern void ia32_load_segment_descriptors (struct task_struct *task);
-
-#define ia32f2ia64f(dst,src)                   \
-do {                                           \
-       ia64_ldfe(6,src);                       \
-       ia64_stop();                            \
-       ia64_stf_spill(dst, 6);                 \
-} while(0)
-
-#define ia64f2ia32f(dst,src)                   \
-do {                                           \
-       ia64_ldf_fill(6, src);                  \
-       ia64_stop();                            \
-       ia64_stfe(dst, 6);                      \
-} while(0)
-
-struct user_regs_struct32 {
-       __u32 ebx, ecx, edx, esi, edi, ebp, eax;
-       unsigned short ds, __ds, es, __es;
-       unsigned short fs, __fs, gs, __gs;
-       __u32 orig_eax, eip;
-       unsigned short cs, __cs;
-       __u32 eflags, esp;
-       unsigned short ss, __ss;
-};
-
-/* Prototypes for use in elfcore32.h */
-extern int save_ia32_fpstate (struct task_struct *, struct ia32_user_i387_struct __user *);
-extern int save_ia32_fpxstate (struct task_struct *, struct ia32_user_fxsr_struct __user *);
-
-#endif /* !CONFIG_IA32_SUPPORT */
-
-#endif /* _ASM_IA64_IA32_PRIV_H */
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
deleted file mode 100644 (file)
index 045b746..0000000
+++ /dev/null
@@ -1,2765 +0,0 @@
-/*
- * sys_ia32.c: Conversion between 32bit and 64bit native syscalls. Derived from sys_sparc32.c.
- *
- * Copyright (C) 2000          VA Linux Co
- * Copyright (C) 2000          Don Dugger <n0ano@valinux.com>
- * Copyright (C) 1999          Arun Sharma <arun.sharma@intel.com>
- * Copyright (C) 1997,1998     Jakub Jelinek (jj@sunsite.mff.cuni.cz)
- * Copyright (C) 1997          David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 2000-2003, 2005 Hewlett-Packard Co
- *     David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 2004          Gordon Jin <gordon.jin@intel.com>
- *
- * These routines maintain argument size conversion between 32bit and 64bit
- * environment.
- */
-
-#include <linux/kernel.h>
-#include <linux/syscalls.h>
-#include <linux/sysctl.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/signal.h>
-#include <linux/resource.h>
-#include <linux/times.h>
-#include <linux/utsname.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/sem.h>
-#include <linux/msg.h>
-#include <linux/mm.h>
-#include <linux/shm.h>
-#include <linux/slab.h>
-#include <linux/uio.h>
-#include <linux/socket.h>
-#include <linux/quota.h>
-#include <linux/poll.h>
-#include <linux/eventpoll.h>
-#include <linux/personality.h>
-#include <linux/ptrace.h>
-#include <linux/regset.h>
-#include <linux/stat.h>
-#include <linux/ipc.h>
-#include <linux/capability.h>
-#include <linux/compat.h>
-#include <linux/vfs.h>
-#include <linux/mman.h>
-#include <linux/mutex.h>
-
-#include <asm/intrinsics.h>
-#include <asm/types.h>
-#include <asm/uaccess.h>
-#include <asm/unistd.h>
-
-#include "ia32priv.h"
-
-#include <net/scm.h>
-#include <net/sock.h>
-
-#define DEBUG  0
-
-#if DEBUG
-# define DBG(fmt...)   printk(KERN_DEBUG fmt)
-#else
-# define DBG(fmt...)
-#endif
-
-#define ROUND_UP(x,a)  ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
-
-#define OFFSET4K(a)            ((a) & 0xfff)
-#define PAGE_START(addr)       ((addr) & PAGE_MASK)
-#define MINSIGSTKSZ_IA32       2048
-
-#define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid))
-#define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid))
-
-/*
- * Anything that modifies or inspects ia32 user virtual memory must hold this semaphore
- * while doing so.
- */
-/* XXX make per-mm: */
-static DEFINE_MUTEX(ia32_mmap_mutex);
-
-asmlinkage long
-sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp,
-             struct pt_regs *regs)
-{
-       long error;
-       char *filename;
-       unsigned long old_map_base, old_task_size, tssd;
-
-       filename = getname(name);
-       error = PTR_ERR(filename);
-       if (IS_ERR(filename))
-               return error;
-
-       old_map_base  = current->thread.map_base;
-       old_task_size = current->thread.task_size;
-       tssd = ia64_get_kr(IA64_KR_TSSD);
-
-       /* we may be exec'ing a 64-bit process: reset map base, task-size, and io-base: */
-       current->thread.map_base  = DEFAULT_MAP_BASE;
-       current->thread.task_size = DEFAULT_TASK_SIZE;
-       ia64_set_kr(IA64_KR_IO_BASE, current->thread.old_iob);
-       ia64_set_kr(IA64_KR_TSSD, current->thread.old_k1);
-
-       error = compat_do_execve(filename, argv, envp, regs);
-       putname(filename);
-
-       if (error < 0) {
-               /* oops, execve failed, switch back to old values... */
-               ia64_set_kr(IA64_KR_IO_BASE, IA32_IOBASE);
-               ia64_set_kr(IA64_KR_TSSD, tssd);
-               current->thread.map_base  = old_map_base;
-               current->thread.task_size = old_task_size;
-       }
-
-       return error;
-}
-
-
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-
-
-static int
-get_page_prot (struct vm_area_struct *vma, unsigned long addr)
-{
-       int prot = 0;
-
-       if (!vma || vma->vm_start > addr)
-               return 0;
-
-       if (vma->vm_flags & VM_READ)
-               prot |= PROT_READ;
-       if (vma->vm_flags & VM_WRITE)
-               prot |= PROT_WRITE;
-       if (vma->vm_flags & VM_EXEC)
-               prot |= PROT_EXEC;
-       return prot;
-}
-
-/*
- * Map a subpage by creating an anonymous page that contains the union of the old page and
- * the subpage.
- */
-static unsigned long
-mmap_subpage (struct file *file, unsigned long start, unsigned long end, int prot, int flags,
-             loff_t off)
-{
-       void *page = NULL;
-       struct inode *inode;
-       unsigned long ret = 0;
-       struct vm_area_struct *vma = find_vma(current->mm, start);
-       int old_prot = get_page_prot(vma, start);
-
-       DBG("mmap_subpage(file=%p,start=0x%lx,end=0x%lx,prot=%x,flags=%x,off=0x%llx)\n",
-           file, start, end, prot, flags, off);
-
-
-       /* Optimize the case where the old mmap and the new mmap are both anonymous */
-       if ((old_prot & PROT_WRITE) && (flags & MAP_ANONYMOUS) && !vma->vm_file) {
-               if (clear_user((void __user *) start, end - start)) {
-                       ret = -EFAULT;
-                       goto out;
-               }
-               goto skip_mmap;
-       }
-
-       page = (void *) get_zeroed_page(GFP_KERNEL);
-       if (!page)
-               return -ENOMEM;
-
-       if (old_prot)
-               copy_from_user(page, (void __user *) PAGE_START(start), PAGE_SIZE);
-
-       down_write(&current->mm->mmap_sem);
-       {
-               ret = do_mmap(NULL, PAGE_START(start), PAGE_SIZE, prot | PROT_WRITE,
-                             flags | MAP_FIXED | MAP_ANONYMOUS, 0);
-       }
-       up_write(&current->mm->mmap_sem);
-
-       if (IS_ERR((void *) ret))
-               goto out;
-
-       if (old_prot) {
-               /* copy back the old page contents.  */
-               if (offset_in_page(start))
-                       copy_to_user((void __user *) PAGE_START(start), page,
-                                    offset_in_page(start));
-               if (offset_in_page(end))
-                       copy_to_user((void __user *) end, page + offset_in_page(end),
-                                    PAGE_SIZE - offset_in_page(end));
-       }
-
-       if (!(flags & MAP_ANONYMOUS)) {
-               /* read the file contents */
-               inode = file->f_path.dentry->d_inode;
-               if (!inode->i_fop || !file->f_op->read
-                   || ((*file->f_op->read)(file, (char __user *) start, end - start, &off) < 0))
-               {
-                       ret = -EINVAL;
-                       goto out;
-               }
-       }
-
- skip_mmap:
-       if (!(prot & PROT_WRITE))
-               ret = sys_mprotect(PAGE_START(start), PAGE_SIZE, prot | old_prot);
-  out:
-       if (page)
-               free_page((unsigned long) page);
-       return ret;
-}
-
-/* SLAB cache for ia64_partial_page structures */
-struct kmem_cache *ia64_partial_page_cachep;
-
-/*
- * init ia64_partial_page_list.
- * return 0 means kmalloc fail.
- */
-struct ia64_partial_page_list*
-ia32_init_pp_list(void)
-{
-       struct ia64_partial_page_list *p;
-
-       if ((p = kmalloc(sizeof(*p), GFP_KERNEL)) == NULL)
-               return p;
-       p->pp_head = NULL;
-       p->ppl_rb = RB_ROOT;
-       p->pp_hint = NULL;
-       atomic_set(&p->pp_count, 1);
-       return p;
-}
-
-/*
- * Search for the partial page with @start in partial page list @ppl.
- * If finds the partial page, return the found partial page.
- * Else, return 0 and provide @pprev, @rb_link, @rb_parent to
- * be used by later __ia32_insert_pp().
- */
-static struct ia64_partial_page *
-__ia32_find_pp(struct ia64_partial_page_list *ppl, unsigned int start,
-       struct ia64_partial_page **pprev, struct rb_node ***rb_link,
-       struct rb_node **rb_parent)
-{
-       struct ia64_partial_page *pp;
-       struct rb_node **__rb_link, *__rb_parent, *rb_prev;
-
-       pp = ppl->pp_hint;
-       if (pp && pp->base == start)
-               return pp;
-
-       __rb_link = &ppl->ppl_rb.rb_node;
-       rb_prev = __rb_parent = NULL;
-
-       while (*__rb_link) {
-               __rb_parent = *__rb_link;
-               pp = rb_entry(__rb_parent, struct ia64_partial_page, pp_rb);
-
-               if (pp->base == start) {
-                       ppl->pp_hint = pp;
-                       return pp;
-               } else if (pp->base < start) {
-                       rb_prev = __rb_parent;
-                       __rb_link = &__rb_parent->rb_right;
-               } else {
-                       __rb_link = &__rb_parent->rb_left;
-               }
-       }
-
-       *rb_link = __rb_link;
-       *rb_parent = __rb_parent;
-       *pprev = NULL;
-       if (rb_prev)
-               *pprev = rb_entry(rb_prev, struct ia64_partial_page, pp_rb);
-       return NULL;
-}
-
-/*
- * insert @pp into @ppl.
- */
-static void
-__ia32_insert_pp(struct ia64_partial_page_list *ppl,
-       struct ia64_partial_page *pp, struct ia64_partial_page *prev,
-       struct rb_node **rb_link, struct rb_node *rb_parent)
-{
-       /* link list */
-       if (prev) {
-               pp->next = prev->next;
-               prev->next = pp;
-       } else {
-               ppl->pp_head = pp;
-               if (rb_parent)
-                       pp->next = rb_entry(rb_parent,
-                               struct ia64_partial_page, pp_rb);
-               else
-                       pp->next = NULL;
-       }
-
-       /* link rb */
-       rb_link_node(&pp->pp_rb, rb_parent, rb_link);
-       rb_insert_color(&pp->pp_rb, &ppl->ppl_rb);
-
-       ppl->pp_hint = pp;
-}
-
-/*
- * delete @pp from partial page list @ppl.
- */
-static void
-__ia32_delete_pp(struct ia64_partial_page_list *ppl,
-       struct ia64_partial_page *pp, struct ia64_partial_page *prev)
-{
-       if (prev) {
-               prev->next = pp->next;
-               if (ppl->pp_hint == pp)
-                       ppl->pp_hint = prev;
-       } else {
-               ppl->pp_head = pp->next;
-               if (ppl->pp_hint == pp)
-                       ppl->pp_hint = pp->next;
-       }
-       rb_erase(&pp->pp_rb, &ppl->ppl_rb);
-       kmem_cache_free(ia64_partial_page_cachep, pp);
-}
-
-static struct ia64_partial_page *
-__pp_prev(struct ia64_partial_page *pp)
-{
-       struct rb_node *prev = rb_prev(&pp->pp_rb);
-       if (prev)
-               return rb_entry(prev, struct ia64_partial_page, pp_rb);
-       else
-               return NULL;
-}
-
-/*
- * Delete partial pages with address between @start and @end.
- * @start and @end are page aligned.
- */
-static void
-__ia32_delete_pp_range(unsigned int start, unsigned int end)
-{
-       struct ia64_partial_page *pp, *prev;
-       struct rb_node **rb_link, *rb_parent;
-
-       if (start >= end)
-               return;
-
-       pp = __ia32_find_pp(current->thread.ppl, start, &prev,
-                                       &rb_link, &rb_parent);
-       if (pp)
-               prev = __pp_prev(pp);
-       else {
-               if (prev)
-                       pp = prev->next;
-               else
-                       pp = current->thread.ppl->pp_head;
-       }
-
-       while (pp && pp->base < end) {
-               struct ia64_partial_page *tmp = pp->next;
-               __ia32_delete_pp(current->thread.ppl, pp, prev);
-               pp = tmp;
-       }
-}
-
-/*
- * Set the range between @start and @end in bitmap.
- * @start and @end should be IA32 page aligned and in the same IA64 page.
- */
-static int
-__ia32_set_pp(unsigned int start, unsigned int end, int flags)
-{
-       struct ia64_partial_page *pp, *prev;
-       struct rb_node ** rb_link, *rb_parent;
-       unsigned int pstart, start_bit, end_bit, i;
-
-       pstart = PAGE_START(start);
-       start_bit = (start % PAGE_SIZE) / IA32_PAGE_SIZE;
-       end_bit = (end % PAGE_SIZE) / IA32_PAGE_SIZE;
-       if (end_bit == 0)
-               end_bit = PAGE_SIZE / IA32_PAGE_SIZE;
-       pp = __ia32_find_pp(current->thread.ppl, pstart, &prev,
-                                       &rb_link, &rb_parent);
-       if (pp) {
-               for (i = start_bit; i < end_bit; i++)
-                       set_bit(i, &pp->bitmap);
-               /*
-                * Check: if this partial page has been set to a full page,
-                * then delete it.
-                */
-               if (find_first_zero_bit(&pp->bitmap, sizeof(pp->bitmap)*8) >=
-                               PAGE_SIZE/IA32_PAGE_SIZE) {
-                       __ia32_delete_pp(current->thread.ppl, pp, __pp_prev(pp));
-               }
-               return 0;
-       }
-
-       /*
-        * MAP_FIXED may lead to overlapping mmap.
-        * In this case, the requested mmap area may already mmaped as a full
-        * page. So check vma before adding a new partial page.
-        */
-       if (flags & MAP_FIXED) {
-               struct vm_area_struct *vma = find_vma(current->mm, pstart);
-               if (vma && vma->vm_start <= pstart)
-                       return 0;
-       }
-
-       /* new a ia64_partial_page */
-       pp = kmem_cache_alloc(ia64_partial_page_cachep, GFP_KERNEL);
-       if (!pp)
-               return -ENOMEM;
-       pp->base = pstart;
-       pp->bitmap = 0;
-       for (i=start_bit; i<end_bit; i++)
-               set_bit(i, &(pp->bitmap));
-       pp->next = NULL;
-       __ia32_insert_pp(current->thread.ppl, pp, prev, rb_link, rb_parent);
-       return 0;
-}
-
-/*
- * @start and @end should be IA32 page aligned, but don't need to be in the
- * same IA64 page. Split @start and @end to make sure they're in the same IA64
- * page, then call __ia32_set_pp().
- */
-static void
-ia32_set_pp(unsigned int start, unsigned int end, int flags)
-{
-       down_write(&current->mm->mmap_sem);
-       if (flags & MAP_FIXED) {
-               /*
-                * MAP_FIXED may lead to overlapping mmap. When this happens,
-                * a series of complete IA64 pages results in deletion of
-                * old partial pages in that range.
-                */
-               __ia32_delete_pp_range(PAGE_ALIGN(start), PAGE_START(end));
-       }
-
-       if (end < PAGE_ALIGN(start)) {
-               __ia32_set_pp(start, end, flags);
-       } else {
-               if (offset_in_page(start))
-                       __ia32_set_pp(start, PAGE_ALIGN(start), flags);
-               if (offset_in_page(end))
-                       __ia32_set_pp(PAGE_START(end), end, flags);
-       }
-       up_write(&current->mm->mmap_sem);
-}
-
-/*
- * Unset the range between @start and @end in bitmap.
- * @start and @end should be IA32 page aligned and in the same IA64 page.
- * After doing that, if the bitmap is 0, then free the page and return 1,
- *     else return 0;
- * If not find the partial page in the list, then
- *     If the vma exists, then the full page is set to a partial page;
- *     Else return -ENOMEM.
- */
-static int
-__ia32_unset_pp(unsigned int start, unsigned int end)
-{
-       struct ia64_partial_page *pp, *prev;
-       struct rb_node ** rb_link, *rb_parent;
-       unsigned int pstart, start_bit, end_bit, i;
-       struct vm_area_struct *vma;
-
-       pstart = PAGE_START(start);
-       start_bit = (start % PAGE_SIZE) / IA32_PAGE_SIZE;
-       end_bit = (end % PAGE_SIZE) / IA32_PAGE_SIZE;
-       if (end_bit == 0)
-               end_bit = PAGE_SIZE / IA32_PAGE_SIZE;
-
-       pp = __ia32_find_pp(current->thread.ppl, pstart, &prev,
-                                       &rb_link, &rb_parent);
-       if (pp) {
-               for (i = start_bit; i < end_bit; i++)
-                       clear_bit(i, &pp->bitmap);
-               if (pp->bitmap == 0) {
-                       __ia32_delete_pp(current->thread.ppl, pp, __pp_prev(pp));
-                       return 1;
-               }
-               return 0;
-       }
-
-       vma = find_vma(current->mm, pstart);
-       if (!vma || vma->vm_start > pstart) {
-               return -ENOMEM;
-       }
-
-       /* new a ia64_partial_page */
-       pp = kmem_cache_alloc(ia64_partial_page_cachep, GFP_KERNEL);
-       if (!pp)
-               return -ENOMEM;
-       pp->base = pstart;
-       pp->bitmap = 0;
-       for (i = 0; i < start_bit; i++)
-               set_bit(i, &(pp->bitmap));
-       for (i = end_bit; i < PAGE_SIZE / IA32_PAGE_SIZE; i++)
-               set_bit(i, &(pp->bitmap));
-       pp->next = NULL;
-       __ia32_insert_pp(current->thread.ppl, pp, prev, rb_link, rb_parent);
-       return 0;
-}
-
-/*
- * Delete pp between PAGE_ALIGN(start) and PAGE_START(end) by calling
- * __ia32_delete_pp_range(). Unset possible partial pages by calling
- * __ia32_unset_pp().
- * The returned value see __ia32_unset_pp().
- */
-static int
-ia32_unset_pp(unsigned int *startp, unsigned int *endp)
-{
-       unsigned int start = *startp, end = *endp;
-       int ret = 0;
-
-       down_write(&current->mm->mmap_sem);
-
-       __ia32_delete_pp_range(PAGE_ALIGN(start), PAGE_START(end));
-
-       if (end < PAGE_ALIGN(start)) {
-               ret = __ia32_unset_pp(start, end);
-               if (ret == 1) {
-                       *startp = PAGE_START(start);
-                       *endp = PAGE_ALIGN(end);
-               }
-               if (ret == 0) {
-                       /* to shortcut sys_munmap() in sys32_munmap() */
-                       *startp = PAGE_START(start);
-                       *endp = PAGE_START(end);
-               }
-       } else {
-               if (offset_in_page(start)) {
-                       ret = __ia32_unset_pp(start, PAGE_ALIGN(start));
-                       if (ret == 1)
-                               *startp = PAGE_START(start);
-                       if (ret == 0)
-                               *startp = PAGE_ALIGN(start);
-                       if (ret < 0)
-                               goto out;
-               }
-               if (offset_in_page(end)) {
-                       ret = __ia32_unset_pp(PAGE_START(end), end);
-                       if (ret == 1)
-                               *endp = PAGE_ALIGN(end);
-                       if (ret == 0)
-                               *endp = PAGE_START(end);
-               }
-       }
-
- out:
-       up_write(&current->mm->mmap_sem);
-       return ret;
-}
-
-/*
- * Compare the range between @start and @end with bitmap in partial page.
- * @start and @end should be IA32 page aligned and in the same IA64 page.
- */
-static int
-__ia32_compare_pp(unsigned int start, unsigned int end)
-{
-       struct ia64_partial_page *pp, *prev;
-       struct rb_node ** rb_link, *rb_parent;
-       unsigned int pstart, start_bit, end_bit, size;
-       unsigned int first_bit, next_zero_bit;  /* the first range in bitmap */
-
-       pstart = PAGE_START(start);
-
-       pp = __ia32_find_pp(current->thread.ppl, pstart, &prev,
-                                       &rb_link, &rb_parent);
-       if (!pp)
-               return 1;
-
-       start_bit = (start % PAGE_SIZE) / IA32_PAGE_SIZE;
-       end_bit = (end % PAGE_SIZE) / IA32_PAGE_SIZE;
-       size = sizeof(pp->bitmap) * 8;
-       first_bit = find_first_bit(&pp->bitmap, size);
-       next_zero_bit = find_next_zero_bit(&pp->bitmap, size, first_bit);
-       if ((start_bit < first_bit) || (end_bit > next_zero_bit)) {
-               /* exceeds the first range in bitmap */
-               return -ENOMEM;
-       } else if ((start_bit == first_bit) && (end_bit == next_zero_bit)) {
-               first_bit = find_next_bit(&pp->bitmap, size, next_zero_bit);
-               if ((next_zero_bit < first_bit) && (first_bit < size))
-                       return 1;       /* has next range */
-               else
-                       return 0;       /* no next range */
-       } else
-               return 1;
-}
-
-/*
- * @start and @end should be IA32 page aligned, but don't need to be in the
- * same IA64 page. Split @start and @end to make sure they're in the same IA64
- * page, then call __ia32_compare_pp().
- *
- * Take this as example: the range is the 1st and 2nd 4K page.
- * Return 0 if they fit bitmap exactly, i.e. bitmap = 00000011;
- * Return 1 if the range doesn't cover whole bitmap, e.g. bitmap = 00001111;
- * Return -ENOMEM if the range exceeds the bitmap, e.g. bitmap = 00000001 or
- *     bitmap = 00000101.
- */
-static int
-ia32_compare_pp(unsigned int *startp, unsigned int *endp)
-{
-       unsigned int start = *startp, end = *endp;
-       int retval = 0;
-
-       down_write(&current->mm->mmap_sem);
-
-       if (end < PAGE_ALIGN(start)) {
-               retval = __ia32_compare_pp(start, end);
-               if (retval == 0) {
-                       *startp = PAGE_START(start);
-                       *endp = PAGE_ALIGN(end);
-               }
-       } else {
-               if (offset_in_page(start)) {
-                       retval = __ia32_compare_pp(start,
-                                                  PAGE_ALIGN(start));
-                       if (retval == 0)
-                               *startp = PAGE_START(start);
-                       if (retval < 0)
-                               goto out;
-               }
-               if (offset_in_page(end)) {
-                       retval = __ia32_compare_pp(PAGE_START(end), end);
-                       if (retval == 0)
-                               *endp = PAGE_ALIGN(end);
-               }
-       }
-
- out:
-       up_write(&current->mm->mmap_sem);
-       return retval;
-}
-
-static void
-__ia32_drop_pp_list(struct ia64_partial_page_list *ppl)
-{
-       struct ia64_partial_page *pp = ppl->pp_head;
-
-       while (pp) {
-               struct ia64_partial_page *next = pp->next;
-               kmem_cache_free(ia64_partial_page_cachep, pp);
-               pp = next;
-       }
-
-       kfree(ppl);
-}
-
-void
-ia32_drop_ia64_partial_page_list(struct task_struct *task)
-{
-       struct ia64_partial_page_list* ppl = task->thread.ppl;
-
-       if (ppl && atomic_dec_and_test(&ppl->pp_count))
-               __ia32_drop_pp_list(ppl);
-}
-
-/*
- * Copy current->thread.ppl to ppl (already initialized).
- */
-static int
-__ia32_copy_pp_list(struct ia64_partial_page_list *ppl)
-{
-       struct ia64_partial_page *pp, *tmp, *prev;
-       struct rb_node **rb_link, *rb_parent;
-
-       ppl->pp_head = NULL;
-       ppl->pp_hint = NULL;
-       ppl->ppl_rb = RB_ROOT;
-       rb_link = &ppl->ppl_rb.rb_node;
-       rb_parent = NULL;
-       prev = NULL;
-
-       for (pp = current->thread.ppl->pp_head; pp; pp = pp->next) {
-               tmp = kmem_cache_alloc(ia64_partial_page_cachep, GFP_KERNEL);
-               if (!tmp)
-                       return -ENOMEM;
-               *tmp = *pp;
-               __ia32_insert_pp(ppl, tmp, prev, rb_link, rb_parent);
-               prev = tmp;
-               rb_link = &tmp->pp_rb.rb_right;
-               rb_parent = &tmp->pp_rb;
-       }
-       return 0;
-}
-
-int
-ia32_copy_ia64_partial_page_list(struct task_struct *p,
-                               unsigned long clone_flags)
-{
-       int retval = 0;
-
-       if (clone_flags & CLONE_VM) {
-               atomic_inc(&current->thread.ppl->pp_count);
-               p->thread.ppl = current->thread.ppl;
-       } else {
-               p->thread.ppl = ia32_init_pp_list();
-               if (!p->thread.ppl)
-                       return -ENOMEM;
-               down_write(&current->mm->mmap_sem);
-               {
-                       retval = __ia32_copy_pp_list(p->thread.ppl);
-               }
-               up_write(&current->mm->mmap_sem);
-       }
-
-       return retval;
-}
-
-static unsigned long
-emulate_mmap (struct file *file, unsigned long start, unsigned long len, int prot, int flags,
-             loff_t off)
-{
-       unsigned long tmp, end, pend, pstart, ret, is_congruent, fudge = 0;
-       struct inode *inode;
-       loff_t poff;
-
-       end = start + len;
-       pstart = PAGE_START(start);
-       pend = PAGE_ALIGN(end);
-
-       if (flags & MAP_FIXED) {
-               ia32_set_pp((unsigned int)start, (unsigned int)end, flags);
-               if (start > pstart) {
-                       if (flags & MAP_SHARED)
-                               printk(KERN_INFO
-                                      "%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n",
-                                      current->comm, task_pid_nr(current), start);
-                       ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags,
-                                          off);
-                       if (IS_ERR((void *) ret))
-                               return ret;
-                       pstart += PAGE_SIZE;
-                       if (pstart >= pend)
-                               goto out;       /* done */
-               }
-               if (end < pend) {
-                       if (flags & MAP_SHARED)
-                               printk(KERN_INFO
-                                      "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
-                                      current->comm, task_pid_nr(current), end);
-                       ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
-                                          (off + len) - offset_in_page(end));
-                       if (IS_ERR((void *) ret))
-                               return ret;
-                       pend -= PAGE_SIZE;
-                       if (pstart >= pend)
-                               goto out;       /* done */
-               }
-       } else {
-               /*
-                * If a start address was specified, use it if the entire rounded out area
-                * is available.
-                */
-               if (start && !pstart)
-                       fudge = 1;      /* handle case of mapping to range (0,PAGE_SIZE) */
-               tmp = arch_get_unmapped_area(file, pstart - fudge, pend - pstart, 0, flags);
-               if (tmp != pstart) {
-                       pstart = tmp;
-                       start = pstart + offset_in_page(off);   /* make start congruent with off */
-                       end = start + len;
-                       pend = PAGE_ALIGN(end);
-               }
-       }
-
-       poff = off + (pstart - start);  /* note: (pstart - start) may be negative */
-       is_congruent = (flags & MAP_ANONYMOUS) || (offset_in_page(poff) == 0);
-
-       if ((flags & MAP_SHARED) && !is_congruent)
-               printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
-                      "(addr=0x%lx,off=0x%llx)\n", current->comm, task_pid_nr(current), start, off);
-
-       DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend,
-           is_congruent ? "congruent" : "not congruent", poff);
-
-       down_write(&current->mm->mmap_sem);
-       {
-               if (!(flags & MAP_ANONYMOUS) && is_congruent)
-                       ret = do_mmap(file, pstart, pend - pstart, prot, flags | MAP_FIXED, poff);
-               else
-                       ret = do_mmap(NULL, pstart, pend - pstart,
-                                     prot | ((flags & MAP_ANONYMOUS) ? 0 : PROT_WRITE),
-                                     flags | MAP_FIXED | MAP_ANONYMOUS, 0);
-       }
-       up_write(&current->mm->mmap_sem);
-
-       if (IS_ERR((void *) ret))
-               return ret;
-
-       if (!is_congruent) {
-               /* read the file contents */
-               inode = file->f_path.dentry->d_inode;
-               if (!inode->i_fop || !file->f_op->read
-                   || ((*file->f_op->read)(file, (char __user *) pstart, pend - pstart, &poff)
-                       < 0))
-               {
-                       sys_munmap(pstart, pend - pstart);
-                       return -EINVAL;
-               }
-               if (!(prot & PROT_WRITE) && sys_mprotect(pstart, pend - pstart, prot) < 0)
-                       return -EINVAL;
-       }
-
-       if (!(flags & MAP_FIXED))
-               ia32_set_pp((unsigned int)start, (unsigned int)end, flags);
-out:
-       return start;
-}
-
-#endif /* PAGE_SHIFT > IA32_PAGE_SHIFT */
-
-static inline unsigned int
-get_prot32 (unsigned int prot)
-{
-       if (prot & PROT_WRITE)
-               /* on x86, PROT_WRITE implies PROT_READ which implies PROT_EEC */
-               prot |= PROT_READ | PROT_WRITE | PROT_EXEC;
-       else if (prot & (PROT_READ | PROT_EXEC))
-               /* on x86, there is no distinction between PROT_READ and PROT_EXEC */
-               prot |= (PROT_READ | PROT_EXEC);
-
-       return prot;
-}
-
-unsigned long
-ia32_do_mmap (struct file *file, unsigned long addr, unsigned long len, int prot, int flags,
-             loff_t offset)
-{
-       DBG("ia32_do_mmap(file=%p,addr=0x%lx,len=0x%lx,prot=%x,flags=%x,offset=0x%llx)\n",
-           file, addr, len, prot, flags, offset);
-
-       if (file && (!file->f_op || !file->f_op->mmap))
-               return -ENODEV;
-
-       len = IA32_PAGE_ALIGN(len);
-       if (len == 0)
-               return addr;
-
-       if (len > IA32_PAGE_OFFSET || addr > IA32_PAGE_OFFSET - len)
-       {
-               if (flags & MAP_FIXED)
-                       return -ENOMEM;
-               else
-               return -EINVAL;
-       }
-
-       if (OFFSET4K(offset))
-               return -EINVAL;
-
-       prot = get_prot32(prot);
-
-       if (flags & MAP_HUGETLB)
-               return -ENOMEM;
-
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-       mutex_lock(&ia32_mmap_mutex);
-       {
-               addr = emulate_mmap(file, addr, len, prot, flags, offset);
-       }
-       mutex_unlock(&ia32_mmap_mutex);
-#else
-       down_write(&current->mm->mmap_sem);
-       {
-               addr = do_mmap(file, addr, len, prot, flags, offset);
-       }
-       up_write(&current->mm->mmap_sem);
-#endif
-       DBG("ia32_do_mmap: returning 0x%lx\n", addr);
-       return addr;
-}
-
-/*
- * Linux/i386 didn't use to be able to handle more than 4 system call parameters, so these
- * system calls used a memory block for parameter passing..
- */
-
-struct mmap_arg_struct {
-       unsigned int addr;
-       unsigned int len;
-       unsigned int prot;
-       unsigned int flags;
-       unsigned int fd;
-       unsigned int offset;
-};
-
-asmlinkage long
-sys32_mmap (struct mmap_arg_struct __user *arg)
-{
-       struct mmap_arg_struct a;
-       struct file *file = NULL;
-       unsigned long addr;
-       int flags;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-
-       if (OFFSET4K(a.offset))
-               return -EINVAL;
-
-       flags = a.flags;
-
-       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-       if (!(flags & MAP_ANONYMOUS)) {
-               file = fget(a.fd);
-               if (!file)
-                       return -EBADF;
-       }
-
-       addr = ia32_do_mmap(file, a.addr, a.len, a.prot, flags, a.offset);
-
-       if (file)
-               fput(file);
-       return addr;
-}
-
-asmlinkage long
-sys32_mmap2 (unsigned int addr, unsigned int len, unsigned int prot, unsigned int flags,
-            unsigned int fd, unsigned int pgoff)
-{
-       struct file *file = NULL;
-       unsigned long retval;
-
-       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-       if (!(flags & MAP_ANONYMOUS)) {
-               file = fget(fd);
-               if (!file)
-                       return -EBADF;
-       }
-
-       retval = ia32_do_mmap(file, addr, len, prot, flags,
-                             (unsigned long) pgoff << IA32_PAGE_SHIFT);
-
-       if (file)
-               fput(file);
-       return retval;
-}
-
-asmlinkage long
-sys32_munmap (unsigned int start, unsigned int len)
-{
-       unsigned int end = start + len;
-       long ret;
-
-#if PAGE_SHIFT <= IA32_PAGE_SHIFT
-       ret = sys_munmap(start, end - start);
-#else
-       if (OFFSET4K(start))
-               return -EINVAL;
-
-       end = IA32_PAGE_ALIGN(end);
-       if (start >= end)
-               return -EINVAL;
-
-       ret = ia32_unset_pp(&start, &end);
-       if (ret < 0)
-               return ret;
-
-       if (start >= end)
-               return 0;
-
-       mutex_lock(&ia32_mmap_mutex);
-       ret = sys_munmap(start, end - start);
-       mutex_unlock(&ia32_mmap_mutex);
-#endif
-       return ret;
-}
-
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-
-/*
- * When mprotect()ing a partial page, we set the permission to the union of the old
- * settings and the new settings.  In other words, it's only possible to make access to a
- * partial page less restrictive.
- */
-static long
-mprotect_subpage (unsigned long address, int new_prot)
-{
-       int old_prot;
-       struct vm_area_struct *vma;
-
-       if (new_prot == PROT_NONE)
-               return 0;               /* optimize case where nothing changes... */
-       vma = find_vma(current->mm, address);
-       old_prot = get_page_prot(vma, address);
-       return sys_mprotect(address, PAGE_SIZE, new_prot | old_prot);
-}
-
-#endif /* PAGE_SHIFT > IA32_PAGE_SHIFT */
-
-asmlinkage long
-sys32_mprotect (unsigned int start, unsigned int len, int prot)
-{
-       unsigned int end = start + len;
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-       long retval = 0;
-#endif
-
-       prot = get_prot32(prot);
-
-#if PAGE_SHIFT <= IA32_PAGE_SHIFT
-       return sys_mprotect(start, end - start, prot);
-#else
-       if (OFFSET4K(start))
-               return -EINVAL;
-
-       end = IA32_PAGE_ALIGN(end);
-       if (end < start)
-               return -EINVAL;
-
-       retval = ia32_compare_pp(&start, &end);
-
-       if (retval < 0)
-               return retval;
-
-       mutex_lock(&ia32_mmap_mutex);
-       {
-               if (offset_in_page(start)) {
-                       /* start address is 4KB aligned but not page aligned. */
-                       retval = mprotect_subpage(PAGE_START(start), prot);
-                       if (retval < 0)
-                               goto out;
-
-                       start = PAGE_ALIGN(start);
-                       if (start >= end)
-                               goto out;       /* retval is already zero... */
-               }
-
-               if (offset_in_page(end)) {
-                       /* end address is 4KB aligned but not page aligned. */
-                       retval = mprotect_subpage(PAGE_START(end), prot);
-                       if (retval < 0)
-                               goto out;
-
-                       end = PAGE_START(end);
-               }
-               retval = sys_mprotect(start, end - start, prot);
-       }
-  out:
-       mutex_unlock(&ia32_mmap_mutex);
-       return retval;
-#endif
-}
-
-asmlinkage long
-sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len,
-               unsigned int flags, unsigned int new_addr)
-{
-       long ret;
-
-#if PAGE_SHIFT <= IA32_PAGE_SHIFT
-       ret = sys_mremap(addr, old_len, new_len, flags, new_addr);
-#else
-       unsigned int old_end, new_end;
-
-       if (OFFSET4K(addr))
-               return -EINVAL;
-
-       old_len = IA32_PAGE_ALIGN(old_len);
-       new_len = IA32_PAGE_ALIGN(new_len);
-       old_end = addr + old_len;
-       new_end = addr + new_len;
-
-       if (!new_len)
-               return -EINVAL;
-
-       if ((flags & MREMAP_FIXED) && (OFFSET4K(new_addr)))
-               return -EINVAL;
-
-       if (old_len >= new_len) {
-               ret = sys32_munmap(addr + new_len, old_len - new_len);
-               if (ret && old_len != new_len)
-                       return ret;
-               ret = addr;
-               if (!(flags & MREMAP_FIXED) || (new_addr == addr))
-                       return ret;
-               old_len = new_len;
-       }
-
-       addr = PAGE_START(addr);
-       old_len = PAGE_ALIGN(old_end) - addr;
-       new_len = PAGE_ALIGN(new_end) - addr;
-
-       mutex_lock(&ia32_mmap_mutex);
-       ret = sys_mremap(addr, old_len, new_len, flags, new_addr);
-       mutex_unlock(&ia32_mmap_mutex);
-
-       if ((ret >= 0) && (old_len < new_len)) {
-               /* mremap expanded successfully */
-               ia32_set_pp(old_end, new_end, flags);
-       }
-#endif
-       return ret;
-}
-
-asmlinkage unsigned long
-sys32_alarm (unsigned int seconds)
-{
-       return alarm_setitimer(seconds);
-}
-
-struct sel_arg_struct {
-       unsigned int n;
-       unsigned int inp;
-       unsigned int outp;
-       unsigned int exp;
-       unsigned int tvp;
-};
-
-asmlinkage long
-sys32_old_select (struct sel_arg_struct __user *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
-                                compat_ptr(a.exp), compat_ptr(a.tvp));
-}
-
-#define SEMOP           1
-#define SEMGET          2
-#define SEMCTL          3
-#define SEMTIMEDOP      4
-#define MSGSND         11
-#define MSGRCV         12
-#define MSGGET         13
-#define MSGCTL         14
-#define SHMAT          21
-#define SHMDT          22
-#define SHMGET         23
-#define SHMCTL         24
-
-asmlinkage long
-sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
-{
-       int version;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-             case SEMTIMEDOP:
-               if (fifth)
-                       return compat_sys_semtimedop(first, compat_ptr(ptr),
-                               second, compat_ptr(fifth));
-               /* else fall through for normal semop() */
-             case SEMOP:
-               /* struct sembuf is the same on 32 and 64bit :)) */
-               return sys_semtimedop(first, compat_ptr(ptr), second,
-                                     NULL);
-             case SEMGET:
-               return sys_semget(first, second, third);
-             case SEMCTL:
-               return compat_sys_semctl(first, second, third, compat_ptr(ptr));
-
-             case MSGSND:
-               return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
-             case MSGRCV:
-               return compat_sys_msgrcv(first, second, fifth, third, version, compat_ptr(ptr));
-             case MSGGET:
-               return sys_msgget((key_t) first, second);
-             case MSGCTL:
-               return compat_sys_msgctl(first, second, compat_ptr(ptr));
-
-             case SHMAT:
-               return compat_sys_shmat(first, second, third, version, compat_ptr(ptr));
-               break;
-             case SHMDT:
-               return sys_shmdt(compat_ptr(ptr));
-             case SHMGET:
-               return sys_shmget(first, (unsigned)second, third);
-             case SHMCTL:
-               return compat_sys_shmctl(first, second, compat_ptr(ptr));
-
-             default:
-               return -ENOSYS;
-       }
-       return -EINVAL;
-}
-
-asmlinkage long
-compat_sys_wait4 (compat_pid_t pid, compat_uint_t * stat_addr, int options,
-                struct compat_rusage *ru);
-
-asmlinkage long
-sys32_waitpid (int pid, unsigned int *stat_addr, int options)
-{
-       return compat_sys_wait4(pid, stat_addr, options, NULL);
-}
-
-/*
- *  The order in which registers are stored in the ptrace regs structure
- */
-#define PT_EBX 0
-#define PT_ECX 1
-#define PT_EDX 2
-#define PT_ESI 3
-#define PT_EDI 4
-#define PT_EBP 5
-#define PT_EAX 6
-#define PT_DS  7
-#define PT_ES  8
-#define PT_FS  9
-#define PT_GS  10
-#define PT_ORIG_EAX 11
-#define PT_EIP 12
-#define PT_CS  13
-#define PT_EFL 14
-#define PT_UESP        15
-#define PT_SS  16
-
-static unsigned int
-getreg (struct task_struct *child, int regno)
-{
-       struct pt_regs *child_regs;
-
-       child_regs = task_pt_regs(child);
-       switch (regno / sizeof(int)) {
-             case PT_EBX: return child_regs->r11;
-             case PT_ECX: return child_regs->r9;
-             case PT_EDX: return child_regs->r10;
-             case PT_ESI: return child_regs->r14;
-             case PT_EDI: return child_regs->r15;
-             case PT_EBP: return child_regs->r13;
-             case PT_EAX: return child_regs->r8;
-             case PT_ORIG_EAX: return child_regs->r1; /* see dispatch_to_ia32_handler() */
-             case PT_EIP: return child_regs->cr_iip;
-             case PT_UESP: return child_regs->r12;
-             case PT_EFL: return child->thread.eflag;
-             case PT_DS: case PT_ES: case PT_FS: case PT_GS: case PT_SS:
-               return __USER_DS;
-             case PT_CS: return __USER_CS;
-             default:
-               printk(KERN_ERR "ia32.getreg(): unknown register %d\n", regno);
-               break;
-       }
-       return 0;
-}
-
-static void
-putreg (struct task_struct *child, int regno, unsigned int value)
-{
-       struct pt_regs *child_regs;
-
-       child_regs = task_pt_regs(child);
-       switch (regno / sizeof(int)) {
-             case PT_EBX: child_regs->r11 = value; break;
-             case PT_ECX: child_regs->r9 = value; break;
-             case PT_EDX: child_regs->r10 = value; break;
-             case PT_ESI: child_regs->r14 = value; break;
-             case PT_EDI: child_regs->r15 = value; break;
-             case PT_EBP: child_regs->r13 = value; break;
-             case PT_EAX: child_regs->r8 = value; break;
-             case PT_ORIG_EAX: child_regs->r1 = value; break;
-             case PT_EIP: child_regs->cr_iip = value; break;
-             case PT_UESP: child_regs->r12 = value; break;
-             case PT_EFL: child->thread.eflag = value; break;
-             case PT_DS: case PT_ES: case PT_FS: case PT_GS: case PT_SS:
-               if (value != __USER_DS)
-                       printk(KERN_ERR
-                              "ia32.putreg: attempt to set invalid segment register %d = %x\n",
-                              regno, value);
-               break;
-             case PT_CS:
-               if (value != __USER_CS)
-                       printk(KERN_ERR
-                              "ia32.putreg: attempt to set invalid segment register %d = %x\n",
-                              regno, value);
-               break;
-             default:
-               printk(KERN_ERR "ia32.putreg: unknown register %d\n", regno);
-               break;
-       }
-}
-
-static void
-put_fpreg (int regno, struct _fpreg_ia32 __user *reg, struct pt_regs *ptp,
-          struct switch_stack *swp, int tos)
-{
-       struct _fpreg_ia32 *f;
-       char buf[32];
-
-       f = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
-       if ((regno += tos) >= 8)
-               regno -= 8;
-       switch (regno) {
-             case 0:
-               ia64f2ia32f(f, &ptp->f8);
-               break;
-             case 1:
-               ia64f2ia32f(f, &ptp->f9);
-               break;
-             case 2:
-               ia64f2ia32f(f, &ptp->f10);
-               break;
-             case 3:
-               ia64f2ia32f(f, &ptp->f11);
-               break;
-             case 4:
-             case 5:
-             case 6:
-             case 7:
-               ia64f2ia32f(f, &swp->f12 + (regno - 4));
-               break;
-       }
-       copy_to_user(reg, f, sizeof(*reg));
-}
-
-static void
-get_fpreg (int regno, struct _fpreg_ia32 __user *reg, struct pt_regs *ptp,
-          struct switch_stack *swp, int tos)
-{
-
-       if ((regno += tos) >= 8)
-               regno -= 8;
-       switch (regno) {
-             case 0:
-               copy_from_user(&ptp->f8, reg, sizeof(*reg));
-               break;
-             case 1:
-               copy_from_user(&ptp->f9, reg, sizeof(*reg));
-               break;
-             case 2:
-               copy_from_user(&ptp->f10, reg, sizeof(*reg));
-               break;
-             case 3:
-               copy_from_user(&ptp->f11, reg, sizeof(*reg));
-               break;
-             case 4:
-             case 5:
-             case 6:
-             case 7:
-               copy_from_user(&swp->f12 + (regno - 4), reg, sizeof(*reg));
-               break;
-       }
-       return;
-}
-
-int
-save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user *save)
-{
-       struct switch_stack *swp;
-       struct pt_regs *ptp;
-       int i, tos;
-
-       if (!access_ok(VERIFY_WRITE, save, sizeof(*save)))
-               return -EFAULT;
-
-       __put_user(tsk->thread.fcr & 0xffff, &save->cwd);
-       __put_user(tsk->thread.fsr & 0xffff, &save->swd);
-       __put_user((tsk->thread.fsr>>16) & 0xffff, &save->twd);
-       __put_user(tsk->thread.fir, &save->fip);
-       __put_user((tsk->thread.fir>>32) & 0xffff, &save->fcs);
-       __put_user(tsk->thread.fdr, &save->foo);
-       __put_user((tsk->thread.fdr>>32) & 0xffff, &save->fos);
-
-       /*
-        *  Stack frames start with 16-bytes of temp space
-        */
-       swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = task_pt_regs(tsk);
-       tos = (tsk->thread.fsr >> 11) & 7;
-       for (i = 0; i < 8; i++)
-               put_fpreg(i, &save->st_space[i], ptp, swp, tos);
-       return 0;
-}
-
-static int
-restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user *save)
-{
-       struct switch_stack *swp;
-       struct pt_regs *ptp;
-       int i, tos;
-       unsigned int fsrlo, fsrhi, num32;
-
-       if (!access_ok(VERIFY_READ, save, sizeof(*save)))
-               return(-EFAULT);
-
-       __get_user(num32, (unsigned int __user *)&save->cwd);
-       tsk->thread.fcr = (tsk->thread.fcr & (~0x1f3f)) | (num32 & 0x1f3f);
-       __get_user(fsrlo, (unsigned int __user *)&save->swd);
-       __get_user(fsrhi, (unsigned int __user *)&save->twd);
-       num32 = (fsrhi << 16) | fsrlo;
-       tsk->thread.fsr = (tsk->thread.fsr & (~0xffffffff)) | num32;
-       __get_user(num32, (unsigned int __user *)&save->fip);
-       tsk->thread.fir = (tsk->thread.fir & (~0xffffffff)) | num32;
-       __get_user(num32, (unsigned int __user *)&save->foo);
-       tsk->thread.fdr = (tsk->thread.fdr & (~0xffffffff)) | num32;
-
-       /*
-        *  Stack frames start with 16-bytes of temp space
-        */
-       swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = task_pt_regs(tsk);
-       tos = (tsk->thread.fsr >> 11) & 7;
-       for (i = 0; i < 8; i++)
-               get_fpreg(i, &save->st_space[i], ptp, swp, tos);
-       return 0;
-}
-
-int
-save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user *save)
-{
-       struct switch_stack *swp;
-       struct pt_regs *ptp;
-       int i, tos;
-       unsigned long mxcsr=0;
-       unsigned long num128[2];
-
-       if (!access_ok(VERIFY_WRITE, save, sizeof(*save)))
-               return -EFAULT;
-
-       __put_user(tsk->thread.fcr & 0xffff, &save->cwd);
-       __put_user(tsk->thread.fsr & 0xffff, &save->swd);
-       __put_user((tsk->thread.fsr>>16) & 0xffff, &save->twd);
-       __put_user(tsk->thread.fir, &save->fip);
-       __put_user((tsk->thread.fir>>32) & 0xffff, &save->fcs);
-       __put_user(tsk->thread.fdr, &save->foo);
-       __put_user((tsk->thread.fdr>>32) & 0xffff, &save->fos);
-
-        /*
-         *  Stack frames start with 16-bytes of temp space
-         */
-        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-        ptp = task_pt_regs(tsk);
-       tos = (tsk->thread.fsr >> 11) & 7;
-        for (i = 0; i < 8; i++)
-               put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
-
-       mxcsr = ((tsk->thread.fcr>>32) & 0xff80) | ((tsk->thread.fsr>>32) & 0x3f);
-       __put_user(mxcsr & 0xffff, &save->mxcsr);
-       for (i = 0; i < 8; i++) {
-               memcpy(&(num128[0]), &(swp->f16) + i*2, sizeof(unsigned long));
-               memcpy(&(num128[1]), &(swp->f17) + i*2, sizeof(unsigned long));
-               copy_to_user(&save->xmm_space[0] + 4*i, num128, sizeof(struct _xmmreg_ia32));
-       }
-       return 0;
-}
-
-static int
-restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user *save)
-{
-       struct switch_stack *swp;
-       struct pt_regs *ptp;
-       int i, tos;
-       unsigned int fsrlo, fsrhi, num32;
-       int mxcsr;
-       unsigned long num64;
-       unsigned long num128[2];
-
-       if (!access_ok(VERIFY_READ, save, sizeof(*save)))
-               return(-EFAULT);
-
-       __get_user(num32, (unsigned int __user *)&save->cwd);
-       tsk->thread.fcr = (tsk->thread.fcr & (~0x1f3f)) | (num32 & 0x1f3f);
-       __get_user(fsrlo, (unsigned int __user *)&save->swd);
-       __get_user(fsrhi, (unsigned int __user *)&save->twd);
-       num32 = (fsrhi << 16) | fsrlo;
-       tsk->thread.fsr = (tsk->thread.fsr & (~0xffffffff)) | num32;
-       __get_user(num32, (unsigned int __user *)&save->fip);
-       tsk->thread.fir = (tsk->thread.fir & (~0xffffffff)) | num32;
-       __get_user(num32, (unsigned int __user *)&save->foo);
-       tsk->thread.fdr = (tsk->thread.fdr & (~0xffffffff)) | num32;
-
-       /*
-        *  Stack frames start with 16-bytes of temp space
-        */
-       swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = task_pt_regs(tsk);
-       tos = (tsk->thread.fsr >> 11) & 7;
-       for (i = 0; i < 8; i++)
-       get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
-
-       __get_user(mxcsr, (unsigned int __user *)&save->mxcsr);
-       num64 = mxcsr & 0xff10;
-       tsk->thread.fcr = (tsk->thread.fcr & (~0xff1000000000UL)) | (num64<<32);
-       num64 = mxcsr & 0x3f;
-       tsk->thread.fsr = (tsk->thread.fsr & (~0x3f00000000UL)) | (num64<<32);
-
-       for (i = 0; i < 8; i++) {
-               copy_from_user(num128, &save->xmm_space[0] + 4*i, sizeof(struct _xmmreg_ia32));
-               memcpy(&(swp->f16) + i*2, &(num128[0]), sizeof(unsigned long));
-               memcpy(&(swp->f17) + i*2, &(num128[1]), sizeof(unsigned long));
-       }
-       return 0;
-}
-
-long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
-       compat_ulong_t caddr, compat_ulong_t cdata)
-{
-       unsigned long addr = caddr;
-       unsigned long data = cdata;
-       unsigned int tmp;
-       long i, ret;
-
-       switch (request) {
-             case PTRACE_PEEKUSR:      /* read word at addr in USER area */
-               ret = -EIO;
-               if ((addr & 3) || addr > 17*sizeof(int))
-                       break;
-
-               tmp = getreg(child, addr);
-               if (!put_user(tmp, (unsigned int __user *) compat_ptr(data)))
-                       ret = 0;
-               break;
-
-             case PTRACE_POKEUSR:      /* write word at addr in USER area */
-               ret = -EIO;
-               if ((addr & 3) || addr > 17*sizeof(int))
-                       break;
-
-               putreg(child, addr, data);
-               ret = 0;
-               break;
-
-             case IA32_PTRACE_GETREGS:
-               if (!access_ok(VERIFY_WRITE, compat_ptr(data), 17*sizeof(int))) {
-                       ret = -EIO;
-                       break;
-               }
-               for (i = 0; i < (int) (17*sizeof(int)); i += sizeof(int) ) {
-                       put_user(getreg(child, i), (unsigned int __user *) compat_ptr(data));
-                       data += sizeof(int);
-               }
-               ret = 0;
-               break;
-
-             case IA32_PTRACE_SETREGS:
-               if (!access_ok(VERIFY_READ, compat_ptr(data), 17*sizeof(int))) {
-                       ret = -EIO;
-                       break;
-               }
-               for (i = 0; i < (int) (17*sizeof(int)); i += sizeof(int) ) {
-                       get_user(tmp, (unsigned int __user *) compat_ptr(data));
-                       putreg(child, i, tmp);
-                       data += sizeof(int);
-               }
-               ret = 0;
-               break;
-
-             case IA32_PTRACE_GETFPREGS:
-               ret = save_ia32_fpstate(child, (struct ia32_user_i387_struct __user *)
-                                       compat_ptr(data));
-               break;
-
-             case IA32_PTRACE_GETFPXREGS:
-               ret = save_ia32_fpxstate(child, (struct ia32_user_fxsr_struct __user *)
-                                        compat_ptr(data));
-               break;
-
-             case IA32_PTRACE_SETFPREGS:
-               ret = restore_ia32_fpstate(child, (struct ia32_user_i387_struct __user *)
-                                          compat_ptr(data));
-               break;
-
-             case IA32_PTRACE_SETFPXREGS:
-               ret = restore_ia32_fpxstate(child, (struct ia32_user_fxsr_struct __user *)
-                                           compat_ptr(data));
-               break;
-
-             default:
-               return compat_ptrace_request(child, request, caddr, cdata);
-       }
-       return ret;
-}
-
-typedef struct {
-       unsigned int    ss_sp;
-       unsigned int    ss_flags;
-       unsigned int    ss_size;
-} ia32_stack_t;
-
-asmlinkage long
-sys32_sigaltstack (ia32_stack_t __user *uss32, ia32_stack_t __user *uoss32,
-                  long arg2, long arg3, long arg4, long arg5, long arg6,
-                  long arg7, struct pt_regs pt)
-{
-       stack_t uss, uoss;
-       ia32_stack_t buf32;
-       int ret;
-       mm_segment_t old_fs = get_fs();
-
-       if (uss32) {
-               if (copy_from_user(&buf32, uss32, sizeof(ia32_stack_t)))
-                       return -EFAULT;
-               uss.ss_sp = (void __user *) (long) buf32.ss_sp;
-               uss.ss_flags = buf32.ss_flags;
-               /* MINSIGSTKSZ is different for ia32 vs ia64. We lie here to pass the
-                  check and set it to the user requested value later */
-               if ((buf32.ss_flags != SS_DISABLE) && (buf32.ss_size < MINSIGSTKSZ_IA32)) {
-                       ret = -ENOMEM;
-                       goto out;
-               }
-               uss.ss_size = MINSIGSTKSZ;
-       }
-       set_fs(KERNEL_DS);
-       ret = do_sigaltstack(uss32 ? (stack_t __user *) &uss : NULL,
-                            (stack_t __user *) &uoss, pt.r12);
-       current->sas_ss_size = buf32.ss_size;
-       set_fs(old_fs);
-out:
-       if (ret < 0)
-               return(ret);
-       if (uoss32) {
-               buf32.ss_sp = (long __user) uoss.ss_sp;
-               buf32.ss_flags = uoss.ss_flags;
-               buf32.ss_size = uoss.ss_size;
-               if (copy_to_user(uoss32, &buf32, sizeof(ia32_stack_t)))
-                       return -EFAULT;
-       }
-       return ret;
-}
-
-asmlinkage int
-sys32_msync (unsigned int start, unsigned int len, int flags)
-{
-       unsigned int addr;
-
-       if (OFFSET4K(start))
-               return -EINVAL;
-       addr = PAGE_START(start);
-       return sys_msync(addr, len + (start - addr), flags);
-}
-
-asmlinkage long
-sys32_newuname (struct new_utsname __user *name)
-{
-       int ret = sys_newuname(name);
-
-       if (!ret)
-               if (copy_to_user(name->machine, "i686\0\0\0", 8))
-                       ret = -EFAULT;
-       return ret;
-}
-
-asmlinkage long
-sys32_getresuid16 (u16 __user *ruid, u16 __user *euid, u16 __user *suid)
-{
-       uid_t a, b, c;
-       int ret;
-       mm_segment_t old_fs = get_fs();
-
-       set_fs(KERNEL_DS);
-       ret = sys_getresuid((uid_t __user *) &a, (uid_t __user *) &b, (uid_t __user *) &c);
-       set_fs(old_fs);
-
-       if (put_user(a, ruid) || put_user(b, euid) || put_user(c, suid))
-               return -EFAULT;
-       return ret;
-}
-
-asmlinkage long
-sys32_getresgid16 (u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
-{
-       gid_t a, b, c;
-       int ret;
-       mm_segment_t old_fs = get_fs();
-
-       set_fs(KERNEL_DS);
-       ret = sys_getresgid((gid_t __user *) &a, (gid_t __user *) &b, (gid_t __user *) &c);
-       set_fs(old_fs);
-
-       if (ret)
-               return ret;
-
-       return put_user(a, rgid) | put_user(b, egid) | put_user(c, sgid);
-}
-
-asmlinkage long
-sys32_lseek (unsigned int fd, int offset, unsigned int whence)
-{
-       /* Sign-extension of "offset" is important here... */
-       return sys_lseek(fd, offset, whence);
-}
-
-static int
-groups16_to_user(short __user *grouplist, struct group_info *group_info)
-{
-       int i;
-       short group;
-
-       for (i = 0; i < group_info->ngroups; i++) {
-               group = (short)GROUP_AT(group_info, i);
-               if (put_user(group, grouplist+i))
-                       return -EFAULT;
-       }
-
-       return 0;
-}
-
-static int
-groups16_from_user(struct group_info *group_info, short __user *grouplist)
-{
-       int i;
-       short group;
-
-       for (i = 0; i < group_info->ngroups; i++) {
-               if (get_user(group, grouplist+i))
-                       return  -EFAULT;
-               GROUP_AT(group_info, i) = (gid_t)group;
-       }
-
-       return 0;
-}
-
-asmlinkage long
-sys32_getgroups16 (int gidsetsize, short __user *grouplist)
-{
-       const struct cred *cred = current_cred();
-       int i;
-
-       if (gidsetsize < 0)
-               return -EINVAL;
-
-       i = cred->group_info->ngroups;
-       if (gidsetsize) {
-               if (i > gidsetsize) {
-                       i = -EINVAL;
-                       goto out;
-               }
-               if (groups16_to_user(grouplist, cred->group_info)) {
-                       i = -EFAULT;
-                       goto out;
-               }
-       }
-out:
-       return i;
-}
-
-asmlinkage long
-sys32_setgroups16 (int gidsetsize, short __user *grouplist)
-{
-       struct group_info *group_info;
-       int retval;
-
-       if (!capable(CAP_SETGID))
-               return -EPERM;
-       if ((unsigned)gidsetsize > NGROUPS_MAX)
-               return -EINVAL;
-
-       group_info = groups_alloc(gidsetsize);
-       if (!group_info)
-               return -ENOMEM;
-       retval = groups16_from_user(group_info, grouplist);
-       if (retval) {
-               put_group_info(group_info);
-               return retval;
-       }
-
-       retval = set_current_groups(group_info);
-       put_group_info(group_info);
-
-       return retval;
-}
-
-asmlinkage long
-sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi)
-{
-       return sys_truncate(compat_ptr(path), ((unsigned long) len_hi << 32) | len_lo);
-}
-
-asmlinkage long
-sys32_ftruncate64 (int fd, unsigned int len_lo, unsigned int len_hi)
-{
-       return sys_ftruncate(fd, ((unsigned long) len_hi << 32) | len_lo);
-}
-
-static int
-putstat64 (struct stat64 __user *ubuf, struct kstat *kbuf)
-{
-       int err;
-       u64 hdev;
-
-       if (clear_user(ubuf, sizeof(*ubuf)))
-               return -EFAULT;
-
-       hdev = huge_encode_dev(kbuf->dev);
-       err  = __put_user(hdev, (u32 __user*)&ubuf->st_dev);
-       err |= __put_user(hdev >> 32, ((u32 __user*)&ubuf->st_dev) + 1);
-       err |= __put_user(kbuf->ino, &ubuf->__st_ino);
-       err |= __put_user(kbuf->ino, &ubuf->st_ino_lo);
-       err |= __put_user(kbuf->ino >> 32, &ubuf->st_ino_hi);
-       err |= __put_user(kbuf->mode, &ubuf->st_mode);
-       err |= __put_user(kbuf->nlink, &ubuf->st_nlink);
-       err |= __put_user(kbuf->uid, &ubuf->st_uid);
-       err |= __put_user(kbuf->gid, &ubuf->st_gid);
-       hdev = huge_encode_dev(kbuf->rdev);
-       err  = __put_user(hdev, (u32 __user*)&ubuf->st_rdev);
-       err |= __put_user(hdev >> 32, ((u32 __user*)&ubuf->st_rdev) + 1);
-       err |= __put_user(kbuf->size, &ubuf->st_size_lo);
-       err |= __put_user((kbuf->size >> 32), &ubuf->st_size_hi);
-       err |= __put_user(kbuf->atime.tv_sec, &ubuf->st_atime);
-       err |= __put_user(kbuf->atime.tv_nsec, &ubuf->st_atime_nsec);
-       err |= __put_user(kbuf->mtime.tv_sec, &ubuf->st_mtime);
-       err |= __put_user(kbuf->mtime.tv_nsec, &ubuf->st_mtime_nsec);
-       err |= __put_user(kbuf->ctime.tv_sec, &ubuf->st_ctime);
-       err |= __put_user(kbuf->ctime.tv_nsec, &ubuf->st_ctime_nsec);
-       err |= __put_user(kbuf->blksize, &ubuf->st_blksize);
-       err |= __put_user(kbuf->blocks, &ubuf->st_blocks);
-       return err;
-}
-
-asmlinkage long
-sys32_stat64 (char __user *filename, struct stat64 __user *statbuf)
-{
-       struct kstat s;
-       long ret = vfs_stat(filename, &s);
-       if (!ret)
-               ret = putstat64(statbuf, &s);
-       return ret;
-}
-
-asmlinkage long
-sys32_lstat64 (char __user *filename, struct stat64 __user *statbuf)
-{
-       struct kstat s;
-       long ret = vfs_lstat(filename, &s);
-       if (!ret)
-               ret = putstat64(statbuf, &s);
-       return ret;
-}
-
-asmlinkage long
-sys32_fstat64 (unsigned int fd, struct stat64 __user *statbuf)
-{
-       struct kstat s;
-       long ret = vfs_fstat(fd, &s);
-       if (!ret)
-               ret = putstat64(statbuf, &s);
-       return ret;
-}
-
-asmlinkage long
-sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec __user *interval)
-{
-       mm_segment_t old_fs = get_fs();
-       struct timespec t;
-       long ret;
-
-       set_fs(KERNEL_DS);
-       ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t);
-       set_fs(old_fs);
-       if (put_compat_timespec(&t, interval))
-               return -EFAULT;
-       return ret;
-}
-
-asmlinkage long
-sys32_pread (unsigned int fd, void __user *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
-{
-       return sys_pread64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
-}
-
-asmlinkage long
-sys32_pwrite (unsigned int fd, void __user *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
-{
-       return sys_pwrite64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
-}
-
-asmlinkage long
-sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count)
-{
-       mm_segment_t old_fs = get_fs();
-       long ret;
-       off_t of;
-
-       if (offset && get_user(of, offset))
-               return -EFAULT;
-
-       set_fs(KERNEL_DS);
-       ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count);
-       set_fs(old_fs);
-
-       if (offset && put_user(of, offset))
-               return -EFAULT;
-
-       return ret;
-}
-
-asmlinkage long
-sys32_personality (unsigned int personality)
-{
-       long ret;
-
-       if (current->personality == PER_LINUX32 && personality == PER_LINUX)
-               personality = PER_LINUX32;
-       ret = sys_personality(personality);
-       if (ret == PER_LINUX32)
-               ret = PER_LINUX;
-       return ret;
-}
-
-asmlinkage unsigned long
-sys32_brk (unsigned int brk)
-{
-       unsigned long ret, obrk;
-       struct mm_struct *mm = current->mm;
-
-       obrk = mm->brk;
-       ret = sys_brk(brk);
-       if (ret < obrk)
-               clear_user(compat_ptr(ret), PAGE_ALIGN(ret) - ret);
-       return ret;
-}
-
-/* Structure for ia32 emulation on ia64 */
-struct epoll_event32
-{
-       u32 events;
-       u32 data[2];
-};
-
-asmlinkage long
-sys32_epoll_ctl(int epfd, int op, int fd, struct epoll_event32 __user *event)
-{
-       mm_segment_t old_fs = get_fs();
-       struct epoll_event event64;
-       int error;
-       u32 data_halfword;
-
-       if (!access_ok(VERIFY_READ, event, sizeof(struct epoll_event32)))
-               return -EFAULT;
-
-       __get_user(event64.events, &event->events);
-       __get_user(data_halfword, &event->data[0]);
-       event64.data = data_halfword;
-       __get_user(data_halfword, &event->data[1]);
-       event64.data |= (u64)data_halfword << 32;
-
-       set_fs(KERNEL_DS);
-       error = sys_epoll_ctl(epfd, op, fd, (struct epoll_event __user *) &event64);
-       set_fs(old_fs);
-
-       return error;
-}
-
-asmlinkage long
-sys32_epoll_wait(int epfd, struct epoll_event32 __user * events, int maxevents,
-                int timeout)
-{
-       struct epoll_event *events64 = NULL;
-       mm_segment_t old_fs = get_fs();
-       int numevents, size;
-       int evt_idx;
-       int do_free_pages = 0;
-
-       if (maxevents <= 0) {
-               return -EINVAL;
-       }
-
-       /* Verify that the area passed by the user is writeable */
-       if (!access_ok(VERIFY_WRITE, events, maxevents * sizeof(struct epoll_event32)))
-               return -EFAULT;
-
-       /*
-        * Allocate space for the intermediate copy.  If the space needed
-        * is large enough to cause kmalloc to fail, then try again with
-        * __get_free_pages.
-        */
-       size = maxevents * sizeof(struct epoll_event);
-       events64 = kmalloc(size, GFP_KERNEL);
-       if (events64 == NULL) {
-               events64 = (struct epoll_event *)
-                               __get_free_pages(GFP_KERNEL, get_order(size));
-               if (events64 == NULL)
-                       return -ENOMEM;
-               do_free_pages = 1;
-       }
-
-       /* Do the system call */
-       set_fs(KERNEL_DS); /* copy_to/from_user should work on kernel mem*/
-       numevents = sys_epoll_wait(epfd, (struct epoll_event __user *) events64,
-                                  maxevents, timeout);
-       set_fs(old_fs);
-
-       /* Don't modify userspace memory if we're returning an error */
-       if (numevents > 0) {
-               /* Translate the 64-bit structures back into the 32-bit
-                  structures */
-               for (evt_idx = 0; evt_idx < numevents; evt_idx++) {
-                       __put_user(events64[evt_idx].events,
-                                  &events[evt_idx].events);
-                       __put_user((u32)events64[evt_idx].data,
-                                  &events[evt_idx].data[0]);
-                       __put_user((u32)(events64[evt_idx].data >> 32),
-                                  &events[evt_idx].data[1]);
-               }
-       }
-
-       if (do_free_pages)
-               free_pages((unsigned long) events64, get_order(size));
-       else
-               kfree(events64);
-       return numevents;
-}
-
-/*
- * Get a yet unused TLS descriptor index.
- */
-static int
-get_free_idx (void)
-{
-       struct thread_struct *t = &current->thread;
-       int idx;
-
-       for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++)
-               if (desc_empty(t->tls_array + idx))
-                       return idx + GDT_ENTRY_TLS_MIN;
-       return -ESRCH;
-}
-
-static void set_tls_desc(struct task_struct *p, int idx,
-               const struct ia32_user_desc *info, int n)
-{
-       struct thread_struct *t = &p->thread;
-       struct desc_struct *desc = &t->tls_array[idx - GDT_ENTRY_TLS_MIN];
-       int cpu;
-
-       /*
-        * We must not get preempted while modifying the TLS.
-        */
-       cpu = get_cpu();
-
-       while (n-- > 0) {
-               if (LDT_empty(info)) {
-                       desc->a = 0;
-                       desc->b = 0;
-               } else {
-                       desc->a = LDT_entry_a(info);
-                       desc->b = LDT_entry_b(info);
-               }
-
-               ++info;
-               ++desc;
-       }
-
-       if (t == &current->thread)
-               load_TLS(t, cpu);
-
-       put_cpu();
-}
-
-/*
- * Set a given TLS descriptor:
- */
-asmlinkage int
-sys32_set_thread_area (struct ia32_user_desc __user *u_info)
-{
-       struct ia32_user_desc info;
-       int idx;
-
-       if (copy_from_user(&info, u_info, sizeof(info)))
-               return -EFAULT;
-       idx = info.entry_number;
-
-       /*
-        * index -1 means the kernel should try to find and allocate an empty descriptor:
-        */
-       if (idx == -1) {
-               idx = get_free_idx();
-               if (idx < 0)
-                       return idx;
-               if (put_user(idx, &u_info->entry_number))
-                       return -EFAULT;
-       }
-
-       if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
-               return -EINVAL;
-
-       set_tls_desc(current, idx, &info, 1);
-       return 0;
-}
-
-/*
- * Get the current Thread-Local Storage area:
- */
-
-#define GET_BASE(desc) (                       \
-       (((desc)->a >> 16) & 0x0000ffff) |      \
-       (((desc)->b << 16) & 0x00ff0000) |      \
-       ( (desc)->b        & 0xff000000)   )
-
-#define GET_LIMIT(desc) (                      \
-       ((desc)->a & 0x0ffff) |                 \
-        ((desc)->b & 0xf0000) )
-
-#define GET_32BIT(desc)                (((desc)->b >> 22) & 1)
-#define GET_CONTENTS(desc)     (((desc)->b >> 10) & 3)
-#define GET_WRITABLE(desc)     (((desc)->b >>  9) & 1)
-#define GET_LIMIT_PAGES(desc)  (((desc)->b >> 23) & 1)
-#define GET_PRESENT(desc)      (((desc)->b >> 15) & 1)
-#define GET_USEABLE(desc)      (((desc)->b >> 20) & 1)
-
-static void fill_user_desc(struct ia32_user_desc *info, int idx,
-               const struct desc_struct *desc)
-{
-       info->entry_number = idx;
-       info->base_addr = GET_BASE(desc);
-       info->limit = GET_LIMIT(desc);
-       info->seg_32bit = GET_32BIT(desc);
-       info->contents = GET_CONTENTS(desc);
-       info->read_exec_only = !GET_WRITABLE(desc);
-       info->limit_in_pages = GET_LIMIT_PAGES(desc);
-       info->seg_not_present = !GET_PRESENT(desc);
-       info->useable = GET_USEABLE(desc);
-}
-
-asmlinkage int
-sys32_get_thread_area (struct ia32_user_desc __user *u_info)
-{
-       struct ia32_user_desc info;
-       struct desc_struct *desc;
-       int idx;
-
-       if (get_user(idx, &u_info->entry_number))
-               return -EFAULT;
-       if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
-               return -EINVAL;
-
-       desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
-       fill_user_desc(&info, idx, desc);
-
-       if (copy_to_user(u_info, &info, sizeof(info)))
-               return -EFAULT;
-       return 0;
-}
-
-struct regset_get {
-       void *kbuf;
-       void __user *ubuf;
-};
-
-struct regset_set {
-       const void *kbuf;
-       const void __user *ubuf;
-};
-
-struct regset_getset {
-       struct task_struct *target;
-       const struct user_regset *regset;
-       union {
-               struct regset_get get;
-               struct regset_set set;
-       } u;
-       unsigned int pos;
-       unsigned int count;
-       int ret;
-};
-
-static void getfpreg(struct task_struct *task, int regno, int *val)
-{
-       switch (regno / sizeof(int)) {
-       case 0:
-               *val = task->thread.fcr & 0xffff;
-               break;
-       case 1:
-               *val = task->thread.fsr & 0xffff;
-               break;
-       case 2:
-               *val = (task->thread.fsr>>16) & 0xffff;
-               break;
-       case 3:
-               *val = task->thread.fir;
-               break;
-       case 4:
-               *val = (task->thread.fir>>32) & 0xffff;
-               break;
-       case 5:
-               *val = task->thread.fdr;
-               break;
-       case 6:
-               *val = (task->thread.fdr >> 32) & 0xffff;
-               break;
-       }
-}
-
-static void setfpreg(struct task_struct *task, int regno, int val)
-{
-       switch (regno / sizeof(int)) {
-       case 0:
-               task->thread.fcr = (task->thread.fcr & (~0x1f3f))
-                       | (val & 0x1f3f);
-               break;
-       case 1:
-               task->thread.fsr = (task->thread.fsr & (~0xffff)) | val;
-               break;
-       case 2:
-               task->thread.fsr = (task->thread.fsr & (~0xffff0000))
-                       | (val << 16);
-               break;
-       case 3:
-               task->thread.fir = (task->thread.fir & (~0xffffffff)) | val;
-               break;
-       case 5:
-               task->thread.fdr = (task->thread.fdr & (~0xffffffff)) | val;
-               break;
-       }
-}
-
-static void access_fpreg_ia32(int regno, void *reg,
-               struct pt_regs *pt, struct switch_stack *sw,
-               int tos, int write)
-{
-       void *f;
-
-       if ((regno += tos) >= 8)
-               regno -= 8;
-       if (regno < 4)
-               f = &pt->f8 + regno;
-       else if (regno <= 7)
-               f = &sw->f12 + (regno - 4);
-       else {
-               printk(KERN_ERR "regno must be less than 7 \n");
-                return;
-       }
-
-       if (write)
-               memcpy(f, reg, sizeof(struct _fpreg_ia32));
-       else
-               memcpy(reg, f, sizeof(struct _fpreg_ia32));
-}
-
-static void do_fpregs_get(struct unw_frame_info *info, void *arg)
-{
-       struct regset_getset *dst = arg;
-       struct task_struct *task = dst->target;
-       struct pt_regs *pt;
-       int start, end, tos;
-       char buf[80];
-
-       if (dst->count == 0 || unw_unwind_to_user(info) < 0)
-               return;
-       if (dst->pos < 7 * sizeof(int)) {
-               end = min((dst->pos + dst->count),
-                       (unsigned int)(7 * sizeof(int)));
-               for (start = dst->pos; start < end; start += sizeof(int))
-                       getfpreg(task, start, (int *)(buf + start));
-               dst->ret = user_regset_copyout(&dst->pos, &dst->count,
-                               &dst->u.get.kbuf, &dst->u.get.ubuf, buf,
-                               0, 7 * sizeof(int));
-               if (dst->ret || dst->count == 0)
-                       return;
-       }
-       if (dst->pos < sizeof(struct ia32_user_i387_struct)) {
-               pt = task_pt_regs(task);
-               tos = (task->thread.fsr >> 11) & 7;
-               end = min(dst->pos + dst->count,
-                       (unsigned int)(sizeof(struct ia32_user_i387_struct)));
-               start = (dst->pos - 7 * sizeof(int)) /
-                       sizeof(struct _fpreg_ia32);
-               end = (end - 7 * sizeof(int)) / sizeof(struct _fpreg_ia32);
-               for (; start < end; start++)
-                       access_fpreg_ia32(start,
-                               (struct _fpreg_ia32 *)buf + start,
-                               pt, info->sw, tos, 0);
-               dst->ret = user_regset_copyout(&dst->pos, &dst->count,
-                               &dst->u.get.kbuf, &dst->u.get.ubuf,
-                               buf, 7 * sizeof(int),
-                               sizeof(struct ia32_user_i387_struct));
-               if (dst->ret || dst->count == 0)
-                       return;
-       }
-}
-
-static void do_fpregs_set(struct unw_frame_info *info, void *arg)
-{
-       struct regset_getset *dst = arg;
-       struct task_struct *task = dst->target;
-       struct pt_regs *pt;
-       char buf[80];
-       int end, start, tos;
-
-       if (dst->count == 0 || unw_unwind_to_user(info) < 0)
-               return;
-
-       if (dst->pos < 7 * sizeof(int)) {
-               start = dst->pos;
-               dst->ret = user_regset_copyin(&dst->pos, &dst->count,
-                               &dst->u.set.kbuf, &dst->u.set.ubuf, buf,
-                               0, 7 * sizeof(int));
-               if (dst->ret)
-                       return;
-               for (; start < dst->pos; start += sizeof(int))
-                       setfpreg(task, start, *((int *)(buf + start)));
-               if (dst->count == 0)
-                       return;
-       }
-       if (dst->pos < sizeof(struct ia32_user_i387_struct)) {
-               start = (dst->pos - 7 * sizeof(int)) /
-                       sizeof(struct _fpreg_ia32);
-               dst->ret = user_regset_copyin(&dst->pos, &dst->count,
-                               &dst->u.set.kbuf, &dst->u.set.ubuf,
-                               buf, 7 * sizeof(int),
-                               sizeof(struct ia32_user_i387_struct));
-               if (dst->ret)
-                       return;
-               pt = task_pt_regs(task);
-               tos = (task->thread.fsr >> 11) & 7;
-               end = (dst->pos - 7 * sizeof(int)) / sizeof(struct _fpreg_ia32);
-               for (; start < end; start++)
-                       access_fpreg_ia32(start,
-                               (struct _fpreg_ia32 *)buf + start,
-                               pt, info->sw, tos, 1);
-               if (dst->count == 0)
-                       return;
-       }
-}
-
-#define OFFSET(member) ((int)(offsetof(struct ia32_user_fxsr_struct, member)))
-static void getfpxreg(struct task_struct *task, int start, int end, char *buf)
-{
-       int min_val;
-
-       min_val = min(end, OFFSET(fop));
-       while (start < min_val) {
-               if (start == OFFSET(cwd))
-                       *((short *)buf) = task->thread.fcr & 0xffff;
-               else if (start == OFFSET(swd))
-                       *((short *)buf) = task->thread.fsr & 0xffff;
-               else if (start == OFFSET(twd))
-                       *((short *)buf) = (task->thread.fsr>>16) & 0xffff;
-               buf += 2;
-               start += 2;
-       }
-       /* skip fop element */
-       if (start == OFFSET(fop)) {
-               start += 2;
-               buf += 2;
-       }
-       while (start < end) {
-               if (start == OFFSET(fip))
-                       *((int *)buf) = task->thread.fir;
-               else if (start == OFFSET(fcs))
-                       *((int *)buf) = (task->thread.fir>>32) & 0xffff;
-               else if (start == OFFSET(foo))
-                       *((int *)buf) = task->thread.fdr;
-               else if (start == OFFSET(fos))
-                       *((int *)buf) = (task->thread.fdr>>32) & 0xffff;
-               else if (start == OFFSET(mxcsr))
-                       *((int *)buf) = ((task->thread.fcr>>32) & 0xff80)
-                                        | ((task->thread.fsr>>32) & 0x3f);
-               buf += 4;
-               start += 4;
-       }
-}
-
-static void setfpxreg(struct task_struct *task, int start, int end, char *buf)
-{
-       int min_val, num32;
-       short num;
-       unsigned long num64;
-
-       min_val = min(end, OFFSET(fop));
-       while (start < min_val) {
-               num = *((short *)buf);
-               if (start == OFFSET(cwd)) {
-                       task->thread.fcr = (task->thread.fcr & (~0x1f3f))
-                                               | (num & 0x1f3f);
-               } else if (start == OFFSET(swd)) {
-                       task->thread.fsr = (task->thread.fsr & (~0xffff)) | num;
-               } else if (start == OFFSET(twd)) {
-                       task->thread.fsr = (task->thread.fsr & (~0xffff0000))
-                               | (((int)num) << 16);
-               }
-               buf += 2;
-               start += 2;
-       }
-       /* skip fop element */
-       if (start == OFFSET(fop)) {
-               start += 2;
-               buf += 2;
-       }
-       while (start < end) {
-               num32 = *((int *)buf);
-               if (start == OFFSET(fip))
-                       task->thread.fir = (task->thread.fir & (~0xffffffff))
-                                                | num32;
-               else if (start == OFFSET(foo))
-                       task->thread.fdr = (task->thread.fdr & (~0xffffffff))
-                                                | num32;
-               else if (start == OFFSET(mxcsr)) {
-                       num64 = num32 & 0xff10;
-                       task->thread.fcr = (task->thread.fcr &
-                               (~0xff1000000000UL)) | (num64<<32);
-                       num64 = num32 & 0x3f;
-                       task->thread.fsr = (task->thread.fsr &
-                               (~0x3f00000000UL)) | (num64<<32);
-               }
-               buf += 4;
-               start += 4;
-       }
-}
-
-static void do_fpxregs_get(struct unw_frame_info *info, void *arg)
-{
-       struct regset_getset *dst = arg;
-       struct task_struct *task = dst->target;
-       struct pt_regs *pt;
-       char buf[128];
-       int start, end, tos;
-
-       if (dst->count == 0 || unw_unwind_to_user(info) < 0)
-               return;
-       if (dst->pos < OFFSET(st_space[0])) {
-               end = min(dst->pos + dst->count, (unsigned int)32);
-               getfpxreg(task, dst->pos, end, buf);
-               dst->ret = user_regset_copyout(&dst->pos, &dst->count,
-                               &dst->u.get.kbuf, &dst->u.get.ubuf, buf,
-                               0, OFFSET(st_space[0]));
-               if (dst->ret || dst->count == 0)
-                       return;
-       }
-       if (dst->pos < OFFSET(xmm_space[0])) {
-               pt = task_pt_regs(task);
-               tos = (task->thread.fsr >> 11) & 7;
-               end = min(dst->pos + dst->count,
-                               (unsigned int)OFFSET(xmm_space[0]));
-               start = (dst->pos - OFFSET(st_space[0])) / 16;
-               end = (end - OFFSET(st_space[0])) / 16;
-               for (; start < end; start++)
-                       access_fpreg_ia32(start, buf + 16 * start, pt,
-                                               info->sw, tos, 0);
-               dst->ret = user_regset_copyout(&dst->pos, &dst->count,
-                               &dst->u.get.kbuf, &dst->u.get.ubuf,
-                               buf, OFFSET(st_space[0]), OFFSET(xmm_space[0]));
-               if (dst->ret || dst->count == 0)
-                       return;
-       }
-       if (dst->pos < OFFSET(padding[0]))
-               dst->ret = user_regset_copyout(&dst->pos, &dst->count,
-                               &dst->u.get.kbuf, &dst->u.get.ubuf,
-                               &info->sw->f16, OFFSET(xmm_space[0]),
-                               OFFSET(padding[0]));
-}
-
-static void do_fpxregs_set(struct unw_frame_info *info, void *arg)
-{
-       struct regset_getset *dst = arg;
-       struct task_struct *task = dst->target;
-       char buf[128];
-       int start, end;
-
-       if (dst->count == 0 || unw_unwind_to_user(info) < 0)
-               return;
-
-       if (dst->pos < OFFSET(st_space[0])) {
-               start = dst->pos;
-               dst->ret = user_regset_copyin(&dst->pos, &dst->count,
-                               &dst->u.set.kbuf, &dst->u.set.ubuf,
-                               buf, 0, OFFSET(st_space[0]));
-               if (dst->ret)
-                       return;
-               setfpxreg(task, start, dst->pos, buf);
-               if (dst->count == 0)
-                       return;
-       }
-       if (dst->pos < OFFSET(xmm_space[0])) {
-               struct pt_regs *pt;
-               int tos;
-               pt = task_pt_regs(task);
-               tos = (task->thread.fsr >> 11) & 7;
-               start = (dst->pos - OFFSET(st_space[0])) / 16;
-               dst->ret = user_regset_copyin(&dst->pos, &dst->count,
-                               &dst->u.set.kbuf, &dst->u.set.ubuf,
-                               buf, OFFSET(st_space[0]), OFFSET(xmm_space[0]));
-               if (dst->ret)
-                       return;
-               end = (dst->pos - OFFSET(st_space[0])) / 16;
-               for (; start < end; start++)
-                       access_fpreg_ia32(start, buf + 16 * start, pt, info->sw,
-                                                tos, 1);
-               if (dst->count == 0)
-                       return;
-       }
-       if (dst->pos < OFFSET(padding[0]))
-               dst->ret = user_regset_copyin(&dst->pos, &dst->count,
-                               &dst->u.set.kbuf, &dst->u.set.ubuf,
-                               &info->sw->f16, OFFSET(xmm_space[0]),
-                                OFFSET(padding[0]));
-}
-#undef OFFSET
-
-static int do_regset_call(void (*call)(struct unw_frame_info *, void *),
-               struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               const void *kbuf, const void __user *ubuf)
-{
-       struct regset_getset info = { .target = target, .regset = regset,
-               .pos = pos, .count = count,
-               .u.set = { .kbuf = kbuf, .ubuf = ubuf },
-               .ret = 0 };
-
-       if (target == current)
-               unw_init_running(call, &info);
-       else {
-               struct unw_frame_info ufi;
-               memset(&ufi, 0, sizeof(ufi));
-               unw_init_from_blocked_task(&ufi, target);
-               (*call)(&ufi, &info);
-       }
-
-       return info.ret;
-}
-
-static int ia32_fpregs_get(struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               void *kbuf, void __user *ubuf)
-{
-       return do_regset_call(do_fpregs_get, target, regset, pos, count,
-               kbuf, ubuf);
-}
-
-static int ia32_fpregs_set(struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               const void *kbuf, const void __user *ubuf)
-{
-       return do_regset_call(do_fpregs_set, target, regset, pos, count,
-               kbuf, ubuf);
-}
-
-static int ia32_fpxregs_get(struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               void *kbuf, void __user *ubuf)
-{
-       return do_regset_call(do_fpxregs_get, target, regset, pos, count,
-               kbuf, ubuf);
-}
-
-static int ia32_fpxregs_set(struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               const void *kbuf, const void __user *ubuf)
-{
-       return do_regset_call(do_fpxregs_set, target, regset, pos, count,
-               kbuf, ubuf);
-}
-
-static int ia32_genregs_get(struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               void *kbuf, void __user *ubuf)
-{
-       if (kbuf) {
-               u32 *kp = kbuf;
-               while (count > 0) {
-                       *kp++ = getreg(target, pos);
-                       pos += 4;
-                       count -= 4;
-               }
-       } else {
-               u32 __user *up = ubuf;
-               while (count > 0) {
-                       if (__put_user(getreg(target, pos), up++))
-                               return -EFAULT;
-                       pos += 4;
-                       count -= 4;
-               }
-       }
-       return 0;
-}
-
-static int ia32_genregs_set(struct task_struct *target,
-               const struct user_regset *regset,
-               unsigned int pos, unsigned int count,
-               const void *kbuf, const void __user *ubuf)
-{
-       int ret = 0;
-
-       if (kbuf) {
-               const u32 *kp = kbuf;
-               while (!ret && count > 0) {
-                       putreg(target, pos, *kp++);
-                       pos += 4;
-                       count -= 4;
-               }
-       } else {
-               const u32 __user *up = ubuf;
-               u32 val;
-               while (!ret && count > 0) {
-                       ret = __get_user(val, up++);
-                       if (!ret)
-                               putreg(target, pos, val);
-                       pos += 4;
-                       count -= 4;
-               }
-       }
-       return ret;
-}
-
-static int ia32_tls_active(struct task_struct *target,
-               const struct user_regset *regset)
-{
-       struct thread_struct *t = &target->thread;
-       int n = GDT_ENTRY_TLS_ENTRIES;
-       while (n > 0 && desc_empty(&t->tls_array[n -1]))
-               --n;
-       return n;
-}
-
-static int ia32_tls_get(struct task_struct *target,
-               const struct user_regset *regset, unsigned int pos,
-               unsigned int count, void *kbuf, void __user *ubuf)
-{
-       const struct desc_struct *tls;
-
-       if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct ia32_user_desc) ||
-                       (pos % sizeof(struct ia32_user_desc)) != 0 ||
-                       (count % sizeof(struct ia32_user_desc)) != 0)
-               return -EINVAL;
-
-       pos /= sizeof(struct ia32_user_desc);
-       count /= sizeof(struct ia32_user_desc);
-
-       tls = &target->thread.tls_array[pos];
-
-       if (kbuf) {
-               struct ia32_user_desc *info = kbuf;
-               while (count-- > 0)
-                       fill_user_desc(info++, GDT_ENTRY_TLS_MIN + pos++,
-                                       tls++);
-       } else {
-               struct ia32_user_desc __user *u_info = ubuf;
-               while (count-- > 0) {
-                       struct ia32_user_desc info;
-                       fill_user_desc(&info, GDT_ENTRY_TLS_MIN + pos++, tls++);
-                       if (__copy_to_user(u_info++, &info, sizeof(info)))
-                               return -EFAULT;
-               }
-       }
-
-       return 0;
-}
-
-static int ia32_tls_set(struct task_struct *target,
-               const struct user_regset *regset, unsigned int pos,
-               unsigned int count, const void *kbuf, const void __user *ubuf)
-{
-       struct ia32_user_desc infobuf[GDT_ENTRY_TLS_ENTRIES];
-       const struct ia32_user_desc *info;
-
-       if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct ia32_user_desc) ||
-                       (pos % sizeof(struct ia32_user_desc)) != 0 ||
-                       (count % sizeof(struct ia32_user_desc)) != 0)
-               return -EINVAL;
-
-       if (kbuf)
-               info = kbuf;
-       else if (__copy_from_user(infobuf, ubuf, count))
-               return -EFAULT;
-       else
-               info = infobuf;
-
-       set_tls_desc(target,
-               GDT_ENTRY_TLS_MIN + (pos / sizeof(struct ia32_user_desc)),
-               info, count / sizeof(struct ia32_user_desc));
-
-       return 0;
-}
-
-/*
- * This should match arch/i386/kernel/ptrace.c:native_regsets.
- * XXX ioperm? vm86?
- */
-static const struct user_regset ia32_regsets[] = {
-       {
-               .core_note_type = NT_PRSTATUS,
-               .n = sizeof(struct user_regs_struct32)/4,
-               .size = 4, .align = 4,
-               .get = ia32_genregs_get, .set = ia32_genregs_set
-       },
-       {
-               .core_note_type = NT_PRFPREG,
-               .n = sizeof(struct ia32_user_i387_struct) / 4,
-               .size = 4, .align = 4,
-               .get = ia32_fpregs_get, .set = ia32_fpregs_set
-       },
-       {
-               .core_note_type = NT_PRXFPREG,
-               .n = sizeof(struct ia32_user_fxsr_struct) / 4,
-               .size = 4, .align = 4,
-               .get = ia32_fpxregs_get, .set = ia32_fpxregs_set
-       },
-       {
-               .core_note_type = NT_386_TLS,
-               .n = GDT_ENTRY_TLS_ENTRIES,
-               .bias = GDT_ENTRY_TLS_MIN,
-               .size = sizeof(struct ia32_user_desc),
-               .align = sizeof(struct ia32_user_desc),
-               .active = ia32_tls_active,
-               .get = ia32_tls_get, .set = ia32_tls_set,
-       },
-};
-
-const struct user_regset_view user_ia32_view = {
-       .name = "i386", .e_machine = EM_386,
-       .regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets)
-};
-
-long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
-                       __u32 len_low, __u32 len_high, int advice)
-{ 
-       return sys_fadvise64_64(fd,
-                              (((u64)offset_high)<<32) | offset_low,
-                              (((u64)len_high)<<32) | len_low,
-                              advice); 
-} 
-
-#ifdef NOTYET  /* UNTESTED FOR IA64 FROM HERE DOWN */
-
-asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
-{
-       uid_t sruid, seuid;
-
-       sruid = (ruid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-       seuid = (euid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)euid);
-       return sys_setreuid(sruid, seuid);
-}
-
-asmlinkage long
-sys32_setresuid(compat_uid_t ruid, compat_uid_t euid,
-               compat_uid_t suid)
-{
-       uid_t sruid, seuid, ssuid;
-
-       sruid = (ruid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-       seuid = (euid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)euid);
-       ssuid = (suid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)suid);
-       return sys_setresuid(sruid, seuid, ssuid);
-}
-
-asmlinkage long
-sys32_setregid(compat_gid_t rgid, compat_gid_t egid)
-{
-       gid_t srgid, segid;
-
-       srgid = (rgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-       segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
-       return sys_setregid(srgid, segid);
-}
-
-asmlinkage long
-sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
-               compat_gid_t sgid)
-{
-       gid_t srgid, segid, ssgid;
-
-       srgid = (rgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-       segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
-       ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
-       return sys_setresgid(srgid, segid, ssgid);
-}
-#endif /* NOTYET */
index 93997bd5edc3031bf724c6f54fcb53fc98c8feb3..21adbd7f90f86cf588e10638e1cf93091f2b5388 100644 (file)
@@ -100,7 +100,32 @@ ia64_acpi_release_global_lock (unsigned int *lock)
 static inline void disable_acpi(void) { }
 static inline void pci_acpi_crs_quirks(void) { }
 
+#ifdef CONFIG_IA64_GENERIC
 const char *acpi_get_sysname (void);
+#else
+static inline const char *acpi_get_sysname (void)
+{
+# if defined (CONFIG_IA64_HP_SIM)
+       return "hpsim";
+# elif defined (CONFIG_IA64_HP_ZX1)
+       return "hpzx1";
+# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
+       return "hpzx1_swiotlb";
+# elif defined (CONFIG_IA64_SGI_SN2)
+       return "sn2";
+# elif defined (CONFIG_IA64_SGI_UV)
+       return "uv";
+# elif defined (CONFIG_IA64_DIG)
+       return "dig";
+# elif defined (CONFIG_IA64_XEN_GUEST)
+       return "xen";
+# elif defined(CONFIG_IA64_DIG_VTD)
+       return "dig_vtd";
+# else
+#      error Unknown platform.  Fix acpi.c.
+# endif
+}
+#endif
 int acpi_request_vector (u32 int_type);
 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 
diff --git a/arch/ia64/include/asm/ia32.h b/arch/ia64/include/asm/ia32.h
deleted file mode 100644 (file)
index 2390ee1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _ASM_IA64_IA32_H
-#define _ASM_IA64_IA32_H
-
-
-#include <asm/ptrace.h>
-#include <asm/signal.h>
-
-#define IA32_NR_syscalls               285     /* length of syscall table */
-#define IA32_PAGE_SHIFT                        12      /* 4KB pages */
-
-#ifndef __ASSEMBLY__
-
-# ifdef CONFIG_IA32_SUPPORT
-
-#define IA32_PAGE_OFFSET       0xc0000000
-
-extern void ia32_cpu_init (void);
-extern void ia32_mem_init (void);
-extern void ia32_gdt_init (void);
-extern int ia32_exception (struct pt_regs *regs, unsigned long isr);
-extern int ia32_intercept (struct pt_regs *regs, unsigned long isr);
-extern int ia32_clone_tls (struct task_struct *child, struct pt_regs *childregs);
-
-# endif /* !CONFIG_IA32_SUPPORT */
-
-/* Declare this unconditionally, so we don't get warnings for unreachable code.  */
-extern int ia32_setup_frame1 (int sig, struct k_sigaction *ka, siginfo_t *info,
-                             sigset_t *set, struct pt_regs *regs);
-#if PAGE_SHIFT > IA32_PAGE_SHIFT
-extern int ia32_copy_ia64_partial_page_list(struct task_struct *,
-                                       unsigned long);
-extern void ia32_drop_ia64_partial_page_list(struct task_struct *);
-#else
-# define ia32_copy_ia64_partial_page_list(a1, a2)      0
-# define ia32_drop_ia64_partial_page_list(a1)  do { ; } while (0)
-#endif
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* _ASM_IA64_IA32_H */
index 7fa90f73f6be37757e3a36ed46c85ac3ede3df77..348e44d08ce356adffbde1560ccbfddb5552c65f 100644 (file)
@@ -270,23 +270,6 @@ typedef struct {
                 (int __user *) (addr));                                                        \
 })
 
-#ifdef CONFIG_IA32_SUPPORT
-struct desc_struct {
-       unsigned int a, b;
-};
-
-#define desc_empty(desc)               (!((desc)->a | (desc)->b))
-#define desc_equal(desc1, desc2)       (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
-
-#define GDT_ENTRY_TLS_ENTRIES  3
-#define GDT_ENTRY_TLS_MIN      6
-#define GDT_ENTRY_TLS_MAX      (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
-
-#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
-
-struct ia64_partial_page_list;
-#endif
-
 struct thread_struct {
        __u32 flags;                    /* various thread flags (see IA64_THREAD_*) */
        /* writing on_ustack is performance-critical, so it's worth spending 8 bits on it... */
@@ -298,29 +281,6 @@ struct thread_struct {
        __u64 rbs_bot;                  /* the base address for the RBS */
        int last_fph_cpu;               /* CPU that may hold the contents of f32-f127 */
 
-#ifdef CONFIG_IA32_SUPPORT
-       __u64 eflag;                    /* IA32 EFLAGS reg */
-       __u64 fsr;                      /* IA32 floating pt status reg */
-       __u64 fcr;                      /* IA32 floating pt control reg */
-       __u64 fir;                      /* IA32 fp except. instr. reg */
-       __u64 fdr;                      /* IA32 fp except. data reg */
-       __u64 old_k1;                   /* old value of ar.k1 */
-       __u64 old_iob;                  /* old IOBase value */
-       struct ia64_partial_page_list *ppl; /* partial page list for 4K page size issue */
-        /* cached TLS descriptors. */
-       struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
-
-# define INIT_THREAD_IA32      .eflag =        0,                      \
-                               .fsr =          0,                      \
-                               .fcr =          0x17800000037fULL,      \
-                               .fir =          0,                      \
-                               .fdr =          0,                      \
-                               .old_k1 =       0,                      \
-                               .old_iob =      0,                      \
-                               .ppl =          NULL,
-#else
-# define INIT_THREAD_IA32
-#endif /* CONFIG_IA32_SUPPORT */
 #ifdef CONFIG_PERFMON
        void *pfm_context;                   /* pointer to detailed PMU context */
        unsigned long pfm_needs_checking;    /* when >0, pending perfmon work on kernel exit */
@@ -342,7 +302,6 @@ struct thread_struct {
        .rbs_bot =      STACK_TOP - DEFAULT_USER_STACK_SIZE,    \
        .task_size =    DEFAULT_TASK_SIZE,                      \
        .last_fph_cpu =  -1,                                    \
-       INIT_THREAD_IA32                                        \
        INIT_THREAD_PM                                          \
        .dbr =          {0, },                                  \
        .ibr =          {0, },                                  \
@@ -485,11 +444,6 @@ extern void __ia64_load_fpu (struct ia64_fpreg *fph);
 extern void ia64_save_debug_regs (unsigned long *save_area);
 extern void ia64_load_debug_regs (unsigned long *save_area);
 
-#ifdef CONFIG_IA32_SUPPORT
-extern void ia32_save_state (struct task_struct *task);
-extern void ia32_load_state (struct task_struct *task);
-#endif
-
 #define ia64_fph_enable()      do { ia64_rsm(IA64_PSR_DFH); ia64_srlz_d(); } while (0)
 #define ia64_fph_disable()     do { ia64_ssm(IA64_PSR_DFH); ia64_srlz_d(); } while (0)
 
index d6f57874041d0f80e351dcfeafb27aed21d755a8..d8e98961dec77e42be573f1778b6d69a542c21a2 100644 (file)
@@ -1,25 +1,6 @@
 #ifndef _ASM_IA64_SCATTERLIST_H
 #define _ASM_IA64_SCATTERLIST_H
 
-/*
- * Modified 1998-1999, 2001-2002, 2004
- *     David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
- */
-
-#include <asm/types.h>
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
-       unsigned long sg_magic;
-#endif
-       unsigned long page_link;
-       unsigned int offset;
-       unsigned int length;    /* buffer length */
-
-       dma_addr_t dma_address;
-       unsigned int dma_length;
-};
-
 /*
  * It used to be that ISA_DMA_THRESHOLD had something to do with the
  * DMA-limits of ISA-devices.  Nowadays, its only remaining use (apart
@@ -30,9 +11,6 @@ struct scatterlist {
  */
 #define ISA_DMA_THRESHOLD      0xffffffff
 
-#define sg_dma_len(sg)         ((sg)->dma_length)
-#define sg_dma_address(sg)     ((sg)->dma_address)
-
-#define        ARCH_HAS_SG_CHAIN
+#include <asm-generic/scatterlist.h>
 
 #endif /* _ASM_IA64_SCATTERLIST_H */
index 2f758a42f94bfaf086b9cc8361431c4ff9b683fe..a7ff1c6ab0689af9e547c5a138df286423b9788b 100644 (file)
@@ -22,33 +22,18 @@ static inline long syscall_get_nr(struct task_struct *task,
        if ((long)regs->cr_ifs < 0) /* Not a syscall */
                return -1;
 
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(regs))
-               return regs->r1;
-#endif
-
        return regs->r15;
 }
 
 static inline void syscall_rollback(struct task_struct *task,
                                    struct pt_regs *regs)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(regs))
-               regs->r8 = regs->r1;
-#endif
-
        /* do nothing */
 }
 
 static inline long syscall_get_error(struct task_struct *task,
                                     struct pt_regs *regs)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(regs))
-               return regs->r8;
-#endif
-
        return regs->r10 == -1 ? regs->r8:0;
 }
 
@@ -62,13 +47,6 @@ static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(regs)) {
-               regs->r8 = (long) error ? error : val;
-               return;
-       }
-#endif
-
        if (error) {
                /* error < 0, but ia64 uses > 0 return value */
                regs->r8 = -error;
@@ -89,37 +67,6 @@ static inline void syscall_get_arguments(struct task_struct *task,
 {
        BUG_ON(i + n > 6);
 
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(regs)) {
-               switch (i + n) {
-               case 6:
-                       if (!n--) break;
-                       *args++ = regs->r13;
-               case 5:
-                       if (!n--) break;
-                       *args++ = regs->r15;
-               case 4:
-                       if (!n--) break;
-                       *args++ = regs->r14;
-               case 3:
-                       if (!n--) break;
-                       *args++ = regs->r10;
-               case 2:
-                       if (!n--) break;
-                       *args++ = regs->r9;
-               case 1:
-                       if (!n--) break;
-                       *args++ = regs->r11;
-               case 0:
-                       if (!n--) break;
-               default:
-                       BUG();
-                       break;
-               }
-
-               return;
-       }
-#endif
        ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);
 }
 
@@ -130,34 +77,6 @@ static inline void syscall_set_arguments(struct task_struct *task,
 {
        BUG_ON(i + n > 6);
 
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(regs)) {
-               switch (i + n) {
-               case 6:
-                       if (!n--) break;
-                       regs->r13 = *args++;
-               case 5:
-                       if (!n--) break;
-                       regs->r15 = *args++;
-               case 4:
-                       if (!n--) break;
-                       regs->r14 = *args++;
-               case 3:
-                       if (!n--) break;
-                       regs->r10 = *args++;
-               case 2:
-                       if (!n--) break;
-                       regs->r9 = *args++;
-               case 1:
-                       if (!n--) break;
-                       regs->r11 = *args++;
-               case 0:
-                       if (!n--) break;
-               }
-
-               return;
-       }
-#endif
        ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
 }
 #endif /* _ASM_SYSCALL_H */
index 927a381c20ca06e35c7ba7ed10a6ef35e1826752..9f342a574ce8c669310b6857b5b1ac7152f8bae0 100644 (file)
@@ -191,15 +191,6 @@ do {                                                               \
 
 #ifdef __KERNEL__
 
-#ifdef CONFIG_IA32_SUPPORT
-# define IS_IA32_PROCESS(regs) (ia64_psr(regs)->is != 0)
-#else
-# define IS_IA32_PROCESS(regs)         0
-struct task_struct;
-static inline void ia32_save_state(struct task_struct *t __attribute__((unused))){}
-static inline void ia32_load_state(struct task_struct *t __attribute__((unused))){}
-#endif
-
 /*
  * Context switch from one thread to another.  If the two threads have
  * different address spaces, schedule() has already taken care of
@@ -233,7 +224,7 @@ extern void ia64_account_on_switch (struct task_struct *prev, struct task_struct
 
 #define IA64_HAS_EXTRA_STATE(t)                                                        \
        ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)       \
-        || IS_IA32_PROCESS(task_pt_regs(t)) || PERFMON_IS_SYSWIDE())
+        || PERFMON_IS_SYSWIDE())
 
 #define __switch_to(prev,next,last) do {                                                        \
        IA64_ACCOUNT_ON_SWITCH(prev, next);                                                      \
index 10a8f21ca9e3ffc4244765786167ae9acfb05aaa..bb8b0fff32b3f5c46f9d348f98ebe9a0b2f177ec 100644 (file)
 #define __ARCH_WANT_SYS_RT_SIGACTION
 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
 
-#ifdef CONFIG_IA32_SUPPORT
-# define __ARCH_WANT_SYS_FADVISE64
-# define __ARCH_WANT_SYS_GETPGRP
-# define __ARCH_WANT_SYS_LLSEEK
-# define __ARCH_WANT_SYS_NICE
-# define __ARCH_WANT_SYS_OLD_GETRLIMIT
-# define __ARCH_WANT_SYS_OLDUMOUNT
-# define __ARCH_WANT_SYS_PAUSE
-# define __ARCH_WANT_SYS_SIGPENDING
-# define __ARCH_WANT_SYS_SIGPROCMASK
-# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
-# define __ARCH_WANT_COMPAT_SYS_TIME
-#endif
-
 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
 
 #include <linux/types.h>
index e1236349c99fa3dd8ae7e0686425e77e9b4b0a30..4138282aefa86acb81a548464d10c0a3527e2508 100644 (file)
@@ -8,15 +8,13 @@ endif
 
 extra-y        := head.o init_task.o vmlinux.lds
 
-obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o      \
+obj-y := entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o     \
         irq_lsapic.o ivt.o machvec.o pal.o paravirt_patchlist.o patch.o process.o perfmon.o ptrace.o sal.o             \
         salinfo.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \
         unwind.o mca.o mca_asm.o topology.o dma-mapping.o
 
+obj-$(CONFIG_ACPI)             += acpi.o acpi-ext.o
 obj-$(CONFIG_IA64_BRL_EMU)     += brl_emu.o
-obj-$(CONFIG_IA64_GENERIC)     += acpi-ext.o
-obj-$(CONFIG_IA64_HP_ZX1)      += acpi-ext.o
-obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
 
 obj-$(CONFIG_IA64_PALINFO)     += palinfo.o
 obj-$(CONFIG_IOSAPIC)          += iosapic.o
index 40574ae114018e4db5efce7fc499435c4c863eec..c16fb03037d4a2c69703465d135b44e5e173a6e5 100644 (file)
 
 #define PREFIX                 "ACPI: "
 
-void (*pm_idle) (void);
-EXPORT_SYMBOL(pm_idle);
-void (*pm_power_off) (void);
-EXPORT_SYMBOL(pm_power_off);
-
 u32 acpi_rsdt_forced;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
@@ -83,12 +78,10 @@ static unsigned long __init acpi_find_rsdp(void)
                       "v1.0/r0.71 tables no longer supported\n");
        return rsdp_phys;
 }
-#endif
 
 const char __init *
 acpi_get_sysname(void)
 {
-#ifdef CONFIG_IA64_GENERIC
        unsigned long rsdp_phys;
        struct acpi_table_rsdp *rsdp;
        struct acpi_table_xsdt *xsdt;
@@ -143,30 +136,8 @@ acpi_get_sysname(void)
 #endif
 
        return "dig";
-#else
-# if defined (CONFIG_IA64_HP_SIM)
-       return "hpsim";
-# elif defined (CONFIG_IA64_HP_ZX1)
-       return "hpzx1";
-# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
-       return "hpzx1_swiotlb";
-# elif defined (CONFIG_IA64_SGI_SN2)
-       return "sn2";
-# elif defined (CONFIG_IA64_SGI_UV)
-       return "uv";
-# elif defined (CONFIG_IA64_DIG)
-       return "dig";
-# elif defined (CONFIG_IA64_XEN_GUEST)
-       return "xen";
-# elif defined(CONFIG_IA64_DIG_VTD)
-       return "dig_vtd";
-# else
-#      error Unknown platform.  Fix acpi.c.
-# endif
-#endif
 }
-
-#ifdef CONFIG_ACPI
+#endif /* CONFIG_IA64_GENERIC */
 
 #define ACPI_MAX_PLATFORM_INTERRUPTS   256
 
@@ -1060,5 +1031,3 @@ void acpi_restore_state_mem(void) {}
  * do_suspend_lowlevel()
  */
 void do_suspend_lowlevel(void) {}
-
-#endif                         /* CONFIG_ACPI */
index f3802ae89b108c610d16e3f0b6ab7b9597c21478..96a9d18ff4c4c87c0c469b9d3ecd7cbd3c6963ca 100644 (file)
@@ -30,20 +30,11 @@ static unsigned signal_class[] = {
 
 int audit_classify_arch(int arch)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       if (arch == AUDIT_ARCH_I386)
-               return 1;
-#endif
        return 0;
 }
 
 int audit_classify_syscall(int abi, unsigned syscall)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       extern int ia32_classify_syscall(unsigned);
-       if (abi == AUDIT_ARCH_I386)
-               return ia32_classify_syscall(syscall);
-#endif
        switch(syscall) {
        case __NR_open:
                return 2;
@@ -58,18 +49,6 @@ int audit_classify_syscall(int abi, unsigned syscall)
 
 static int __init audit_classes_init(void)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       extern __u32 ia32_dir_class[];
-       extern __u32 ia32_write_class[];
-       extern __u32 ia32_read_class[];
-       extern __u32 ia32_chattr_class[];
-       extern __u32 ia32_signal_class[];
-       audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class);
-       audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class);
-       audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class);
-       audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class);
-       audit_register_class(AUDIT_CLASS_SIGNAL_32, ia32_signal_class);
-#endif
        audit_register_class(AUDIT_CLASS_WRITE, write_class);
        audit_register_class(AUDIT_CLASS_READ, read_class);
        audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
index d75b872ca4dc8cbe632d0b7d2a8659d9e07c1c8f..9a260b317d8d430b31c609ae03decb72fbd96a60 100644 (file)
@@ -71,15 +71,6 @@ ENTRY(ia64_execve)
        add out3=16,sp                  // regs
        br.call.sptk.many rp=sys_execve
 .ret0:
-#ifdef CONFIG_IA32_SUPPORT
-       /*
-        * Check if we're returning to ia32 mode. If so, we need to restore ia32 registers
-        * from pt_regs.
-        */
-       adds r16=PT(CR_IPSR)+16,sp
-       ;;
-       ld8 r16=[r16]
-#endif
        cmp4.ge p6,p7=r8,r0
        mov ar.pfs=loc1                 // restore ar.pfs
        sxt4 r8=r8                      // return 64-bit result
@@ -108,12 +99,6 @@ ENTRY(ia64_execve)
        ldf.fill f23=[sp];      ldf.fill f24=[sp];      mov f25=f0
        ldf.fill f26=[sp];      ldf.fill f27=[sp];      mov f28=f0
        ldf.fill f29=[sp];      ldf.fill f30=[sp];      mov f31=f0
-#ifdef CONFIG_IA32_SUPPORT
-       tbit.nz p6,p0=r16, IA64_PSR_IS_BIT
-       movl loc0=ia64_ret_from_ia32_execve
-       ;;
-(p6)   mov rp=loc0
-#endif
        br.ret.sptk.many rp
 END(ia64_execve)
 
@@ -848,30 +833,6 @@ __paravirt_work_processed_syscall:
        br.cond.sptk.many rbs_switch    // B
 END(__paravirt_leave_syscall)
 
-#ifdef __IA64_ASM_PARAVIRTUALIZED_NATIVE
-#ifdef CONFIG_IA32_SUPPORT
-GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
-       PT_REGS_UNWIND_INFO(0)
-       adds r2=PT(R8)+16,sp                    // r2 = &pt_regs.r8
-       adds r3=PT(R10)+16,sp                   // r3 = &pt_regs.r10
-       ;;
-       .mem.offset 0,0
-       st8.spill [r2]=r8       // store return value in slot for r8 and set unat bit
-       .mem.offset 8,0
-       st8.spill [r3]=r0       // clear error indication in slot for r10 and set unat bit
-#ifdef CONFIG_PARAVIRT
-       ;;
-       // don't fall through, ia64_leave_kernel may be #define'd
-       br.cond.sptk.few ia64_leave_kernel
-       ;;
-#endif /* CONFIG_PARAVIRT */
-END(ia64_ret_from_ia32_execve)
-#ifndef CONFIG_PARAVIRT
-       // fall through
-#endif
-#endif /* CONFIG_IA32_SUPPORT */
-#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
-
 GLOBAL_ENTRY(__paravirt_leave_kernel)
        PT_REGS_UNWIND_INFO(0)
        /*
index ec9a5fdfa1b9dc6e899fe690503bc8a4604cf4db..179fd122e837dadf5bdc153e47aa288592e47ed6 100644 (file)
@@ -49,7 +49,6 @@
 
 #include <asm/asmmacro.h>
 #include <asm/break.h>
-#include <asm/ia32.h>
 #include <asm/kregs.h>
 #include <asm/asm-offsets.h>
 #include <asm/pgtable.h>
@@ -1386,28 +1385,6 @@ END(ia32_exception)
 // 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
 ENTRY(ia32_intercept)
        DBG_FAULT(46)
-#ifdef CONFIG_IA32_SUPPORT
-       mov r31=pr
-       MOV_FROM_ISR(r16)
-       ;;
-       extr.u r17=r16,16,8     // get ISR.code
-       mov r18=ar.eflag
-       MOV_FROM_IIM(r19)       // old eflag value
-       ;;
-       cmp.ne p6,p0=2,r17
-(p6)   br.cond.spnt 1f         // not a system flag fault
-       xor r16=r18,r19
-       ;;
-       extr.u r17=r16,18,1     // get the eflags.ac bit
-       ;;
-       cmp.eq p6,p0=0,r17
-(p6)   br.cond.spnt 1f         // eflags.ac bit didn't change
-       ;;
-       mov pr=r31,-1           // restore predicate registers
-       RFI
-
-1:
-#endif // CONFIG_IA32_SUPPORT
        FAULT(46)
 END(ia32_intercept)
 
@@ -1416,12 +1393,7 @@ END(ia32_intercept)
 // 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
 ENTRY(ia32_interrupt)
        DBG_FAULT(47)
-#ifdef CONFIG_IA32_SUPPORT
-       mov r31=pr
-       br.sptk.many dispatch_to_ia32_handler
-#else
        FAULT(47)
-#endif
 END(ia32_interrupt)
 
        .org ia64_ivt+0x6c00
@@ -1715,89 +1687,3 @@ ENTRY(dispatch_illegal_op_fault)
 (p6)   br.call.dpnt.many b6=b6         // call returns to ia64_leave_kernel
        br.sptk.many ia64_leave_kernel
 END(dispatch_illegal_op_fault)
-
-#ifdef CONFIG_IA32_SUPPORT
-
-       /*
-        * There is no particular reason for this code to be here, other than that
-        * there happens to be space here that would go unused otherwise.  If this
-        * fault ever gets "unreserved", simply moved the following code to a more
-        * suitable spot...
-        */
-
-       // IA32 interrupt entry point
-
-ENTRY(dispatch_to_ia32_handler)
-       SAVE_MIN
-       ;;
-       MOV_FROM_ISR(r14)
-       SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(r3, r24)
-                               // guarantee that interruption collection is on
-       ;;
-       SSM_PSR_I(p15, p15, r3)
-       adds r3=8,r2            // Base pointer for SAVE_REST
-       ;;
-       SAVE_REST
-       ;;
-       mov r15=0x80
-       shr r14=r14,16          // Get interrupt number
-       ;;
-       cmp.ne p6,p0=r14,r15
-(p6)   br.call.dpnt.many b6=non_ia32_syscall
-
-       adds r14=IA64_PT_REGS_R8_OFFSET + 16,sp // 16 byte hole per SW conventions
-       adds r15=IA64_PT_REGS_R1_OFFSET + 16,sp
-       ;;
-       cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0
-       ld8 r8=[r14]            // get r8
-       ;;
-       st8 [r15]=r8            // save original EAX in r1 (IA32 procs don't use the GP)
-       ;;
-       alloc r15=ar.pfs,0,0,6,0        // must first in an insn group
-       ;;
-       ld4 r8=[r14],8          // r8 == eax (syscall number)
-       mov r15=IA32_NR_syscalls
-       ;;
-       cmp.ltu.unc p6,p7=r8,r15
-       ld4 out1=[r14],8        // r9 == ecx
-       ;;
-       ld4 out2=[r14],8        // r10 == edx
-       ;;
-       ld4 out0=[r14]          // r11 == ebx
-       adds r14=(IA64_PT_REGS_R13_OFFSET) + 16,sp
-       ;;
-       ld4 out5=[r14],PT(R14)-PT(R13)  // r13 == ebp
-       ;;
-       ld4 out3=[r14],PT(R15)-PT(R14)  // r14 == esi
-       adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
-       ;;
-       ld4 out4=[r14]          // r15 == edi
-       movl r16=ia32_syscall_table
-       ;;
-(p6)   shladd r16=r8,3,r16     // force ni_syscall if not valid syscall number
-       ld4 r2=[r2]             // r2 = current_thread_info()->flags
-       ;;
-       ld8 r16=[r16]
-       and r2=_TIF_SYSCALL_TRACEAUDIT,r2       // mask trace or audit
-       ;;
-       mov b6=r16
-       movl r15=ia32_ret_from_syscall
-       cmp.eq p8,p0=r2,r0
-       ;;
-       mov rp=r15
-(p8)   br.call.sptk.many b6=b6
-       br.cond.sptk ia32_trace_syscall
-
-non_ia32_syscall:
-       alloc r15=ar.pfs,0,0,2,0
-       mov out0=r14                            // interrupt #
-       add out1=16,sp                          // pointer to pt_regs
-       ;;                      // avoid WAW on CFM
-       br.call.sptk.many rp=ia32_bad_interrupt
-.ret1: movl r15=ia64_leave_kernel
-       ;;
-       mov rp=r15
-       br.ret.sptk.many rp
-END(dispatch_to_ia32_handler)
-
-#endif /* CONFIG_IA32_SUPPORT */
index 6bcbe215b9a418e555cad4793e20a6723d7b88f9..b81e46b1629b2a0cfe12e40eac2426c33b33a4e1 100644 (file)
@@ -2713,7 +2713,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
                        goto buffer_error;
        }
 
-       DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n",
+       DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d\n",
                ctx,
                ctx_flags,
                ctx->ctx_fl_system,
@@ -3677,7 +3677,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
         * "self-monitoring".
         */
        if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
-               DPRINT(("unblocking [%d] \n", task_pid_nr(task)));
+               DPRINT(("unblocking [%d]\n", task_pid_nr(task)));
                complete(&ctx->ctx_restart_done);
        } else {
                DPRINT(("[%d] armed exit trap\n", task_pid_nr(task)));
index 9bcec9945c1256417efa2829f6334922aaa7a5aa..d92765cae10a802d920eca6eaf634621b233a467 100644 (file)
@@ -33,7 +33,6 @@
 #include <asm/cpu.h>
 #include <asm/delay.h>
 #include <asm/elf.h>
-#include <asm/ia32.h>
 #include <asm/irq.h>
 #include <asm/kexec.h>
 #include <asm/pgalloc.h>
@@ -60,6 +59,10 @@ unsigned long idle_halt;
 EXPORT_SYMBOL(idle_halt);
 unsigned long idle_nomwait;
 EXPORT_SYMBOL(idle_nomwait);
+void (*pm_idle) (void);
+EXPORT_SYMBOL(pm_idle);
+void (*pm_power_off) (void);
+EXPORT_SYMBOL(pm_power_off);
 
 void
 ia64_do_show_stack (struct unw_frame_info *info, void *arg)
@@ -358,11 +361,6 @@ ia64_save_extra (struct task_struct *task)
        if (info & PFM_CPUINFO_SYST_WIDE)
                pfm_syst_wide_update_task(task, info, 0);
 #endif
-
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(task_pt_regs(task)))
-               ia32_save_state(task);
-#endif
 }
 
 void
@@ -383,11 +381,6 @@ ia64_load_extra (struct task_struct *task)
        if (info & PFM_CPUINFO_SYST_WIDE) 
                pfm_syst_wide_update_task(task, info, 1);
 #endif
-
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(task_pt_regs(task)))
-               ia32_load_state(task);
-#endif
 }
 
 /*
@@ -426,7 +419,7 @@ copy_thread(unsigned long clone_flags,
             unsigned long user_stack_base, unsigned long user_stack_size,
             struct task_struct *p, struct pt_regs *regs)
 {
-       extern char ia64_ret_from_clone, ia32_ret_from_clone;
+       extern char ia64_ret_from_clone;
        struct switch_stack *child_stack, *stack;
        unsigned long rbs, child_rbs, rbs_size;
        struct pt_regs *child_ptregs;
@@ -457,7 +450,7 @@ copy_thread(unsigned long clone_flags,
        memcpy((void *) child_rbs, (void *) rbs, rbs_size);
 
        if (likely(user_mode(child_ptregs))) {
-               if ((clone_flags & CLONE_SETTLS) && !IS_IA32_PROCESS(regs))
+               if (clone_flags & CLONE_SETTLS)
                        child_ptregs->r13 = regs->r16;  /* see sys_clone2() in entry.S */
                if (user_stack_base) {
                        child_ptregs->r12 = user_stack_base + user_stack_size - 16;
@@ -477,10 +470,7 @@ copy_thread(unsigned long clone_flags,
                child_ptregs->r13 = (unsigned long) p;          /* set `current' pointer */
        }
        child_stack->ar_bspstore = child_rbs + rbs_size;
-       if (IS_IA32_PROCESS(regs))
-               child_stack->b0 = (unsigned long) &ia32_ret_from_clone;
-       else
-               child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
+       child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
 
        /* copy parts of thread_struct: */
        p->thread.ksp = (unsigned long) child_stack - 16;
@@ -515,22 +505,6 @@ copy_thread(unsigned long clone_flags,
        p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR)
                           | THREAD_FLAGS_TO_SET);
        ia64_drop_fpu(p);       /* don't pick up stale state from a CPU's fph */
-#ifdef CONFIG_IA32_SUPPORT
-       /*
-        * If we're cloning an IA32 task then save the IA32 extra
-        * state from the current task to the new task
-        */
-       if (IS_IA32_PROCESS(task_pt_regs(current))) {
-               ia32_save_state(p);
-               if (clone_flags & CLONE_SETTLS)
-                       retval = ia32_clone_tls(p, child_ptregs);
-
-               /* Copy partially mapped page list */
-               if (!retval)
-                       retval = ia32_copy_ia64_partial_page_list(p,
-                                                               clone_flags);
-       }
-#endif
 
 #ifdef CONFIG_PERFMON
        if (current->thread.pfm_context)
@@ -704,15 +678,6 @@ EXPORT_SYMBOL(kernel_thread);
 int
 kernel_thread_helper (int (*fn)(void *), void *arg)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(task_pt_regs(current))) {
-               /* A kernel thread is always a 64-bit process. */
-               current->thread.map_base  = DEFAULT_MAP_BASE;
-               current->thread.task_size = DEFAULT_TASK_SIZE;
-               ia64_set_kr(IA64_KR_IO_BASE, current->thread.old_iob);
-               ia64_set_kr(IA64_KR_TSSD, current->thread.old_k1);
-       }
-#endif
        return (*fn)(arg);
 }
 
@@ -725,14 +690,6 @@ flush_thread (void)
        /* drop floating-point and debug-register state if it exists: */
        current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
        ia64_drop_fpu(current);
-#ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(task_pt_regs(current))) {
-               ia32_drop_ia64_partial_page_list(current);
-               current->thread.task_size = IA32_PAGE_OFFSET;
-               set_fs(USER_DS);
-               memset(current->thread.tls_array, 0, sizeof(current->thread.tls_array));
-       }
-#endif
 }
 
 /*
@@ -753,8 +710,6 @@ exit_thread (void)
        if (current->thread.flags & IA64_THREAD_DBG_VALID)
                pfm_release_debug_registers(current);
 #endif
-       if (IS_IA32_PROCESS(task_pt_regs(current)))
-               ia32_drop_ia64_partial_page_list(current);
 }
 
 unsigned long
index 9daa87fdb0182e63cde61e6c78df1ff6dea41340..b61afbbe076f6152935e79fca3eb7da61f251c71 100644 (file)
@@ -1250,13 +1250,8 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
                long syscall;
                int arch;
 
-               if (IS_IA32_PROCESS(&regs)) {
-                       syscall = regs.r1;
-                       arch = AUDIT_ARCH_I386;
-               } else {
-                       syscall = regs.r15;
-                       arch = AUDIT_ARCH_IA64;
-               }
+               syscall = regs.r15;
+               arch = AUDIT_ARCH_IA64;
 
                audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3);
        }
@@ -2172,11 +2167,6 @@ static const struct user_regset_view user_ia64_view = {
 
 const struct user_regset_view *task_user_regset_view(struct task_struct *tsk)
 {
-#ifdef CONFIG_IA32_SUPPORT
-       extern const struct user_regset_view user_ia32_view;
-       if (IS_IA32_PROCESS(task_pt_regs(tsk)))
-               return &user_ia32_view;
-#endif
        return &user_ia64_view;
 }
 
index a1ea879197770a2347ccff6ac0049146937d1ca9..41ae6a596b50a8cec1ff7146e547093779257c90 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/kexec.h>
 #include <linux/crash_dump.h>
 
-#include <asm/ia32.h>
 #include <asm/machvec.h>
 #include <asm/mca.h>
 #include <asm/meminit.h>
@@ -1016,10 +1015,6 @@ cpu_init (void)
        ia64_mmu_init(ia64_imva(cpu_data));
        ia64_mca_cpu_init(ia64_imva(cpu_data));
 
-#ifdef CONFIG_IA32_SUPPORT
-       ia32_cpu_init();
-#endif
-
        /* Clear ITC to eliminate sched_clock() overflows in human time.  */
        ia64_set_itc(0);
 
index e1821ca4c7dfddea3827102e2bd63a016e1162f3..7bdafc8788bd6e6cb25a6ea6b3a9120071c34adf 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/unistd.h>
 #include <linux/wait.h>
 
-#include <asm/ia32.h>
 #include <asm/intrinsics.h>
 #include <asm/uaccess.h>
 #include <asm/rse.h>
@@ -425,14 +424,8 @@ static long
 handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *oldset,
               struct sigscratch *scr)
 {
-       if (IS_IA32_PROCESS(&scr->pt)) {
-               /* send signal to IA-32 process */
-               if (!ia32_setup_frame1(sig, ka, info, oldset, &scr->pt))
-                       return 0;
-       } else
-               /* send signal to IA-64 process */
-               if (!setup_frame(sig, ka, info, oldset, scr))
-                       return 0;
+       if (!setup_frame(sig, ka, info, oldset, scr))
+               return 0;
 
        spin_lock_irq(&current->sighand->siglock);
        sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
@@ -462,7 +455,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
        siginfo_t info;
        long restart = in_syscall;
        long errno = scr->pt.r8;
-#      define ERR_CODE(c)      (IS_IA32_PROCESS(&scr->pt) ? -(c) : (c))
 
        /*
         * In the ia64_leave_kernel code path, we want the common case to go fast, which
@@ -490,14 +482,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
                 * inferior call), thus it's important to check for restarting _after_
                 * get_signal_to_deliver().
                 */
-               if (IS_IA32_PROCESS(&scr->pt)) {
-                       if (in_syscall) {
-                               if (errno >= 0)
-                                       restart = 0;
-                               else
-                                       errno = -errno;
-                       }
-               } else if ((long) scr->pt.r10 != -1)
+               if ((long) scr->pt.r10 != -1)
                        /*
                         * A system calls has to be restarted only if one of the error codes
                         * ERESTARTNOHAND, ERESTARTSYS, or ERESTARTNOINTR is returned.  If r10
@@ -513,22 +498,18 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
                        switch (errno) {
                              case ERESTART_RESTARTBLOCK:
                              case ERESTARTNOHAND:
-                               scr->pt.r8 = ERR_CODE(EINTR);
+                               scr->pt.r8 = EINTR;
                                /* note: scr->pt.r10 is already -1 */
                                break;
 
                              case ERESTARTSYS:
                                if ((ka.sa.sa_flags & SA_RESTART) == 0) {
-                                       scr->pt.r8 = ERR_CODE(EINTR);
+                                       scr->pt.r8 = EINTR;
                                        /* note: scr->pt.r10 is already -1 */
                                        break;
                                }
                              case ERESTARTNOINTR:
-                               if (IS_IA32_PROCESS(&scr->pt)) {
-                                       scr->pt.r8 = scr->pt.r1;
-                                       scr->pt.cr_iip -= 2;
-                               } else
-                                       ia64_decrement_ip(&scr->pt);
+                               ia64_decrement_ip(&scr->pt);
                                restart = 0; /* don't restart twice if handle_signal() fails... */
                        }
                }
@@ -555,21 +536,14 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
                if (errno == ERESTARTNOHAND || errno == ERESTARTSYS || errno == ERESTARTNOINTR
                    || errno == ERESTART_RESTARTBLOCK)
                {
-                       if (IS_IA32_PROCESS(&scr->pt)) {
-                               scr->pt.r8 = scr->pt.r1;
-                               scr->pt.cr_iip -= 2;
-                               if (errno == ERESTART_RESTARTBLOCK)
-                                       scr->pt.r8 = 0; /* x86 version of __NR_restart_syscall */
-                       } else {
-                               /*
-                                * Note: the syscall number is in r15 which is saved in
-                                * pt_regs so all we need to do here is adjust ip so that
-                                * the "break" instruction gets re-executed.
-                                */
-                               ia64_decrement_ip(&scr->pt);
-                               if (errno == ERESTART_RESTARTBLOCK)
-                                       scr->pt.r15 = __NR_restart_syscall;
-                       }
+                       /*
+                        * Note: the syscall number is in r15 which is saved in
+                        * pt_regs so all we need to do here is adjust ip so that
+                        * the "break" instruction gets re-executed.
+                        */
+                       ia64_decrement_ip(&scr->pt);
+                       if (errno == ERESTART_RESTARTBLOCK)
+                               scr->pt.r15 = __NR_restart_syscall;
                }
        }
 
index de100aa7ff03dcc07127facacd59f05010d6d0b7..e5230b2ff2c5e4dbc7d74d84c4142d0634e92a63 100644 (file)
@@ -44,7 +44,6 @@
 #include <asm/cache.h>
 #include <asm/current.h>
 #include <asm/delay.h>
-#include <asm/ia32.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/machvec.h>
@@ -443,10 +442,6 @@ smp_callin (void)
                calibrate_delay();
        local_cpu_data->loops_per_jiffy = loops_per_jiffy;
 
-#ifdef CONFIG_IA32_SUPPORT
-       ia32_gdt_init();
-#endif
-
        /*
         * Allow the master to continue.
         */
index f0cda765e681d1252347675d45f582f8ab470b65..fd80e70018a959ebffdf860c962cf0ff062cc4f5 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/kdebug.h>
 
 #include <asm/fpswa.h>
-#include <asm/ia32.h>
 #include <asm/intrinsics.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
@@ -626,10 +625,6 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
                break;
 
              case 45:
-#ifdef CONFIG_IA32_SUPPORT
-               if (ia32_exception(&regs, isr) == 0)
-                       return;
-#endif
                printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n");
                printk(KERN_ERR "  iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
                       iip, ifa, isr);
@@ -637,10 +632,6 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
                break;
 
              case 46:
-#ifdef CONFIG_IA32_SUPPORT
-               if (ia32_intercept(&regs, isr) == 0)
-                       return;
-#endif
                printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
                printk(KERN_ERR "  iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim - 0x%lx\n",
                       iip, ifa, isr, iim);
index 7c0d4814a68dc12a2f5f2dca9b16f1631a7f8314..ca3335ea56ccf9dae52d19ddbe619315f1134225 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/kexec.h>
 
 #include <asm/dma.h>
-#include <asm/ia32.h>
 #include <asm/io.h>
 #include <asm/machvec.h>
 #include <asm/numa.h>
@@ -668,10 +667,6 @@ mem_init (void)
                        fsyscall_table[i] = sys_call_table[i] | 1;
        }
        setup_gate();
-
-#ifdef CONFIG_IA32_SUPPORT
-       ia32_mem_init();
-#endif
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
index 7a5ae633198b38ade2cf824619cbaf93cc0e3c33..f1490657bafc2a26fb2c7c5613d1e6f368a1706e 100644 (file)
@@ -104,7 +104,7 @@ void __init uv_setup(char **cmdline_p)
                uv_cpu_hub_info(cpu)->lowmem_remap_top =
                        lowmem_redir_base + lowmem_redir_size;
                uv_cpu_hub_info(cpu)->m_val = m_val;
-               uv_cpu_hub_info(cpu)->n_val = m_val;
+               uv_cpu_hub_info(cpu)->n_val = n_val;
                uv_cpu_hub_info(cpu)->pnode_mask = (1 << n_val) -1;
                uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
                uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
index e32dae444dd6ec077f0f1ae259927aac723d5ec7..08847aa12583bd0a21534acec7fcea8391a19905 100644 (file)
@@ -58,11 +58,6 @@ __HCALL2(xen_ptcga, HYPERPRIVOP_PTC_GA)
 __HCALL2(xen_set_rr, HYPERPRIVOP_SET_RR)
 __HCALL2(xen_set_kr, HYPERPRIVOP_SET_KR)
 
-#ifdef CONFIG_IA32_SUPPORT
-__HCALL0(xen_get_eflag, HYPERPRIVOP_GET_EFLAG)
-__HCALL1(xen_set_eflag, HYPERPRIVOP_SET_EFLAG) // refer SDM vol1 3.1.8
-#endif /* CONFIG_IA32_SUPPORT */
-
 GLOBAL_ENTRY(xen_set_rr0_to_rr4)
        mov r8=r32
        mov r9=r33
index 5e2270a999fa58f410093c50cd30f92510c7a780..8adc6a14272abb990a104017eba40bf88aa2ebd0 100644 (file)
@@ -301,11 +301,6 @@ static void xen_setreg(int regnum, unsigned long val)
        case _IA64_REG_AR_KR0 ... _IA64_REG_AR_KR7:
                xen_set_kr(regnum - _IA64_REG_AR_KR0, val);
                break;
-#ifdef CONFIG_IA32_SUPPORT
-       case _IA64_REG_AR_EFLAG:
-               xen_set_eflag(val);
-               break;
-#endif
        case _IA64_REG_AR_ITC:
                xen_set_itc(val);
                break;
@@ -332,11 +327,6 @@ static unsigned long xen_getreg(int regnum)
        case _IA64_REG_PSR:
                res = xen_get_psr();
                break;
-#ifdef CONFIG_IA32_SUPPORT
-       case _IA64_REG_AR_EFLAG:
-               res = xen_get_eflag();
-               break;
-#endif
        case _IA64_REG_AR_ITC:
                res = xen_get_itc();
                break;
@@ -710,9 +700,6 @@ extern unsigned long xen_getreg(int regnum);
 
 __DEFINE_FUNC(getreg,
              __DEFINE_GET_REG(PSR, PSR)
-#ifdef CONFIG_IA32_SUPPORT
-             __DEFINE_GET_REG(AR_EFLAG, EFLAG)
-#endif
 
              /* get_itc */
              "mov r2 = " __stringify(_IA64_REG_AR_ITC) "\n"
@@ -789,9 +776,6 @@ __DEFINE_FUNC(setreg,
              ";;\n"
              "(p6) br.cond.spnt xen_set_itc\n"
 
-#ifdef CONFIG_IA32_SUPPORT
-             __DEFINE_SET_REG(AR_EFLAG, SET_EFLAG)
-#endif
              __DEFINE_SET_REG(CR_TPR, SET_TPR)
              __DEFINE_SET_REG(CR_EOI, EOI)
 
index 6e44519960c8f6413c3f0f54ba85ed591f172e81..d360b56e9825e43e16b185b00746a016e806c1f5 100644 (file)
@@ -806,7 +806,7 @@ static int find_psb_table(struct powernow_k8_data *data)
 static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data,
                unsigned int index)
 {
-       acpi_integer control;
+       u64 control;
 
        if (!data->acpi_data.state_count || (cpu_family == CPU_HW_PSTATE))
                return;
@@ -824,7 +824,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
 {
        struct cpufreq_frequency_table *powernow_table;
        int ret_val = -ENODEV;
-       acpi_integer control, status;
+       u64 control, status;
 
        if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) {
                dprintk("register performance failed: bad ACPI data\n");
@@ -948,7 +948,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
                u32 fid;
                u32 vid;
                u32 freq, index;
-               acpi_integer status, control;
+               u64 status, control;
 
                if (data->exttype) {
                        status =  data->acpi_data.states[i].status;
index 3b20786cbb0d0c5f2ca878fc3736d8cb68e52825..3e50c74ed4a1e5b3c5880d15f7b4025f3e5041af 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index a4471e3d3853f19b05ed462c7aef07e5d3fdd01b..33181ad350d5e1be00982cec40f497f0c47aa2ae 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index a4fb001d96f1742065c29a7b16e233871b47c3eb..48faf3eba9fb60cf0806d2516a69d1150b6883f0 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 6291904be01e564d7b4433a1d35fbd30144f2774..894a0ff2a94681e9653cf95659cf19823444e2d2 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 4ced54f7a5d97d0ff0b005bf568b0e2aaf72a188..3e6ba99e4053a0824252de17989e79f72193021f 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -133,8 +133,7 @@ acpi_status acpi_ev_initialize_op_regions(void);
 acpi_status
 acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                               u32 function,
-                              u32 region_offset,
-                              u32 bit_width, acpi_integer * value);
+                              u32 region_offset, u32 bit_width, u64 *value);
 
 acpi_status
 acpi_ev_attach_region(union acpi_operand_object *handler_obj,
index 29ba66d5a7900ea09ebbcbc1716104aabad361b4..f8dd8f250ac4472b1ed92682f1fb3d635a9f37e4 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 36192f142fbb5bdc57997d0600c48284c56878c0..5900f135dc6d93e4bd05d0abbf9ce5e4bea82cba 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 5db9f2916f7c82fa9d3a85166fadda5331f091b9..6df3f8428168e857dc8e20b76a63034b616ee0d2 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -129,18 +129,17 @@ acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
 
 acpi_status
 acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
-                              acpi_integer mask,
-                              acpi_integer field_value,
-                              u32 field_datum_byte_offset);
+                              u64 mask,
+                              u64 field_value, u32 field_datum_byte_offset);
 
 void
-acpi_ex_get_buffer_datum(acpi_integer * datum,
+acpi_ex_get_buffer_datum(u64 *datum,
                         void *buffer,
                         u32 buffer_length,
                         u32 byte_granularity, u32 buffer_offset);
 
 void
-acpi_ex_set_buffer_datum(acpi_integer merged_datum,
+acpi_ex_set_buffer_datum(u64 merged_datum,
                         void *buffer,
                         u32 buffer_length,
                         u32 byte_granularity, u32 buffer_offset);
@@ -168,8 +167,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
 
 acpi_status
 acpi_ex_access_region(union acpi_operand_object *obj_desc,
-                     u32 field_datum_byte_offset,
-                     acpi_integer * value, u32 read_write);
+                     u32 field_datum_byte_offset, u64 *value, u32 read_write);
 
 /*
  * exmisc - misc support routines
@@ -193,16 +191,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
 
 acpi_status
 acpi_ex_do_logical_numeric_op(u16 opcode,
-                             acpi_integer integer0,
-                             acpi_integer integer1, u8 * logical_result);
+                             u64 integer0, u64 integer1, u8 *logical_result);
 
 acpi_status
 acpi_ex_do_logical_op(u16 opcode,
                      union acpi_operand_object *operand0,
-                     union acpi_operand_object *operand1, u8 * logical_result);
+                     union acpi_operand_object *operand1, u8 *logical_result);
 
-acpi_integer
-acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);
+u64 acpi_ex_do_math_op(u16 opcode, u64 operand0, u64 operand1);
 
 acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
 
@@ -278,7 +274,7 @@ acpi_status
 acpi_ex_system_do_notify_op(union acpi_operand_object *value,
                            union acpi_operand_object *obj_desc);
 
-acpi_status acpi_ex_system_do_suspend(acpi_integer time);
+acpi_status acpi_ex_system_do_suspend(u64 time);
 
 acpi_status acpi_ex_system_do_stall(u32 time);
 
@@ -461,9 +457,9 @@ void acpi_ex_acquire_global_lock(u32 rule);
 
 void acpi_ex_release_global_lock(u32 rule);
 
-void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id);
+void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
 
-void acpi_ex_integer_to_string(char *dest, acpi_integer value);
+void acpi_ex_integer_to_string(char *dest, u64 value);
 
 /*
  * exregion - default op_region handlers
@@ -472,7 +468,7 @@ acpi_status
 acpi_ex_system_memory_space_handler(u32 function,
                                    acpi_physical_address address,
                                    u32 bit_width,
-                                   acpi_integer * value,
+                                   u64 *value,
                                    void *handler_context,
                                    void *region_context);
 
@@ -480,35 +476,35 @@ acpi_status
 acpi_ex_system_io_space_handler(u32 function,
                                acpi_physical_address address,
                                u32 bit_width,
-                               acpi_integer * value,
+                               u64 *value,
                                void *handler_context, void *region_context);
 
 acpi_status
 acpi_ex_pci_config_space_handler(u32 function,
                                 acpi_physical_address address,
                                 u32 bit_width,
-                                acpi_integer * value,
+                                u64 *value,
                                 void *handler_context, void *region_context);
 
 acpi_status
 acpi_ex_cmos_space_handler(u32 function,
                           acpi_physical_address address,
                           u32 bit_width,
-                          acpi_integer * value,
+                          u64 *value,
                           void *handler_context, void *region_context);
 
 acpi_status
 acpi_ex_pci_bar_space_handler(u32 function,
                              acpi_physical_address address,
                              u32 bit_width,
-                             acpi_integer * value,
+                             u64 *value,
                              void *handler_context, void *region_context);
 
 acpi_status
 acpi_ex_embedded_controller_space_handler(u32 function,
                                          acpi_physical_address address,
                                          u32 bit_width,
-                                         acpi_integer * value,
+                                         u64 *value,
                                          void *handler_context,
                                          void *region_context);
 
@@ -516,14 +512,14 @@ acpi_status
 acpi_ex_sm_bus_space_handler(u32 function,
                             acpi_physical_address address,
                             u32 bit_width,
-                            acpi_integer * value,
+                            u64 *value,
                             void *handler_context, void *region_context);
 
 acpi_status
 acpi_ex_data_table_space_handler(u32 function,
                                 acpi_physical_address address,
                                 u32 bit_width,
-                                acpi_integer * value,
+                                u64 *value,
                                 void *handler_context, void *region_context);
 
 #endif                         /* __INTERP_H__ */
index 13cb80caacdeaa83e4b48f9864f18379b4eedc80..24b8faa5c395e7db2100f9cea01568911af8d503 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -374,6 +374,7 @@ union acpi_predefined_info {
 struct acpi_predefined_data {
        char *pathname;
        const union acpi_predefined_info *predefined;
+       union acpi_operand_object *parent_package;
        u32 flags;
        u8 node_flags;
 };
@@ -651,8 +652,7 @@ struct acpi_opcode_info {
 };
 
 union acpi_parse_value {
-       acpi_integer integer;   /* Integer constant (Up to 64 bits) */
-       struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
+       u64 integer;            /* Integer constant (Up to 64 bits) */
        u32 size;               /* bytelist or field size */
        char *string;           /* NULL terminated string */
        u8 *buffer;             /* buffer or string */
index 7d9ba6e575540216fc4bac2cfc82c95f3aec267f..9894929a2abbc8320f31133f3f68a5f516cc3721 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * MASK_BITS_ABOVE creates a mask starting AT the position and above
  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
  */
-#define ACPI_MASK_BITS_ABOVE(position)      (~((ACPI_INTEGER_MAX) << ((u32) (position))))
-#define ACPI_MASK_BITS_BELOW(position)      ((ACPI_INTEGER_MAX) << ((u32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position)      (~((ACPI_UINT64_MAX) << ((u32) (position))))
+#define ACPI_MASK_BITS_BELOW(position)      ((ACPI_UINT64_MAX) << ((u32) (position)))
 
 /* Bitfields within ACPI registers */
 
                                                                                        acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
                                                                                        return (_s); })
 #define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-                                                                                       register acpi_integer _s = (s); \
+                                                                                       register u64 _s = (s); \
                                                                                        acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
                                                                                        return (_s); })
 #define return_UINT8(s)                 ACPI_DO_WHILE0 ({ \
                                                                                        register u8 _s = (u8) (s); \
-                                                                                       acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
+                                                                                       acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
                                                                                        return (_s); })
 #define return_UINT32(s)                ACPI_DO_WHILE0 ({ \
                                                                                        register u32 _s = (u32) (s); \
-                                                                                       acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \
+                                                                                       acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
                                                                                        return (_s); })
 #else                          /* Use original less-safe macros */
 
                                                                                        acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
                                                                                        return((s)); })
 #define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-                                                                                       acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \
+                                                                                       acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \
                                                                                        return((s)); })
 #define return_UINT8(s)                 return_VALUE(s)
 #define return_UINT32(s)                return_VALUE(s)
index 61edb156e8d088e7e320b6af4bb5a72e350aba66..258159cfcdfa224fd8f156e5aec2c599b377554f 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -286,6 +286,17 @@ acpi_status
 acpi_ns_repair_package_list(struct acpi_predefined_data *data,
                            union acpi_operand_object **obj_desc_ptr);
 
+acpi_status
+acpi_ns_repair_null_element(struct acpi_predefined_data *data,
+                           u32 expected_btypes,
+                           u32 package_index,
+                           union acpi_operand_object **return_object_ptr);
+
+void
+acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
+                            u8 package_type,
+                            union acpi_operand_object *obj_desc);
+
 /*
  * nsrepair2 - Return object repair for specific
  * predefined methods/objects
@@ -296,11 +307,6 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
                        acpi_status validate_status,
                        union acpi_operand_object **return_object_ptr);
 
-void
-acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
-                            u8 package_type,
-                            union acpi_operand_object *obj_desc);
-
 /*
  * nssearch - Namespace searching and entry
  */
index 07f6e2ea2ee548f9c5578f13449b4b618aafd7b3..cde18ea82656777131078cca7702db8355855d8f 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -111,7 +111,7 @@ ACPI_OBJECT_COMMON_HEADER};
 
 struct acpi_object_integer {
        ACPI_OBJECT_COMMON_HEADER u8 fill[3];   /* Prevent warning on some compilers */
-       acpi_integer value;
+       u64 value;
 };
 
 /*
index dfdf63327885c9c5e2e2fb898daf1f5a90f1dd1a..8c15ff43f42b34ae639e51234ae2a2df8be187d1 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 22881e8ce22983ab71d11ee9177141c4429a9c2e..d0bb0fd3e57a8d6015784598e4c262e1dc33c3d5 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 57bdaf6ffab1b43e1f91dfb35c04bdc8422db7fe..97116082cb6c58f7fb20c7b1e1523a8864e663de 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index eef5bd7a59faf3fd426e8602c9bc0240fd9a8a99..528bcbaf4ce76180dc434d9ea2e3714794d79686 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 7980a26bad356240038584568b6b0ce404c562fe..161bc0e3d70ad5b460fa87cb80b40ba3b624df82 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 01c76b8ea7bae61c31157c624cad117d37be4c19..8ff3b741df285527ae89729cfc1b38bbe6a58036 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 3a451a21a3f99d1446ff6f4eb259e3dda27adfe3..35df755251ce0522907b4dd619f065e073c236e3 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -134,7 +134,7 @@ char *acpi_ut_get_region_name(u8 space_id);
 
 char *acpi_ut_get_event_name(u32 event_id);
 
-char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position);
+char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);
 
 u8 acpi_ut_valid_object_type(acpi_object_type type);
 
@@ -279,8 +279,7 @@ acpi_ut_status_exit(u32 line_number,
 void
 acpi_ut_value_exit(u32 line_number,
                   const char *function_name,
-                  const char *module_name,
-                  u32 component_id, acpi_integer value);
+                  const char *module_name, u32 component_id, u64 value);
 
 void
 acpi_ut_ptr_exit(u32 line_number,
@@ -324,7 +323,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
 acpi_status
 acpi_ut_evaluate_numeric_object(char *object_name,
                                struct acpi_namespace_node *device_node,
-                               acpi_integer *value);
+                               u64 *value);
 
 acpi_status
 acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
@@ -437,14 +436,12 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state);
  * utmath
  */
 acpi_status
-acpi_ut_divide(acpi_integer in_dividend,
-              acpi_integer in_divisor,
-              acpi_integer * out_quotient, acpi_integer * out_remainder);
+acpi_ut_divide(u64 in_dividend,
+              u64 in_divisor, u64 *out_quotient, u64 *out_remainder);
 
 acpi_status
-acpi_ut_short_divide(acpi_integer in_dividend,
-                    u32 divisor,
-                    acpi_integer * out_quotient, u32 * out_remainder);
+acpi_ut_short_divide(u64 in_dividend,
+                    u32 divisor, u64 *out_quotient, u32 *out_remainder);
 
 /*
  * utmisc
@@ -474,8 +471,7 @@ acpi_name acpi_ut_repair_name(char *name);
 
 u8 acpi_ut_valid_acpi_char(char character, u32 position);
 
-acpi_status
-acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
+acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer);
 
 void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_predefined_warning(const char *module_name,
index 4940249f252427ef093e2fb93f2d9497c4f07ca6..1f484ba228fc0c63e47402175dd7a9225e062c4a 100644 (file)
@@ -7,7 +7,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 7b070e42b7c5234fd0c11750db5c931384710c0a..0e5798fcbb19d794d6766aa5c097907ddbfc4f75 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 54a225e56a64f33188a8cdd05d31ad157431fb9b..bb13817e0c318b568a6e8d473678e81173adc1a9 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -220,7 +220,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                        union acpi_parse_object *arg)
 {
        acpi_status status;
-       acpi_integer position;
+       u64 position;
 
        ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
 
@@ -240,8 +240,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
                switch (arg->common.aml_opcode) {
                case AML_INT_RESERVEDFIELD_OP:
 
-                       position = (acpi_integer) info->field_bit_position
-                           + (acpi_integer) arg->common.value.size;
+                       position = (u64) info->field_bit_position
+                           + (u64) arg->common.value.size;
 
                        if (position > ACPI_UINT32_MAX) {
                                ACPI_ERROR((AE_INFO,
@@ -305,8 +305,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
 
                        /* Keep track of bit position for the next field */
 
-                       position = (acpi_integer) info->field_bit_position
-                           + (acpi_integer) arg->common.value.size;
+                       position = (u64) info->field_bit_position
+                           + (u64) arg->common.value.size;
 
                        if (position > ACPI_UINT32_MAX) {
                                ACPI_ERROR((AE_INFO,
index f23fa0be6fc26b27052875f49922da6d34b3b2e5..abe140318a74db1f7f2d51f76bd3f1134a159a73 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index e786f9fd767f3dc0a87715915573b52fd0ddd3bf..721039233aa7704e638805f21015c1ccead2ce78 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 0ba19f84ad82b1e61c8034458c19ada3251fc4a6..cc343b959540a6ecb7631daec5d921a2213fde76 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 9bc1ba07634777ee73315cded8dea9ba68df4add..891e08bf560b8b7f53f537552deb9ff7904c2438 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -684,7 +684,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
                        case AML_ONES_OP:
 
-                               obj_desc->integer.value = ACPI_INTEGER_MAX;
+                               obj_desc->integer.value = ACPI_UINT64_MAX;
 
                                /* Truncate value if we are executing from a 32-bit ACPI table */
 
index b79978f7bc7172f5ca7e3d60a8fa380576dd009d..bf980cadb1e8345d8b99744841d8f8b0246442b1 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index dfa104102926ffbfa2053b208216c82ecc3f0182..306c62ab2e88ccaacb60546373350c8aad294a97 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index f0280856dc0e1040d535a8db1b7f3f28cbcfde21..6b76c486d7840b7a3e7b7ea1303c72f4a0275885 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index b40513dd6a6a90884c16678b4541dd8f84e867d5..140a9d0029599f9103751efce5821368c73cb3b8 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 908645e72f0320477f1f05e83bd43d5a63135cc0..d1e701709dac36b71afd0a1c68b2c936da27acfb 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index e46c821cf57295b7064bd58a333d1692e373451e..050df816416596b61c8e66fcaa75cae6392d9399 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index cd55c774e882c70f168407d01a5fea8c30a4f43b..c1e6f472d435ff6c98b9ebccbc07ef4f85d91ec0 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 0b453467a5a02f2eebcb0cbbf0ce009f444b7495..837de669743a6824c10886ff331718e600ea0d8f 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 3d4c4aca11cdabbd64e20c71ee7f5f15eece87a3..fef721917eaf0387aff4d27bcf60e0b41816ec07 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 8f0fac6c436647a546158b944626d3c526139f14..9a3cb7045a3216edc518b8e7d9ac40f14c7a82d1 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 5336d911fbf07c7f6240d72a6691c766c9c1d5ad..98fd210e87b28a31acb9e2cacf1014fa2d03796f 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -329,7 +329,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
  *              region_offset       - Where in the region to read or write
  *              bit_width           - Field width in bits (8, 16, 32, or 64)
  *              Value               - Pointer to in or out value, must be
- *                                    full 64-bit acpi_integer
+ *                                    a full 64-bit integer
  *
  * RETURN:      Status
  *
@@ -341,8 +341,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 acpi_status
 acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                               u32 function,
-                              u32 region_offset,
-                              u32 bit_width, acpi_integer * value)
+                              u32 region_offset, u32 bit_width, u64 *value)
 {
        acpi_status status;
        acpi_adr_space_handler handler;
index ff168052a33261860675a4572c879bf754ab9b16..2e3b0334072f2f67943883097b0a5b8b20e1943a 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -168,7 +168,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
                                void *handler_context, void **region_context)
 {
        acpi_status status = AE_OK;
-       acpi_integer pci_value;
+       u64 pci_value;
        struct acpi_pci_id *pci_id = *region_context;
        union acpi_operand_object *handler_obj;
        struct acpi_namespace_node *parent_node;
index 567b356c85affb780175f5009ebbb12faa0cb8db..8dfbaa96e422ad3f4760133b504c40d90704ebd0 100644 (file)
@@ -6,7 +6,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 474e2cab603d57cef295791eb22c24fe6d4c76f9..b40757955f9bf802abb4272191dc32ec360c86ff 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 124c157215bfa712bdc700ab56d55285cb8d37c0..5ff32c78ea2db417ba2e303fbb9b401454701508 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index c98aa7c2d67c6bbc492e9c842ce8270814e8b0a8..541cbc1544d5d92a5afe113ddb083bc7481b1534 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 46adfa541cbcb20322f570b8e24a2425877b9d3d..7e8b3bedc376993ead990a9f124a92672007ba3c 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -284,7 +284,7 @@ static acpi_status
 acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
 {
        acpi_status status;
-       acpi_integer value;
+       u64 value;
        u32 region_offset = 0;
        u32 i;
 
@@ -490,7 +490,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 
        status = acpi_tb_add_table(&table_desc, &table_index);
        if (ACPI_FAILURE(status)) {
-               goto cleanup;
+
+               /* Delete allocated table buffer */
+
+               acpi_tb_delete_table(&table_desc);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -533,13 +537,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
                                             acpi_gbl_table_handler_context);
        }
 
-      cleanup:
-       if (ACPI_FAILURE(status)) {
-
-               /* Delete allocated table buffer */
-
-               acpi_tb_delete_table(&table_desc);
-       }
        return_ACPI_STATUS(status);
 }
 
index 51d5f224f9fa178509f19cb0821b1b0519452a04..bda7aed0404b6c2ecdf268fdc9b2dc445d0e89b6 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,7 @@ ACPI_MODULE_NAME("exconvrt")
 
 /* Local prototypes */
 static u32
-acpi_ex_convert_to_ascii(acpi_integer integer,
-                        u16 base, u8 * string, u8 max_length);
+acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length);
 
 /*******************************************************************************
  *
@@ -75,7 +74,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
 {
        union acpi_operand_object *return_desc;
        u8 *pointer;
-       acpi_integer result;
+       u64 result;
        u32 i;
        u32 count;
        acpi_status status;
@@ -155,7 +154,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
                         * Little endian is used, meaning that the first byte of the buffer
                         * is the LSB of the integer
                         */
-                       result |= (((acpi_integer) pointer[i]) << (i * 8));
+                       result |= (((u64) pointer[i]) << (i * 8));
                }
                break;
 
@@ -285,10 +284,9 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
  ******************************************************************************/
 
 static u32
-acpi_ex_convert_to_ascii(acpi_integer integer,
-                        u16 base, u8 * string, u8 data_width)
+acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
 {
-       acpi_integer digit;
+       u64 digit;
        u32 i;
        u32 j;
        u32 k = 0;
@@ -531,10 +529,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                 * (separated by commas or spaces)
                 */
                for (i = 0; i < obj_desc->buffer.length; i++) {
-                       new_buf += acpi_ex_convert_to_ascii((acpi_integer)
-                                                           obj_desc->buffer.
-                                                           pointer[i], base,
-                                                           new_buf, 1);
+                       new_buf += acpi_ex_convert_to_ascii((u64) obj_desc->
+                                                           buffer.pointer[i],
+                                                           base, new_buf, 1);
                        *new_buf++ = separator; /* each separated by a comma or space */
                }
 
index 02b25d233d994523323e673f3f7eb8e99efb4da4..0aa57d93869878795a8bf22659ceaad8a268618a 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index de3446372ddc04cf4c7aa037703a82fa8d022ae8..d39d438ba1e3468560d24bb991a47ae54e5ac127 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 1588a2d660e7ce08d21033620a6b6d10cb666dee..6c79fecbee427505e42d7e4b2b70501d532f9d53 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -130,7 +130,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
                /* Call the region handler for the read */
 
                status = acpi_ex_access_region(obj_desc, 0,
-                                              ACPI_CAST_PTR(acpi_integer,
+                                              ACPI_CAST_PTR(u64,
                                                             buffer_desc->
                                                             buffer.pointer),
                                               function);
@@ -141,7 +141,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
        /*
         * Allocate a buffer for the contents of the field.
         *
-        * If the field is larger than the size of an acpi_integer, create
+        * If the field is larger than the current integer width, create
         * a BUFFER to hold it.  Otherwise, use an INTEGER.  This allows
         * the use of arithmetic operators on the returned value if the
         * field size is equal or smaller than an Integer.
@@ -306,8 +306,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
                 * same buffer)
                 */
                status = acpi_ex_access_region(obj_desc, 0,
-                                              (acpi_integer *) buffer,
-                                              function);
+                                              (u64 *) buffer, function);
                acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
 
                *result_desc = buffer_desc;
index d7b3b418fb45739e82efdc20a6a2477270511842..f68a216168be895b15b1931cabdbc64782d1953b 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -55,11 +55,10 @@ ACPI_MODULE_NAME("exfldio")
 static acpi_status
 acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                       u32 field_datum_byte_offset,
-                      acpi_integer * value, u32 read_write);
+                      u64 *value, u32 read_write);
 
 static u8
-acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
-                         acpi_integer value);
+acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value);
 
 static acpi_status
 acpi_ex_setup_region(union acpi_operand_object *obj_desc,
@@ -212,7 +211,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
  *              field_datum_byte_offset - Byte offset of this datum within the
  *                                        parent field
  *              Value                   - Where to store value (must at least
- *                                        the size of acpi_integer)
+ *                                        64 bits)
  *              Function                - Read or Write flag plus other region-
  *                                        dependent flags
  *
@@ -224,8 +223,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
 
 acpi_status
 acpi_ex_access_region(union acpi_operand_object *obj_desc,
-                     u32 field_datum_byte_offset,
-                     acpi_integer * value, u32 function)
+                     u32 field_datum_byte_offset, u64 *value, u32 function)
 {
        acpi_status status;
        union acpi_operand_object *rgn_desc;
@@ -317,8 +315,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
  ******************************************************************************/
 
 static u8
-acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
-                         acpi_integer value)
+acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
 {
 
        if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
@@ -329,7 +326,7 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
                return (FALSE);
        }
 
-       if (value >= ((acpi_integer) 1 << obj_desc->common_field.bit_length)) {
+       if (value >= ((u64) 1 << obj_desc->common_field.bit_length)) {
                /*
                 * The Value is larger than the maximum value that can fit into
                 * the register.
@@ -362,11 +359,10 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
 
 static acpi_status
 acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
-                      u32 field_datum_byte_offset,
-                      acpi_integer * value, u32 read_write)
+                      u32 field_datum_byte_offset, u64 *value, u32 read_write)
 {
        acpi_status status;
-       acpi_integer local_value;
+       u64 local_value;
 
        ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset);
 
@@ -439,8 +435,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                 * the register
                 */
                if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
-                                             (acpi_integer) obj_desc->
-                                             bank_field.value)) {
+                                             (u64) obj_desc->bank_field.
+                                             value)) {
                        return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
                }
 
@@ -481,8 +477,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                 * the register
                 */
                if (acpi_ex_register_overflow(obj_desc->index_field.index_obj,
-                                             (acpi_integer) obj_desc->
-                                             index_field.value)) {
+                                             (u64) obj_desc->index_field.
+                                             value)) {
                        return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
                }
 
@@ -512,7 +508,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                        status =
                            acpi_ex_extract_from_field(obj_desc->index_field.
                                                       data_obj, value,
-                                                      sizeof(acpi_integer));
+                                                      sizeof(u64));
                } else {
                        /* Write the datum to the data_register */
 
@@ -523,7 +519,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                        status =
                            acpi_ex_insert_into_field(obj_desc->index_field.
                                                      data_obj, value,
-                                                     sizeof(acpi_integer));
+                                                     sizeof(u64));
                }
                break;
 
@@ -571,13 +567,12 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
 
 acpi_status
 acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
-                              acpi_integer mask,
-                              acpi_integer field_value,
-                              u32 field_datum_byte_offset)
+                              u64 mask,
+                              u64 field_value, u32 field_datum_byte_offset)
 {
        acpi_status status = AE_OK;
-       acpi_integer merged_value;
-       acpi_integer current_value;
+       u64 merged_value;
+       u64 current_value;
 
        ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask);
 
@@ -587,7 +582,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
 
        /* If the mask is all ones, we don't need to worry about the update rule */
 
-       if (mask != ACPI_INTEGER_MAX) {
+       if (mask != ACPI_UINT64_MAX) {
 
                /* Decode the update rule */
 
@@ -678,8 +673,8 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
                           void *buffer, u32 buffer_length)
 {
        acpi_status status;
-       acpi_integer raw_datum;
-       acpi_integer merged_datum;
+       u64 raw_datum;
+       u64 merged_datum;
        u32 field_offset = 0;
        u32 buffer_offset = 0;
        u32 buffer_tail_bits;
@@ -804,10 +799,10 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
                          void *buffer, u32 buffer_length)
 {
        acpi_status status;
-       acpi_integer mask;
-       acpi_integer width_mask;
-       acpi_integer merged_datum;
-       acpi_integer raw_datum = 0;
+       u64 mask;
+       u64 width_mask;
+       u64 merged_datum;
+       u64 raw_datum = 0;
        u32 field_offset = 0;
        u32 buffer_offset = 0;
        u32 buffer_tail_bits;
@@ -855,7 +850,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
         * shift operator
         */
        if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) {
-               width_mask = ACPI_INTEGER_MAX;
+               width_mask = ACPI_UINT64_MAX;
        } else {
                width_mask =
                    ACPI_MASK_BITS_ABOVE(obj_desc->common_field.
index 998eac32993789b28cff471fc30d5bc345907709..c5bb1eeed2dff2486636c4c5736093a9d06d9299 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -409,8 +409,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
  *
  ******************************************************************************/
 
-acpi_integer
-acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
+u64 acpi_ex_do_math_op(u16 opcode, u64 integer0, u64 integer1)
 {
 
        ACPI_FUNCTION_ENTRY();
@@ -498,8 +497,7 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
 
 acpi_status
 acpi_ex_do_logical_numeric_op(u16 opcode,
-                             acpi_integer integer0,
-                             acpi_integer integer1, u8 * logical_result)
+                             u64 integer0, u64 integer1, u8 *logical_result)
 {
        acpi_status status = AE_OK;
        u8 local_result = FALSE;
@@ -564,8 +562,8 @@ acpi_ex_do_logical_op(u16 opcode,
                      union acpi_operand_object *operand1, u8 * logical_result)
 {
        union acpi_operand_object *local_operand1 = operand1;
-       acpi_integer integer0;
-       acpi_integer integer1;
+       u64 integer0;
+       u64 integer1;
        u32 length0;
        u32 length1;
        acpi_status status = AE_OK;
index 3c456bd575d0398224fe1ce600da19a000156c48..cc8a10268f6832a18386da38b3abab00f32bd2b0 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index ffdae122d94af6e365aca484d95678b77d81e759..679f308c5a89826e2c1002bd7a4ec9c7fc565074 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 752fe48b2d2004129cc91725bfb4cf79f78deed8..99adbab5acbf4c854e86c252b8da33e607253b3f 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -261,8 +261,8 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
        union acpi_operand_object *return_desc2 = NULL;
        u32 temp32;
        u32 i;
-       acpi_integer power_of_ten;
-       acpi_integer digit;
+       u64 power_of_ten;
+       u64 digit;
 
        ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
@@ -362,7 +362,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                                /* Sum the digit into the result with the current power of 10 */
 
                                return_desc->integer.value +=
-                                   (((acpi_integer) temp32) * power_of_ten);
+                                   (((u64) temp32) * power_of_ten);
 
                                /* Shift to next BCD digit */
 
@@ -392,7 +392,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                                 * remainder from above
                                 */
                                return_desc->integer.value |=
-                                   (((acpi_integer) temp32) << ACPI_MUL_4(i));
+                                   (((u64) temp32) << ACPI_MUL_4(i));
                        }
 
                        /* Overflow if there is any data left in Digit */
@@ -439,7 +439,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
                        /* The object exists in the namespace, return TRUE */
 
-                       return_desc->integer.value = ACPI_INTEGER_MAX;
+                       return_desc->integer.value = ACPI_UINT64_MAX;
                        goto cleanup;
 
                default:
@@ -589,7 +589,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
        union acpi_operand_object *return_desc = NULL;
        acpi_status status = AE_OK;
        u32 type;
-       acpi_integer value;
+       u64 value;
 
        ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
@@ -610,7 +610,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                 * return_desc->Integer.Value is initially == 0 (FALSE) from above.
                 */
                if (!operand[0]->integer.value) {
-                       return_desc->integer.value = ACPI_INTEGER_MAX;
+                       return_desc->integer.value = ACPI_UINT64_MAX;
                }
                break;
 
index 85d95c92dfd3d72d3c35659e5fb64a54111708ed..22841bbbe63ca073545add2473eaf1abce51dce3 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -282,7 +282,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 {
        union acpi_operand_object **operand = &walk_state->operands[0];
        union acpi_operand_object *return_desc = NULL;
-       acpi_integer index;
+       u64 index;
        acpi_status status = AE_OK;
        acpi_size length;
 
@@ -584,7 +584,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
         * Default is FALSE (zero)
         */
        if (logical_result) {
-               return_desc->integer.value = ACPI_INTEGER_MAX;
+               return_desc->integer.value = ACPI_UINT64_MAX;
        }
 
       cleanup:
index 253f9e122584db597c9e85cde12914fab6f43079..8bb1012ef44e4c04fe9b47bd062cedea6aa25e7e 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -148,7 +148,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
        union acpi_operand_object *return_desc = NULL;
        char *buffer = NULL;
        acpi_status status = AE_OK;
-       acpi_integer index;
+       u64 index;
        acpi_size length;
 
        ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R,
index 295542e6bd51f21d4318b79de6bd93f0ac42bf03..f256b6a25f2e646fb7e4a0e31570fa0838de5820 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -218,7 +218,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
        union acpi_operand_object **operand = &walk_state->operands[0];
        union acpi_operand_object *return_desc = NULL;
        acpi_status status = AE_OK;
-       acpi_integer index;
+       u64 index;
        union acpi_operand_object *this_element;
 
        ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R,
@@ -253,9 +253,9 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
                }
 
                /* Create an integer for the return value */
-               /* Default return value is ACPI_INTEGER_MAX if no match found */
+               /* Default return value is ACPI_UINT64_MAX if no match found */
 
-               return_desc = acpi_ut_create_integer_object(ACPI_INTEGER_MAX);
+               return_desc = acpi_ut_create_integer_object(ACPI_UINT64_MAX);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -270,7 +270,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
                 *
                 * Upon finding a match, the loop will terminate via "break" at
                 * the bottom.  If it terminates "normally", match_value will be
-                * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
+                * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no
                 * match was found.
                 */
                for (; index < operand[0]->package.count; index++) {
index 52fec07064f0be7581aa72160d829b521959bfbe..edf62bf5b266a1c83f7175eb6f9ba503ebd74d52 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 2bd83ac57c3ae5030dab9bf17150a7db0442fda0..486b2e5661b692f6d03d0c4c67680d3f90c06669 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -70,7 +70,7 @@ acpi_status
 acpi_ex_system_memory_space_handler(u32 function,
                                    acpi_physical_address address,
                                    u32 bit_width,
-                                   acpi_integer * value,
+                                   u64 *value,
                                    void *handler_context, void *region_context)
 {
        acpi_status status = AE_OK;
@@ -115,8 +115,7 @@ acpi_ex_system_memory_space_handler(u32 function,
         * Hardware does not support non-aligned data transfers, we must verify
         * the request.
         */
-       (void)acpi_ut_short_divide((acpi_integer) address, length, NULL,
-                                  &remainder);
+       (void)acpi_ut_short_divide((u64) address, length, NULL, &remainder);
        if (remainder != 0) {
                return_ACPI_STATUS(AE_AML_ALIGNMENT);
        }
@@ -128,10 +127,9 @@ acpi_ex_system_memory_space_handler(u32 function,
         *    2) Address beyond the current mapping?
         */
        if ((address < mem_info->mapped_physical_address) ||
-           (((acpi_integer) address + length) > ((acpi_integer)
-                                                 mem_info->
-                                                 mapped_physical_address +
-                                                 mem_info->mapped_length))) {
+           (((u64) address + length) > ((u64)
+                                        mem_info->mapped_physical_address +
+                                        mem_info->mapped_length))) {
                /*
                 * The request cannot be resolved by the current memory mapping;
                 * Delete the existing mapping and create a new one.
@@ -193,8 +191,7 @@ acpi_ex_system_memory_space_handler(u32 function,
         * access
         */
        logical_addr_ptr = mem_info->mapped_logical_address +
-           ((acpi_integer) address -
-            (acpi_integer) mem_info->mapped_physical_address);
+           ((u64) address - (u64) mem_info->mapped_physical_address);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                          "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
@@ -215,19 +212,19 @@ acpi_ex_system_memory_space_handler(u32 function,
                *value = 0;
                switch (bit_width) {
                case 8:
-                       *value = (acpi_integer) ACPI_GET8(logical_addr_ptr);
+                       *value = (u64) ACPI_GET8(logical_addr_ptr);
                        break;
 
                case 16:
-                       *value = (acpi_integer) ACPI_GET16(logical_addr_ptr);
+                       *value = (u64) ACPI_GET16(logical_addr_ptr);
                        break;
 
                case 32:
-                       *value = (acpi_integer) ACPI_GET32(logical_addr_ptr);
+                       *value = (u64) ACPI_GET32(logical_addr_ptr);
                        break;
 
                case 64:
-                       *value = (acpi_integer) ACPI_GET64(logical_addr_ptr);
+                       *value = (u64) ACPI_GET64(logical_addr_ptr);
                        break;
 
                default:
@@ -291,7 +288,7 @@ acpi_status
 acpi_ex_system_io_space_handler(u32 function,
                                acpi_physical_address address,
                                u32 bit_width,
-                               acpi_integer * value,
+                               u64 *value,
                                void *handler_context, void *region_context)
 {
        acpi_status status = AE_OK;
@@ -350,7 +347,7 @@ acpi_status
 acpi_ex_pci_config_space_handler(u32 function,
                                 acpi_physical_address address,
                                 u32 bit_width,
-                                acpi_integer * value,
+                                u64 *value,
                                 void *handler_context, void *region_context)
 {
        acpi_status status = AE_OK;
@@ -425,7 +422,7 @@ acpi_status
 acpi_ex_cmos_space_handler(u32 function,
                           acpi_physical_address address,
                           u32 bit_width,
-                          acpi_integer * value,
+                          u64 *value,
                           void *handler_context, void *region_context)
 {
        acpi_status status = AE_OK;
@@ -457,7 +454,7 @@ acpi_status
 acpi_ex_pci_bar_space_handler(u32 function,
                              acpi_physical_address address,
                              u32 bit_width,
-                             acpi_integer * value,
+                             u64 *value,
                              void *handler_context, void *region_context)
 {
        acpi_status status = AE_OK;
@@ -489,7 +486,7 @@ acpi_status
 acpi_ex_data_table_space_handler(u32 function,
                                 acpi_physical_address address,
                                 u32 bit_width,
-                                acpi_integer * value,
+                                u64 *value,
                                 void *handler_context, void *region_context)
 {
        ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
index 607958ff467c34f35bf4ef8cde96c4161dbcf561..fdc1b27999ef2e558c81da7a968d779901a3fd5f 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index c93b54ce7f787dbecbc5359e165e13c6e8b1eb11..fdd6a7079b975f5e1deed99226dbc5cc25ce219b 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 5c729a9e913107783b4f91e16f510b97dbc02b0d..c5ecd615f145bea2ad3e4c4781254ff50a13ff89 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 6efd07a4f779c5975b864eb81989f60a9f84019f..702b9ecfd44b6ebad0291f7e2c4ce63084f7756d 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 608e838d537e38f451586fead9526ac32bf9548c..d4af684620ca9e8307785518d49b793fb059c560 100644 (file)
@@ -7,7 +7,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 257706e7734f786dbe8e8d760283ef2751859838..e972b667b09b8c7b4874f80032ecd90e6526b128 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 3d00b9357233a56ee0d4ff00f96cbd54c7b2560a..e11b6cb42a573dc69a33bd88a9eb358d078a8777 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -193,7 +193,7 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
  *
  ******************************************************************************/
 
-acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
+acpi_status acpi_ex_system_do_suspend(u64 how_long)
 {
        ACPI_FUNCTION_ENTRY();
 
index 7d41f99f70522b4683803c84485b74c081da2724..74c24d517f81768a6a00418db71c9f93be335b2e 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -67,7 +67,7 @@
 ACPI_MODULE_NAME("exutils")
 
 /* Local prototypes */
-static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
+static u32 acpi_ex_digits_needed(u64 value, u32 base);
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
@@ -230,7 +230,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
                 * We are running a method that exists in a 32-bit ACPI table.
                 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
                 */
-               obj_desc->integer.value &= (acpi_integer) ACPI_UINT32_MAX;
+               obj_desc->integer.value &= (u64) ACPI_UINT32_MAX;
        }
 }
 
@@ -327,14 +327,14 @@ void acpi_ex_release_global_lock(u32 field_flags)
  *
  ******************************************************************************/
 
-static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
+static u32 acpi_ex_digits_needed(u64 value, u32 base)
 {
        u32 num_digits;
-       acpi_integer current_value;
+       u64 current_value;
 
        ACPI_FUNCTION_TRACE(ex_digits_needed);
 
-       /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
+       /* u64 is unsigned, so we don't worry about a '-' prefix */
 
        if (value == 0) {
                return_UINT32(1);
@@ -370,7 +370,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
  *
  ******************************************************************************/
 
-void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
+void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
 {
        u32 swapped_id;
 
@@ -394,10 +394,10 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
            (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F));
        out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F));
        out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F));
-       out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12);
-       out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8);
-       out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4);
-       out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0);
+       out_string[3] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 12);
+       out_string[4] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 8);
+       out_string[5] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 4);
+       out_string[6] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 0);
        out_string[7] = 0;
 }
 
@@ -418,7 +418,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
  *
  ******************************************************************************/
 
-void acpi_ex_integer_to_string(char *out_string, acpi_integer value)
+void acpi_ex_integer_to_string(char *out_string, u64 value)
 {
        u32 count;
        u32 digits_needed;
index 9af361a191e7344c0c035514bbf27cae44cf7d34..679a112a7d2692b140776ec44554288b1e2557ca 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index c28c41b3180bc585dd182aa983cda8abc46ba419..bd72319a38f00fa9357bf76a01976b792e574a01 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -224,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
 
        status = acpi_hw_read(&in_byte, &gpe_register_info->status_address);
        if (ACPI_FAILURE(status)) {
-               goto unlock_and_exit;
+               return (status);
        }
 
        if (register_bit & in_byte) {
@@ -234,9 +234,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
        /* Set return value */
 
        (*event_status) = local_event_status;
-
-      unlock_and_exit:
-       return (status);
+       return (AE_OK);
 }
 
 /******************************************************************************
index 15c9ed2be85326f7fa9bd9d72cdcd70eefed9469..ec7fc227b33fbb0edc996428bb238e987f245c1d 100644 (file)
@@ -7,7 +7,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index cc22f9a585b094fba931e775678661ce829ca21e..5e6d4dbb80243cd34fc5105d507e7c0505fa0891 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 6b282e85d039553a60e507d8241b36ea78cecd2e..1ef8e0bb250bd0dccbedd533e4229fedcb739086 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -140,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
 {
        acpi_status status;
        u32 delta_ticks;
-       acpi_integer quotient;
+       u64 quotient;
 
        ACPI_FUNCTION_TRACE(acpi_get_timer_duration);
 
index ec33f270c5b7e670d30e77388527786ec747d5fd..e26c17d4b716e254e084b06c16a5fe61bdf2d787 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2009, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 647c7b6e675616a13fbfd16f5a368a620bf3b9ec..50cc3be77724ce53eb3f611401f08bbe3b3a59b3 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index d622ba770000f0e22e836c5d49f2edd6d96bd6b4..aa2b80132d0a88d37e8781d6aa7955a539846645 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 8a58a1b85aa097cd34d5204c6ef1b0dbc043f7df..982269c1fa48ca0b5253cfefc929b039faa2ab9f 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index e37836e27e29eb3a2816696fbfb7c5da43b04999..0689d36638d994c866f4b83c3187752e1dffa858 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 36be7f0e97ec00ec66b70fa55da470de62518e51..d2a97921e249e87472966c2981fb9af12ef698dd 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index af9fe91037340ff1e404ffdc521881da8e65bf58..f52829cc294b2fd8abc5d45114ccceea4ab233be 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 4f8abac231d24f3474a8deeaed1c8fd91cacf9b2..9bd6f050f299ef55b545dac56a890d8f3219bc18 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index a7234e60e9858c29fbf80cd10bf06a649ee9e898..df18be94fefe9e6753c6050b1964ee851298f7b1 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 8f9a4875ce26708ae06b17a5f637b43a52964537..9593724516353dcdc2bb45653c6d0a8173d9847d 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 60f3af08d28c3955fdee04607e99ce95befda017..41a9213dd5af638fb7dd179d86e9b56f4a1ce9fe 100644 (file)
@@ -6,7 +6,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 662a4bd5b621888f48bfad4c5ab7a26fa1212084..27cda52c76bcf1a81d7550cd4fae01f5d4c3d414 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index d34fa59548f737cd38f1ebc3a242f3563fe3919d..7096bcda0c723b2317affede650241fcbada6e9c 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -231,6 +231,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
         * Note: Package may have been newly created by call above.
         */
        if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
+               data->parent_package = *return_object_ptr;
                status = acpi_ns_check_package(data, return_object_ptr);
                if (ACPI_FAILURE(status)) {
                        goto exit;
@@ -710,6 +711,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
        for (i = 0; i < count; i++) {
                sub_package = *elements;
                sub_elements = sub_package->package.elements;
+               data->parent_package = sub_package;
 
                /* Each sub-object must be of type Package */
 
@@ -721,6 +723,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
 
                /* Examine the different types of expected sub-packages */
 
+               data->parent_package = sub_package;
                switch (package->ret_info.type) {
                case ACPI_PTYPE2:
                case ACPI_PTYPE2_PKG_COUNT:
@@ -800,7 +803,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
 
                        /*
                         * First element is the (Integer) count of elements, including
-                        * the count field.
+                        * the count field (the ACPI name is num_elements)
                         */
                        status = acpi_ns_check_object_type(data, sub_elements,
                                                           ACPI_RTYPE_INTEGER,
@@ -822,6 +825,16 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
                                expected_count = package->ret_info.count1;
                                goto package_too_small;
                        }
+                       if (expected_count == 0) {
+                               /*
+                                * Either the num_entries element was originally zero or it was
+                                * a NULL element and repaired to an Integer of value zero.
+                                * In either case, repair it by setting num_entries to be the
+                                * actual size of the subpackage.
+                                */
+                               expected_count = sub_package->package.count;
+                               (*sub_elements)->integer.value = expected_count;
+                       }
 
                        /* Check the type of each sub-package element */
 
@@ -945,10 +958,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
        char type_buffer[48];   /* Room for 5 types */
 
        /*
-        * If we get a NULL return_object here, it is a NULL package element,
-        * and this is always an error.
+        * If we get a NULL return_object here, it is a NULL package element.
+        * Since all extraneous NULL package elements were removed earlier by a
+        * call to acpi_ns_remove_null_elements, this is an unexpected NULL element.
+        * We will attempt to repair it.
         */
        if (!return_object) {
+               status = acpi_ns_repair_null_element(data, expected_btypes,
+                                                    package_index,
+                                                    return_object_ptr);
+               if (ACPI_SUCCESS(status)) {
+                       return (AE_OK); /* Repair was successful */
+               }
                goto type_error_exit;
        }
 
@@ -1000,27 +1021,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
 
        /* Is the object one of the expected types? */
 
-       if (!(return_btype & expected_btypes)) {
+       if (return_btype & expected_btypes) {
 
-               /* Type mismatch -- attempt repair of the returned object */
+               /* For reference objects, check that the reference type is correct */
 
-               status = acpi_ns_repair_object(data, expected_btypes,
-                                              package_index,
-                                              return_object_ptr);
-               if (ACPI_SUCCESS(status)) {
-                       return (AE_OK); /* Repair was successful */
+               if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
+                       status = acpi_ns_check_reference(data, return_object);
                }
-               goto type_error_exit;
+
+               return (status);
        }
 
-       /* For reference objects, check that the reference type is correct */
+       /* Type mismatch -- attempt repair of the returned object */
 
-       if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
-               status = acpi_ns_check_reference(data, return_object);
+       status = acpi_ns_repair_object(data, expected_btypes,
+                                      package_index, return_object_ptr);
+       if (ACPI_SUCCESS(status)) {
+               return (AE_OK); /* Repair was successful */
        }
 
-       return (status);
-
       type_error_exit:
 
        /* Create a string with all expected types for this predefined object */
index 4fd1bdb056b2ffa496514b0a422c82aef36c35c7..d4be37751be43222a70e9ac8a99da60bad591373 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2009, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,6 +45,7 @@
 #include "accommon.h"
 #include "acnamesp.h"
 #include "acinterp.h"
+#include "acpredef.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsrepair")
@@ -71,6 +72,12 @@ ACPI_MODULE_NAME("nsrepair")
  * Buffer  -> Package of Integers
  * Package -> Package of one Package
  *
+ * Additional possible repairs:
+ *
+ * Optional/unnecessary NULL package elements removed
+ * Required package elements that are NULL replaced by Integer/String/Buffer
+ * Incorrect standalone package wrapped with required outer package
+ *
  ******************************************************************************/
 /* Local prototypes */
 static acpi_status
@@ -504,6 +511,172 @@ acpi_ns_convert_to_package(union acpi_operand_object *original_object,
        return (AE_OK);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_repair_null_element
+ *
+ * PARAMETERS:  Data                - Pointer to validation data structure
+ *              expected_btypes     - Object types expected
+ *              package_index       - Index of object within parent package (if
+ *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT
+ *                                    otherwise)
+ *              return_object_ptr   - Pointer to the object returned from the
+ *                                    evaluation of a method or object
+ *
+ * RETURN:      Status. AE_OK if repair was successful.
+ *
+ * DESCRIPTION: Attempt to repair a NULL element of a returned Package object.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_repair_null_element(struct acpi_predefined_data *data,
+                           u32 expected_btypes,
+                           u32 package_index,
+                           union acpi_operand_object **return_object_ptr)
+{
+       union acpi_operand_object *return_object = *return_object_ptr;
+       union acpi_operand_object *new_object;
+
+       ACPI_FUNCTION_NAME(ns_repair_null_element);
+
+       /* No repair needed if return object is non-NULL */
+
+       if (return_object) {
+               return (AE_OK);
+       }
+
+       /*
+        * Attempt to repair a NULL element of a Package object. This applies to
+        * predefined names that return a fixed-length package and each element
+        * is required. It does not apply to variable-length packages where NULL
+        * elements are allowed, especially at the end of the package.
+        */
+       if (expected_btypes & ACPI_RTYPE_INTEGER) {
+
+               /* Need an Integer - create a zero-value integer */
+
+               new_object = acpi_ut_create_integer_object(0);
+       } else if (expected_btypes & ACPI_RTYPE_STRING) {
+
+               /* Need a String - create a NULL string */
+
+               new_object = acpi_ut_create_string_object(0);
+       } else if (expected_btypes & ACPI_RTYPE_BUFFER) {
+
+               /* Need a Buffer - create a zero-length buffer */
+
+               new_object = acpi_ut_create_buffer_object(0);
+       } else {
+               /* Error for all other expected types */
+
+               return (AE_AML_OPERAND_TYPE);
+       }
+
+       if (!new_object) {
+               return (AE_NO_MEMORY);
+       }
+
+       /* Set the reference count according to the parent Package object */
+
+       new_object->common.reference_count =
+           data->parent_package->common.reference_count;
+
+       ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
+                         "%s: Converted NULL package element to expected %s at index %u\n",
+                         data->pathname,
+                         acpi_ut_get_object_type_name(new_object),
+                         package_index));
+
+       *return_object_ptr = new_object;
+       data->flags |= ACPI_OBJECT_REPAIRED;
+       return (AE_OK);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_remove_null_elements
+ *
+ * PARAMETERS:  Data                - Pointer to validation data structure
+ *              package_type        - An acpi_return_package_types value
+ *              obj_desc            - A Package object
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Remove all NULL package elements from packages that contain
+ *              a variable number of sub-packages. For these types of
+ *              packages, NULL elements can be safely removed.
+ *
+ *****************************************************************************/
+
+void
+acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
+                            u8 package_type,
+                            union acpi_operand_object *obj_desc)
+{
+       union acpi_operand_object **source;
+       union acpi_operand_object **dest;
+       u32 count;
+       u32 new_count;
+       u32 i;
+
+       ACPI_FUNCTION_NAME(ns_remove_null_elements);
+
+       /*
+        * PTYPE1 packages contain no subpackages.
+        * PTYPE2 packages contain a variable number of sub-packages. We can
+        * safely remove all NULL elements from the PTYPE2 packages.
+        */
+       switch (package_type) {
+       case ACPI_PTYPE1_FIXED:
+       case ACPI_PTYPE1_VAR:
+       case ACPI_PTYPE1_OPTION:
+               return;
+
+       case ACPI_PTYPE2:
+       case ACPI_PTYPE2_COUNT:
+       case ACPI_PTYPE2_PKG_COUNT:
+       case ACPI_PTYPE2_FIXED:
+       case ACPI_PTYPE2_MIN:
+       case ACPI_PTYPE2_REV_FIXED:
+               break;
+
+       default:
+               return;
+       }
+
+       count = obj_desc->package.count;
+       new_count = count;
+
+       source = obj_desc->package.elements;
+       dest = source;
+
+       /* Examine all elements of the package object, remove nulls */
+
+       for (i = 0; i < count; i++) {
+               if (!*source) {
+                       new_count--;
+               } else {
+                       *dest = *source;
+                       dest++;
+               }
+               source++;
+       }
+
+       /* Update parent package if any null elements were removed */
+
+       if (new_count < count) {
+               ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
+                                 "%s: Found and removed %u NULL elements\n",
+                                 data->pathname, (count - new_count)));
+
+               /* NULL terminate list and update the package count */
+
+               *dest = NULL;
+               obj_desc->package.count = new_count;
+       }
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_repair_package_list
index f13691c1cca54996097e3ada48b792acf70708ce..61bd0f6755d222ac32dc6703e3f4c9dd8a66a372 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2009, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,6 @@
 #include <acpi/acpi.h>
 #include "accommon.h"
 #include "acnamesp.h"
-#include "acpredef.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsrepair2")
@@ -93,7 +92,7 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
                          u32 sort_index,
                          u8 sort_direction, char *sort_key_name);
 
-static acpi_status
+static void
 acpi_ns_sort_list(union acpi_operand_object **elements,
                  u32 count, u32 index, u8 sort_direction);
 
@@ -443,7 +442,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
        union acpi_operand_object *obj_desc;
        u32 i;
        u32 previous_value;
-       acpi_status status;
 
        ACPI_FUNCTION_NAME(ns_check_sorted_list);
 
@@ -494,19 +492,15 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
 
                /*
                 * The list must be sorted in the specified order. If we detect a
-                * discrepancy, issue a warning and sort the entire list
+                * discrepancy, sort the entire list.
                 */
                if (((sort_direction == ACPI_SORT_ASCENDING) &&
                     (obj_desc->integer.value < previous_value)) ||
                    ((sort_direction == ACPI_SORT_DESCENDING) &&
                     (obj_desc->integer.value > previous_value))) {
-                       status =
-                           acpi_ns_sort_list(return_object->package.elements,
-                                             outer_element_count, sort_index,
-                                             sort_direction);
-                       if (ACPI_FAILURE(status)) {
-                               return (status);
-                       }
+                       acpi_ns_sort_list(return_object->package.elements,
+                                         outer_element_count, sort_index,
+                                         sort_direction);
 
                        data->flags |= ACPI_OBJECT_REPAIRED;
 
@@ -523,89 +517,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
        return (AE_OK);
 }
 
-/******************************************************************************
- *
- * FUNCTION:    acpi_ns_remove_null_elements
- *
- * PARAMETERS:  Data                - Pointer to validation data structure
- *              package_type        - An acpi_return_package_types value
- *              obj_desc            - A Package object
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Remove all NULL package elements from packages that contain
- *              a variable number of sub-packages.
- *
- *****************************************************************************/
-
-void
-acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
-                            u8 package_type,
-                            union acpi_operand_object *obj_desc)
-{
-       union acpi_operand_object **source;
-       union acpi_operand_object **dest;
-       u32 count;
-       u32 new_count;
-       u32 i;
-
-       ACPI_FUNCTION_NAME(ns_remove_null_elements);
-
-       /*
-        * PTYPE1 packages contain no subpackages.
-        * PTYPE2 packages contain a variable number of sub-packages. We can
-        * safely remove all NULL elements from the PTYPE2 packages.
-        */
-       switch (package_type) {
-       case ACPI_PTYPE1_FIXED:
-       case ACPI_PTYPE1_VAR:
-       case ACPI_PTYPE1_OPTION:
-               return;
-
-       case ACPI_PTYPE2:
-       case ACPI_PTYPE2_COUNT:
-       case ACPI_PTYPE2_PKG_COUNT:
-       case ACPI_PTYPE2_FIXED:
-       case ACPI_PTYPE2_MIN:
-       case ACPI_PTYPE2_REV_FIXED:
-               break;
-
-       default:
-               return;
-       }
-
-       count = obj_desc->package.count;
-       new_count = count;
-
-       source = obj_desc->package.elements;
-       dest = source;
-
-       /* Examine all elements of the package object, remove nulls */
-
-       for (i = 0; i < count; i++) {
-               if (!*source) {
-                       new_count--;
-               } else {
-                       *dest = *source;
-                       dest++;
-               }
-               source++;
-       }
-
-       /* Update parent package if any null elements were removed */
-
-       if (new_count < count) {
-               ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
-                                 "%s: Found and removed %u NULL elements\n",
-                                 data->pathname, (count - new_count)));
-
-               /* NULL terminate list and update the package count */
-
-               *dest = NULL;
-               obj_desc->package.count = new_count;
-       }
-}
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ns_sort_list
@@ -615,15 +526,16 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  *              Index               - Sort by which package element
  *              sort_direction      - Ascending or Descending sort
  *
- * RETURN:      Status
+ * RETURN:      None
  *
  * DESCRIPTION: Sort the objects that are in a package element list.
  *
- * NOTE: Assumes that all NULL elements have been removed from the package.
+ * NOTE: Assumes that all NULL elements have been removed from the package,
+ *       and that all elements have been verified to be of type Integer.
  *
  *****************************************************************************/
 
-static acpi_status
+static void
 acpi_ns_sort_list(union acpi_operand_object **elements,
                  u32 count, u32 index, u8 sort_direction)
 {
@@ -652,6 +564,4 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
                        }
                }
        }
-
-       return (AE_OK);
 }
index 7e865639a928746abb4d94039dc771d8d40245fa..08f8b3f5ccaaeb2db41eba557e152e415af29628 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 47d91e668a1bfc25436a0993b3e04b3397aed490..24d05a87a2a37c120e580537345cf331eb2eea92 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index d7e6b52b4482cd2654c600932c173f77ae2b9203..00e79fb260295e6647f336e9efa6237b0cf9230e 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index f0c0892bc7e5c6babc8d46955d46d1d93f24bd82..ebef8a7fd7071f3c05c0e486e65552d5f007bf70 100644 (file)
@@ -6,7 +6,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -562,25 +562,20 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
                return (AE_BAD_PARAMETER);
        }
 
-       /* Run _STA to determine if device is present */
-
-       status = acpi_ut_execute_STA(node, &flags);
-       if (ACPI_FAILURE(status)) {
-               return (AE_CTRL_DEPTH);
-       }
-
-       if (!(flags & ACPI_STA_DEVICE_PRESENT) &&
-           !(flags & ACPI_STA_DEVICE_FUNCTIONING)) {
-               /*
-                * Don't examine the children of the device only when the
-                * device is neither present nor functional. See ACPI spec,
-                * description of _STA for more information.
-                */
-               return (AE_CTRL_DEPTH);
-       }
-
-       /* Filter based on device HID & CID */
-
+       /*
+        * First, filter based on the device HID and CID.
+        *
+        * 01/2010: For this case where a specific HID is requested, we don't
+        * want to run _STA until we have an actual HID match. Thus, we will
+        * not unnecessarily execute _STA on devices for which the caller
+        * doesn't care about. Previously, _STA was executed unconditionally
+        * on all devices found here.
+        *
+        * A side-effect of this change is that now we will continue to search
+        * for a matching HID even under device trees where the parent device
+        * would have returned a _STA that indicates it is not present or
+        * not functioning (thus aborting the search on that branch).
+        */
        if (info->hid != NULL) {
                status = acpi_ut_execute_HID(node, &hid);
                if (status == AE_NOT_FOUND) {
@@ -620,6 +615,25 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
                }
        }
 
+       /* Run _STA to determine if device is present */
+
+       status = acpi_ut_execute_STA(node, &flags);
+       if (ACPI_FAILURE(status)) {
+               return (AE_CTRL_DEPTH);
+       }
+
+       if (!(flags & ACPI_STA_DEVICE_PRESENT) &&
+           !(flags & ACPI_STA_DEVICE_FUNCTIONING)) {
+               /*
+                * Don't examine the children of the device only when the
+                * device is neither present nor functional. See ACPI spec,
+                * description of _STA for more information.
+                */
+               return (AE_CTRL_DEPTH);
+       }
+
+       /* We have a valid device, invoke the user function */
+
        status = info->user_function(obj_handle, nesting_level, info->context,
                                     return_value);
        return (status);
index e611dd961b200ba6f8afd6cebe23b282efe503f7..b01e45a415e3e44a0f40d69c87a95555ac37554a 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 0cc6ba01a49543c27eb669fdf662f8db31a587d5..eafef24ea448f9f78884c09d853bb8da1244cb41 100644 (file)
@@ -6,7 +6,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index b161f3544b51eaa82ab98350350b155f0669cf68..00493e108a0178231748918d4784fa6338f3141d 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -403,7 +403,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
                /* Get 1 byte from the AML stream */
 
                opcode = AML_BYTE_OP;
-               arg->common.value.integer = (acpi_integer) * aml;
+               arg->common.value.integer = (u64) *aml;
                length = 1;
                break;
 
index 0988e4a8901da1c262230c79013be926f089c733..59aabaeab1d343e5d50faef48bc82fd63c1e5711 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 3bc3a60194d61cdd91ee3b60def0e67377aa6212..2b0c3be2b1b886dc07a36ddd4e05a730a57d5b1c 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 4df8f139026c697d4b16a68f315038d94553f8c4..8d81542194d457424d97afc5ed3fd1755a970cf9 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 2feca5ca95811caf12ca6957ee6f0a9fee2ca918..40e2b279ea1281d0fa1e206238d2b1379ec5d403 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 4d3389118ec3b481edab739987352d629de53e17..d4b970c3630badddb8ea5992cd374b8ffc2379b0 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index e636e078ad3deb7edd07259df902b5f4bb2618e5..fe29eee5adb1560686e72db794b1986805c1793b 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 78b8b791f2ae4c3473cbabd111a6bcb881ce7917..8abb9629443df0f6cf8f769284b5684f6c89ddcd 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index d0c1b91eb8caa4731b81c71b94df969f17327127..6064dd4e94c25fdb7485ee2e782d4c601a4fe30f 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 1e437bfd8db5c3a1f0e95473d18cec813b673999..226c806ae98681be6a1a47a63fd742eab9f6f42e 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 3c4dcc3d1069097f4255b92d5b2eaa68119b8424..d6ebf7ec622d6e8d46d9ddb5536fa7047494d90a 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index a3c23d686d5f54ccf324fedb8ab29742c81bd888..f2ee3b54860959c70c0366ac0d14bc583e6d12bd 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -182,7 +182,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 
        /*
         * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a
-        * package that in turn contains an acpi_integer Address, a u8 Pin,
+        * package that in turn contains an u64 Address, a u8 Pin,
         * a Name, and a u8 source_index.
         */
        top_object_list = package_object->package.elements;
index 3f0ca5a12d345f870cd7c9d3adddce5c6e9f5fae..f859b0386fe462d372b45a74a4159f02106e7489 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 77b25fdb459c1e5036026854ed710f28363e21c9..1fd868b964fd2e7891ec8e358d5b37003cc68884 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 35a49aa956096c8d0d5bf8cb9e4e4c4bab9bdb72..33bff17c0bbce1900fd693267df986e6f3d653b2 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 2e0256983aa60b7edf6ee5a21ad1e5896a8e0902..545da40d7fa76cc56dea27e3963050026aaa12f5 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 1b1dbc69f08719921cd58a1ff0eb20b0a57ff97f..fd057c72d25250be54580bafe82373ec644880a6 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index ddc76cebdc925c7457ee4632c327caa2a325bb1c..887b8ba8c432e9e7d4771bd0343856952e415b55 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 5bc49a553284bd3abb7804e73cce1a5bb7e84727..07de352fa4434b4b6fc4e9099a93a3f8a237f142 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index bc03d59668298df64502fa3292d22a7e18b25820..22cfcfbd9fff77cd4cd5bb77be80c244461b2df5 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index f27feb4772f6306b10a3a897f3f2759f5fa8c237..9f6a6e7e1c8e59a946624804ecd2354fd5a9c289 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index c016335fb75974465a33da3f9b42bbf3b8f9781c..f43fbe0fc3fccf0ac8fc070f2fbf0a361b3770fe 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 1054dfd49207dcc51910ae1846dd2cf16a20b290..e252180ce61c1399de74ab3fae03ca1f859516cb 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 63e82329a9e858ca81e1169daf1bf0f4f40e0e14..7ec02b0f69e0fd30051adea4a6e9c4a344a6b274 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 1f15497f00d10dd4319317a0a312ac8be4d2f2f5..02723a9fb10c9f99c5fed148cfb45c939d609802 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index a88f02bd6c94042e03ce24be89b2669a2182809b..5217a6159a3107b52dfb16e6524f9f632389bf4d 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 85ea834199e253b4f36dc86820ceaf51ca2ddbde..dda6e8c497d3b19c9cc0ce164f8411b09c64659a 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 7580f6b3069ec5ecaf7303be5ff88eb5087683c4..3d706b8fd449a43879a4552436c45d620691bc2e 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index f857c5efb79f6d2cb2dc5d3bc9e9ae4376a51865..97ec3621e71d1f35cdb8c0b8dfe7eb46df27a9bd 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 527d729f681506d160c0e93611f60439c0dcb740..983510640059a5bf24feb6e9d85620e918223ee3 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -460,8 +460,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
 void
 acpi_ut_value_exit(u32 line_number,
                   const char *function_name,
-                  const char *module_name,
-                  u32 component_id, acpi_integer value)
+                  const char *module_name, u32 component_id, u64 value)
 {
 
        acpi_debug_print(ACPI_LV_FUNCTIONS,
index 96e26e70c63debb1087fe55f0bb7849e49739301..16b51c69606a342ed26879f6dccdd605ed9a3201 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 5d54e36ab4536eb151acf54cf4a11c89dd9796de..7f5e734ce7f7a1e1b05025765bb33ab29093f4ec 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -348,7 +348,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
 acpi_status
 acpi_ut_evaluate_numeric_object(char *object_name,
                                struct acpi_namespace_node *device_node,
-                               acpi_integer *value)
+                               u64 *value)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
index 3f2c68f4e9598a58df4896c9bb0ea128fb46bbec..eda3e656c4afd50fecb281e35f55240fdebc2232 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -234,7 +234,7 @@ static const char acpi_gbl_hex_to_ascii[] = {
  *
  ******************************************************************************/
 
-char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
+char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
 {
 
        return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
index 52eaae40455476f02f30be6cbfff0210f026bd23..1397fadd0d4b14807b00650732fee18970e5328b 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2009, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 9d0919ebf7b00286153f354bd77a026d6a066c24..a39c93dac7193794e3a063e89a6432db9ff9cc67 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 25e03120686d8f5f899003d695f5be59102a20f6..b081cd46a15f83f5f3eaf114b2b10c52accdf496 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2009, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index c9f682d640efb05edd8ba1b4b18116328ed3ab2b..35059a14eb72c87eaa86e6345a477822ece004ec 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -70,9 +70,8 @@ ACPI_MODULE_NAME("utmath")
  *
  ******************************************************************************/
 acpi_status
-acpi_ut_short_divide(acpi_integer dividend,
-                    u32 divisor,
-                    acpi_integer * out_quotient, u32 * out_remainder)
+acpi_ut_short_divide(u64 dividend,
+                    u32 divisor, u64 *out_quotient, u32 *out_remainder)
 {
        union uint64_overlay dividend_ovl;
        union uint64_overlay quotient;
@@ -126,9 +125,8 @@ acpi_ut_short_divide(acpi_integer dividend,
  ******************************************************************************/
 
 acpi_status
-acpi_ut_divide(acpi_integer in_dividend,
-              acpi_integer in_divisor,
-              acpi_integer * out_quotient, acpi_integer * out_remainder)
+acpi_ut_divide(u64 in_dividend,
+              u64 in_divisor, u64 *out_quotient, u64 *out_remainder)
 {
        union uint64_overlay dividend;
        union uint64_overlay divisor;
@@ -199,9 +197,8 @@ acpi_ut_divide(acpi_integer in_dividend,
                 * The 64-bit remainder must be generated.
                 */
                partial1 = quotient.part.lo * divisor.part.hi;
-               partial2.full =
-                   (acpi_integer) quotient.part.lo * divisor.part.lo;
-               partial3.full = (acpi_integer) partial2.part.hi + partial1;
+               partial2.full = (u64) quotient.part.lo * divisor.part.lo;
+               partial3.full = (u64) partial2.part.hi + partial1;
 
                remainder.part.hi = partial3.part.lo;
                remainder.part.lo = partial2.part.lo;
@@ -257,9 +254,8 @@ acpi_ut_divide(acpi_integer in_dividend,
  *
  ******************************************************************************/
 acpi_status
-acpi_ut_short_divide(acpi_integer in_dividend,
-                    u32 divisor,
-                    acpi_integer * out_quotient, u32 * out_remainder)
+acpi_ut_short_divide(u64 in_dividend,
+                    u32 divisor, u64 *out_quotient, u32 *out_remainder)
 {
 
        ACPI_FUNCTION_TRACE(ut_short_divide);
@@ -284,9 +280,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
 }
 
 acpi_status
-acpi_ut_divide(acpi_integer in_dividend,
-              acpi_integer in_divisor,
-              acpi_integer * out_quotient, acpi_integer * out_remainder)
+acpi_ut_divide(u64 in_dividend,
+              u64 in_divisor, u64 *out_quotient, u64 *out_remainder)
 {
        ACPI_FUNCTION_TRACE(ut_divide);
 
index 6c6a5137b72842f2c4883a732dd1ce9d5edd0b71..32982e2ac38489d191ae7fa967590d227d491c49 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -724,13 +724,12 @@ acpi_name acpi_ut_repair_name(char *name)
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
+acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
 {
        u32 this_digit = 0;
-       acpi_integer return_value = 0;
-       acpi_integer quotient;
-       acpi_integer dividend;
+       u64 return_value = 0;
+       u64 quotient;
+       u64 dividend;
        u32 to_integer_op = (base == ACPI_ANY_BASE);
        u32 mode32 = (acpi_gbl_integer_byte_width == 4);
        u8 valid_digits = 0;
@@ -844,9 +843,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
 
                /* Divide the digit into the correct position */
 
-               (void)
-                   acpi_ut_short_divide((dividend - (acpi_integer) this_digit),
-                                        base, &quotient, NULL);
+               (void)acpi_ut_short_divide((dividend - (u64) this_digit),
+                                          base, &quotient, NULL);
 
                if (return_value > quotient) {
                        if (to_integer_op) {
index 80bb6515411791898cacbee2c3c71c92bcc85180..55d014ed6d5593d7a3b4550bd1f3a14edc2a4a6d 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utmutex")
 /* Local prototypes */
 static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id);
 
-static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);
+static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);
 
 /*******************************************************************************
  *
@@ -114,7 +114,7 @@ void acpi_ut_mutex_terminate(void)
        /* Delete each predefined mutex object */
 
        for (i = 0; i < ACPI_NUM_MUTEX; i++) {
-               (void)acpi_ut_delete_mutex(i);
+               acpi_ut_delete_mutex(i);
        }
 
        /* Delete the spinlocks */
@@ -146,10 +146,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
 
        ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
 
-       if (mutex_id > ACPI_MAX_MUTEX) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
-
        if (!acpi_gbl_mutex_info[mutex_id].mutex) {
                status =
                    acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex);
@@ -173,21 +169,15 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
  *
  ******************************************************************************/
 
-static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
+static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
 {
 
        ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
 
-       if (mutex_id > ACPI_MAX_MUTEX) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
-
        acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
 
        acpi_gbl_mutex_info[mutex_id].mutex = NULL;
        acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
-
-       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************
index 42e658b543f1a33ad20b4306d9f91ca16f836e65..3356f0cb0745281d11b764ab971025535d39b486 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 91b7c00236f41f5e1d9858d6a1f4cc5ddf8e9909..7965919000b1755d078ccb876c143ca2e54c24f0 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 0440c958f5a47fc9cc001b4b459d967bbc68e07b..d35d109b8da22461b479fb3e849a4750dc25f9f1 100644 (file)
@@ -5,7 +5,7 @@
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index b1f5f680bc783c7cca12adefd708a5de0ee97272..db9d8ca57987bc53b902274bb48a704438dbb525 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index cada73ffdfa7f9323264efe430afedb7abeb6f41..58d2c91ba62ba3a14c92bd530f8592aa7259a4ca 100644 (file)
@@ -324,8 +324,8 @@ static int extract_package(struct acpi_battery *battery,
                                strncpy(ptr, element->string.pointer, 32);
                        else if (element->type == ACPI_TYPE_INTEGER) {
                                strncpy(ptr, (u8 *)&element->integer.value,
-                                       sizeof(acpi_integer));
-                               ptr[sizeof(acpi_integer)] = 0;
+                                       sizeof(u64));
+                               ptr[sizeof(u64)] = 0;
                        } else
                                *ptr = 0; /* don't have value */
                } else {
index 27e0b92b2e39c01a1c7cb1e8e9dd305c1bf613b0..d7a6bbbb834cb6d266682183c0ccf46436ca7008 100644 (file)
@@ -597,7 +597,7 @@ static u32 acpi_ec_gpe_handler(void *data)
 
 static acpi_status
 acpi_ec_space_handler(u32 function, acpi_physical_address address,
-                     u32 bits, acpi_integer *value,
+                     u32 bits, u64 *value,
                      void *handler_context, void *region_context)
 {
        struct acpi_ec *ec = handler_context;
@@ -628,7 +628,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
                ++address;
                if (function == ACPI_READ) {
                        result = acpi_ec_read(ec, address, &temp);
-                       (*value) |= ((acpi_integer)temp) << i;
+                       (*value) |= ((u64)temp) << i;
                } else {
                        temp = 0xff & ((*value) >> i);
                        result = acpi_ec_write(ec, address, temp);
index 4c8fcff662cf260aefef315a716256c913427a3a..6d5b64b7d526e8c00f3e695d999708f55aae3540 100644 (file)
@@ -87,7 +87,7 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle)
 /* Get device's handler per its address under its parent */
 struct acpi_find_child {
        acpi_handle handle;
-       acpi_integer address;
+       u64 address;
 };
 
 static acpi_status
@@ -106,7 +106,7 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv)
        return AE_OK;
 }
 
-acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address)
+acpi_handle acpi_get_child(acpi_handle parent, u64 address)
 {
        struct acpi_find_child find = { NULL, address };
 
index 02e8464e480f9e7dea0d3a25ba935ea55e27b8e1..8e6d8665f0aecd54a6895046c13071b831a250c6 100644 (file)
@@ -436,7 +436,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
  * Running in interpreter thread context, safe to sleep
  */
 
-void acpi_os_sleep(acpi_integer ms)
+void acpi_os_sleep(u64 ms)
 {
        schedule_timeout_interruptible(msecs_to_jiffies(ms));
 }
@@ -603,7 +603,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 
 acpi_status
 acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
-                               acpi_integer value, u32 width)
+                               u64 value, u32 width)
 {
        int result, size;
 
index dc4ffadf81220a2541f68f773514d430491b75b7..834c5af0de4bead0ec1b77f67d6d0357a8ccb1e6 100644 (file)
@@ -71,17 +71,17 @@ static const struct acpi_device_id power_meter_ids[] = {
 MODULE_DEVICE_TABLE(acpi, power_meter_ids);
 
 struct acpi_power_meter_capabilities {
-       acpi_integer            flags;
-       acpi_integer            units;
-       acpi_integer            type;
-       acpi_integer            accuracy;
-       acpi_integer            sampling_time;
-       acpi_integer            min_avg_interval;
-       acpi_integer            max_avg_interval;
-       acpi_integer            hysteresis;
-       acpi_integer            configurable_cap;
-       acpi_integer            min_cap;
-       acpi_integer            max_cap;
+       u64             flags;
+       u64             units;
+       u64             type;
+       u64             accuracy;
+       u64             sampling_time;
+       u64             min_avg_interval;
+       u64             max_avg_interval;
+       u64             hysteresis;
+       u64             configurable_cap;
+       u64             min_cap;
+       u64             max_cap;
 };
 
 struct acpi_power_meter_resource {
@@ -93,9 +93,9 @@ struct acpi_power_meter_resource {
        acpi_string             model_number;
        acpi_string             serial_number;
        acpi_string             oem_info;
-       acpi_integer            power;
-       acpi_integer            cap;
-       acpi_integer            avg_interval;
+       u64             power;
+       u64             cap;
+       u64             avg_interval;
        int                     sensors_valid;
        unsigned long           sensors_last_updated;
        struct sensor_device_attribute  sensors[NUM_SENSORS];
@@ -402,7 +402,7 @@ static ssize_t show_val(struct device *dev,
        struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
        struct acpi_device *acpi_dev = to_acpi_device(dev);
        struct acpi_power_meter_resource *resource = acpi_dev->driver_data;
-       acpi_integer val = 0;
+       u64 val = 0;
 
        switch (attr->index) {
        case 0:
index cc978a8c00b797d6c5e9d4300a857a7fa612d6ea..37dfce749398b35abc6ef3b00fac13ce678146b3 100644 (file)
@@ -360,7 +360,7 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr)
 static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 {
        acpi_status status = 0;
-       acpi_integer count;
+       u64 count;
        int current_count;
        int i;
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
index 1c5d7a8b2fdfc86f2b51e434625fdc497aa099e5..7ded7542fc9ddfa0a20a762a7d78214e05131720 100644 (file)
@@ -660,7 +660,7 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
 
 #ifdef CONFIG_X86
 static int acpi_throttling_rdmsr(struct acpi_processor *pr,
-                                       acpi_integer * value)
+                                       u64 *value)
 {
        struct cpuinfo_x86 *c;
        u64 msr_high, msr_low;
@@ -681,13 +681,13 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr,
                rdmsr_safe(MSR_IA32_THERM_CONTROL,
                        (u32 *)&msr_low , (u32 *) &msr_high);
                msr = (msr_high << 32) | msr_low;
-               *value = (acpi_integer) msr;
+               *value = (u64) msr;
                ret = 0;
        }
        return ret;
 }
 
-static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
+static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
 {
        struct cpuinfo_x86 *c;
        unsigned int cpu;
@@ -711,14 +711,14 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
 }
 #else
 static int acpi_throttling_rdmsr(struct acpi_processor *pr,
-                               acpi_integer * value)
+                               u64 *value)
 {
        printk(KERN_ERR PREFIX
                "HARDWARE addr space,NOT supported yet\n");
        return -1;
 }
 
-static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
+static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
 {
        printk(KERN_ERR PREFIX
                "HARDWARE addr space,NOT supported yet\n");
@@ -727,7 +727,7 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
 #endif
 
 static int acpi_read_throttling_status(struct acpi_processor *pr,
-                                       acpi_integer *value)
+                                       u64 *value)
 {
        u32 bit_width, bit_offset;
        u64 ptc_value;
@@ -746,7 +746,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
                                  address, (u32 *) &ptc_value,
                                  (u32) (bit_width + bit_offset));
                ptc_mask = (1 << bit_width) - 1;
-               *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask);
+               *value = (u64) ((ptc_value >> bit_offset) & ptc_mask);
                ret = 0;
                break;
        case ACPI_ADR_SPACE_FIXED_HARDWARE:
@@ -760,7 +760,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
 }
 
 static int acpi_write_throttling_state(struct acpi_processor *pr,
-                               acpi_integer value)
+                               u64 value)
 {
        u32 bit_width, bit_offset;
        u64 ptc_value;
@@ -793,7 +793,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr,
 }
 
 static int acpi_get_throttling_state(struct acpi_processor *pr,
-                               acpi_integer value)
+                               u64 value)
 {
        int i;
 
@@ -808,7 +808,7 @@ static int acpi_get_throttling_state(struct acpi_processor *pr,
 }
 
 static int acpi_get_throttling_value(struct acpi_processor *pr,
-                       int state, acpi_integer *value)
+                       int state, u64 *value)
 {
        int ret = -1;
 
@@ -826,7 +826,7 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
 {
        int state = 0;
        int ret;
-       acpi_integer value;
+       u64 value;
 
        if (!pr)
                return -EINVAL;
@@ -993,7 +993,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
                                             int state, bool force)
 {
        int ret;
-       acpi_integer value;
+       u64 value;
 
        if (!pr)
                return -EINVAL;
index 811fec10462b7f41b89bcc0735b3b99c1819a6b3..11882dbe20944e8b522296d0431ca33a1ba2a57c 100644 (file)
@@ -107,12 +107,12 @@ acpi_extract_package(union acpi_object *package,
                case ACPI_TYPE_INTEGER:
                        switch (format_string[i]) {
                        case 'N':
-                               size_required += sizeof(acpi_integer);
-                               tail_offset += sizeof(acpi_integer);
+                               size_required += sizeof(u64);
+                               tail_offset += sizeof(u64);
                                break;
                        case 'S':
                                size_required +=
-                                   sizeof(char *) + sizeof(acpi_integer) +
+                                   sizeof(char *) + sizeof(u64) +
                                    sizeof(char);
                                tail_offset += sizeof(char *);
                                break;
@@ -193,17 +193,17 @@ acpi_extract_package(union acpi_object *package,
                case ACPI_TYPE_INTEGER:
                        switch (format_string[i]) {
                        case 'N':
-                               *((acpi_integer *) head) =
+                               *((u64 *) head) =
                                    element->integer.value;
-                               head += sizeof(acpi_integer);
+                               head += sizeof(u64);
                                break;
                        case 'S':
                                pointer = (u8 **) head;
                                *pointer = tail;
-                               *((acpi_integer *) tail) =
+                               *((u64 *) tail) =
                                    element->integer.value;
-                               head += sizeof(acpi_integer *);
-                               tail += sizeof(acpi_integer);
+                               head += sizeof(u64 *);
+                               tail += sizeof(u64);
                                /* NULL terminate string */
                                *tail = (char)0;
                                tail += sizeof(char);
index b765790b32be1841d652d3e834c6013950700efc..6e9b49149fce4b675deb81b974d60f281439aff7 100644 (file)
@@ -759,7 +759,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
 static int
 acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
 {
-       acpi_integer status = 0;
+       u64 status = 0;
        union acpi_object arg0 = { ACPI_TYPE_INTEGER };
        struct acpi_object_list args = { 1, &arg0 };
 
index 1245838ac13dbe8feec67c1e4c14076e6930c23d..292fdbc0431a20e872509809ccd733683f61bb9c 100644 (file)
@@ -64,7 +64,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap)
        WARN_ON(!(ap->flags & ATA_FLAG_ACPI_SATA));
 
        if (!sata_pmp_attached(ap)) {
-               acpi_integer adr = SATA_ADR(ap->port_no, NO_PORT_MULT);
+               u64 adr = SATA_ADR(ap->port_no, NO_PORT_MULT);
 
                ap->link.device->acpi_handle =
                        acpi_get_child(ap->host->acpi_handle, adr);
@@ -74,7 +74,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap)
                ap->link.device->acpi_handle = NULL;
 
                ata_for_each_link(link, ap, EDGE) {
-                       acpi_integer adr = SATA_ADR(ap->port_no, link->pmp);
+                       u64 adr = SATA_ADR(ap->port_no, link->pmp);
 
                        link->device->acpi_handle =
                                acpi_get_child(ap->host->acpi_handle, adr);
index f706b1dffdb31f082144f419fb5d28d6d8ccbbfc..ada25bb8941e5c0fa28ff068f66b0e14be700c55 100644 (file)
@@ -1185,11 +1185,6 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
 
        rep = (down == 2);
 
-#ifdef CONFIG_MAC_EMUMOUSEBTN
-       if (mac_hid_mouse_emulate_buttons(1, keycode, down))
-               return;
-#endif /* CONFIG_MAC_EMUMOUSEBTN */
-
        if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw)
                if (emulate_raw(vc, keycode, !down << 7))
                        if (keycode < BTN_MISC && printk_ratelimit())
@@ -1328,6 +1323,21 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type,
        schedule_console_callback();
 }
 
+static bool kbd_match(struct input_handler *handler, struct input_dev *dev)
+{
+       int i;
+
+       if (test_bit(EV_SND, dev->evbit))
+               return true;
+
+       if (test_bit(EV_KEY, dev->evbit))
+               for (i = KEY_RESERVED; i < BTN_MISC; i++)
+                       if (test_bit(i, dev->keybit))
+                               return true;
+
+       return false;
+}
+
 /*
  * When a keyboard (or other input device) is found, the kbd_connect
  * function is called. The function then looks at the device, and if it
@@ -1339,14 +1349,6 @@ static int kbd_connect(struct input_handler *handler, struct input_dev *dev,
 {
        struct input_handle *handle;
        int error;
-       int i;
-
-       for (i = KEY_RESERVED; i < BTN_MISC; i++)
-               if (test_bit(i, dev->keybit))
-                       break;
-
-       if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit))
-               return -ENODEV;
 
        handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
        if (!handle)
@@ -1412,6 +1414,7 @@ MODULE_DEVICE_TABLE(input, kbd_ids);
 
 static struct input_handler kbd_handler = {
        .event          = kbd_event,
+       .match          = kbd_match,
        .connect        = kbd_connect,
        .disconnect     = kbd_disconnect,
        .start          = kbd_start,
index c0cf45a11b938cfd4b0d0bb84329535f8151172c..5cb01e5c323c993c08d0226d72c16815310febc7 100644 (file)
@@ -108,11 +108,11 @@ bool ide_port_acpi(ide_hwif_t *hwif)
  * Returns 0 on success, <0 on error.
  */
 static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
-                              acpi_integer *pcidevfn)
+                              u64 *pcidevfn)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
        unsigned int bus, devnum, func;
-       acpi_integer addr;
+       u64 addr;
        acpi_handle dev_handle;
        acpi_status status;
        struct acpi_device_info *dinfo = NULL;
@@ -122,7 +122,7 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
        devnum = PCI_SLOT(pdev->devfn);
        func = PCI_FUNC(pdev->devfn);
        /* ACPI _ADR encoding for PCI bus: */
-       addr = (acpi_integer)(devnum << 16 | func);
+       addr = (u64)(devnum << 16 | func);
 
        DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func);
 
@@ -169,7 +169,7 @@ static acpi_handle ide_acpi_hwif_get_handle(ide_hwif_t *hwif)
 {
        struct device           *dev = hwif->gendev.parent;
        acpi_handle             uninitialized_var(dev_handle);
-       acpi_integer            pcidevfn;
+       u64                     pcidevfn;
        acpi_handle             chan_handle;
        int                     err;
 
index 258c639571b5058bc9fece65f2de501cc0a25d75..9f9816baeb97bed74092781e35373ecae1a996ab 100644 (file)
@@ -278,6 +278,8 @@ static int evdev_open(struct inode *inode, struct file *file)
                goto err_free_client;
 
        file->private_data = client;
+       nonseekable_open(inode, file);
+
        return 0;
 
  err_free_client:
index b04930f7ea7da88e36e65a9c9faa9f188778de93..7392992da4243c35e127466035e1f35cb377af3a 100644 (file)
@@ -46,7 +46,7 @@ struct emu {
        int size;
 };
 
-static struct pci_device_id emu_tbl[] = {
+static const struct pci_device_id emu_tbl[] = {
 
        { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
        { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
index 8a1810f88b9e4707b718b8ef6baebf0e98b47b41..14d3f3e208a2f557a80156dbe51c29f8aa0a0773 100644 (file)
@@ -140,7 +140,7 @@ static void __devexit fm801_gp_remove(struct pci_dev *pci)
        }
 }
 
-static struct pci_device_id fm801_gp_id_table[] = {
+static const struct pci_device_id fm801_gp_id_table[] = {
        { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0  },
        { 0 }
 };
index ac11be08585e9fc70d75e466ebd9942006c78d0f..7e18bcf05a662353d395d7a7c527c61271eed097 100644 (file)
@@ -11,6 +11,8 @@
  * the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/stddef.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive
 
        error = device_bind_driver(&gameport->dev);
        if (error) {
-               printk(KERN_WARNING
-                       "gameport: device_bind_driver() failed "
-                       "for %s (%s) and %s, error: %d\n",
+               dev_warn(&gameport->dev,
+                        "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
                        gameport->phys, gameport->name,
                        drv->description, error);
                drv->disconnect(gameport);
@@ -209,9 +210,9 @@ static void gameport_find_driver(struct gameport *gameport)
 
        error = device_attach(&gameport->dev);
        if (error < 0)
-               printk(KERN_WARNING
-                       "gameport: device_attach() failed for %s (%s), error: %d\n",
-                       gameport->phys, gameport->name, error);
+               dev_warn(&gameport->dev,
+                        "device_attach() failed for %s (%s), error: %d\n",
+                        gameport->phys, gameport->name, error);
 }
 
 
@@ -262,17 +263,14 @@ static int gameport_queue_event(void *object, struct module *owner,
 
        event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC);
        if (!event) {
-               printk(KERN_ERR
-                       "gameport: Not enough memory to queue event %d\n",
-                       event_type);
+               pr_err("Not enough memory to queue event %d\n", event_type);
                retval = -ENOMEM;
                goto out;
        }
 
        if (!try_module_get(owner)) {
-               printk(KERN_WARNING
-                       "gameport: Can't get module reference, dropping event %d\n",
-                       event_type);
+               pr_warning("Can't get module reference, dropping event %d\n",
+                          event_type);
                kfree(event);
                retval = -EINVAL;
                goto out;
@@ -298,14 +296,12 @@ static void gameport_free_event(struct gameport_event *event)
 
 static void gameport_remove_duplicate_events(struct gameport_event *event)
 {
-       struct list_head *node, *next;
-       struct gameport_event *e;
+       struct gameport_event *e, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&gameport_event_lock, flags);
 
-       list_for_each_safe(node, next, &gameport_event_list) {
-               e = list_entry(node, struct gameport_event, node);
+       list_for_each_entry_safe(e, next, &gameport_event_list, node) {
                if (event->object == e->object) {
                        /*
                         * If this event is of different type we should not
@@ -315,7 +311,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
                        if (event->type != e->type)
                                break;
 
-                       list_del_init(node);
+                       list_del_init(&e->node);
                        gameport_free_event(e);
                }
        }
@@ -325,23 +321,18 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
 
 static struct gameport_event *gameport_get_event(void)
 {
-       struct gameport_event *event;
-       struct list_head *node;
+       struct gameport_event *event = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&gameport_event_lock, flags);
 
-       if (list_empty(&gameport_event_list)) {
-               spin_unlock_irqrestore(&gameport_event_lock, flags);
-               return NULL;
+       if (!list_empty(&gameport_event_list)) {
+               event = list_first_entry(&gameport_event_list,
+                                        struct gameport_event, node);
+               list_del_init(&event->node);
        }
 
-       node = gameport_event_list.next;
-       event = list_entry(node, struct gameport_event, node);
-       list_del_init(node);
-
        spin_unlock_irqrestore(&gameport_event_lock, flags);
-
        return event;
 }
 
@@ -360,16 +351,14 @@ static void gameport_handle_event(void)
        if ((event = gameport_get_event())) {
 
                switch (event->type) {
-                       case GAMEPORT_REGISTER_PORT:
-                               gameport_add_port(event->object);
-                               break;
 
-                       case GAMEPORT_ATTACH_DRIVER:
-                               gameport_attach_driver(event->object);
-                               break;
+               case GAMEPORT_REGISTER_PORT:
+                       gameport_add_port(event->object);
+                       break;
 
-                       default:
-                               break;
+               case GAMEPORT_ATTACH_DRIVER:
+                       gameport_attach_driver(event->object);
+                       break;
                }
 
                gameport_remove_duplicate_events(event);
@@ -385,16 +374,14 @@ static void gameport_handle_event(void)
  */
 static void gameport_remove_pending_events(void *object)
 {
-       struct list_head *node, *next;
-       struct gameport_event *event;
+       struct gameport_event *event, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&gameport_event_lock, flags);
 
-       list_for_each_safe(node, next, &gameport_event_list) {
-               event = list_entry(node, struct gameport_event, node);
+       list_for_each_entry_safe(event, next, &gameport_event_list, node) {
                if (event->object == object) {
-                       list_del_init(node);
+                       list_del_init(&event->node);
                        gameport_free_event(event);
                }
        }
@@ -441,7 +428,6 @@ static int gameport_thread(void *nothing)
                        kthread_should_stop() || !list_empty(&gameport_event_list));
        } while (!kthread_should_stop());
 
-       printk(KERN_DEBUG "gameport: kgameportd exiting\n");
        return 0;
 }
 
@@ -453,6 +439,7 @@ static int gameport_thread(void *nothing)
 static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct gameport *gameport = to_gameport_port(dev);
+
        return sprintf(buf, "%s\n", gameport->name);
 }
 
@@ -521,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport)
 
        mutex_init(&gameport->drv_mutex);
        device_initialize(&gameport->dev);
-       dev_set_name(&gameport->dev, "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1);
+       dev_set_name(&gameport->dev, "gameport%lu",
+                       (unsigned long)atomic_inc_return(&gameport_no) - 1);
        gameport->dev.bus = &gameport_bus;
        gameport->dev.release = gameport_release_port;
        if (gameport->parent)
@@ -550,19 +538,17 @@ static void gameport_add_port(struct gameport *gameport)
        list_add_tail(&gameport->node, &gameport_list);
 
        if (gameport->io)
-               printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n",
-                       gameport->name, gameport->phys, gameport->io, gameport->speed);
+               dev_info(&gameport->dev, "%s is %s, io %#x, speed %dkHz\n",
+                        gameport->name, gameport->phys, gameport->io, gameport->speed);
        else
-               printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n",
+               dev_info(&gameport->dev, "%s is %s, speed %dkHz\n",
                        gameport->name, gameport->phys, gameport->speed);
 
        error = device_add(&gameport->dev);
        if (error)
-               printk(KERN_ERR
-                       "gameport: device_add() failed for %s (%s), error: %d\n",
+               dev_err(&gameport->dev,
+                       "device_add() failed for %s (%s), error: %d\n",
                        gameport->phys, gameport->name, error);
-       else
-               gameport->registered = 1;
 }
 
 /*
@@ -584,10 +570,8 @@ static void gameport_destroy_port(struct gameport *gameport)
                gameport->parent = NULL;
        }
 
-       if (gameport->registered) {
+       if (device_is_registered(&gameport->dev))
                device_del(&gameport->dev);
-               gameport->registered = 0;
-       }
 
        list_del_init(&gameport->node);
 
@@ -705,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv)
 
        error = driver_attach(&drv->driver);
        if (error)
-               printk(KERN_ERR
-                       "gameport: driver_attach() failed for %s, error: %d\n",
+               pr_err("driver_attach() failed for %s, error: %d\n",
                        drv->driver.name, error);
 }
 
@@ -727,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
 
        error = driver_register(&drv->driver);
        if (error) {
-               printk(KERN_ERR
-                       "gameport: driver_register() failed for %s, error: %d\n",
+               pr_err("driver_register() failed for %s, error: %d\n",
                        drv->driver.name, error);
                return error;
        }
@@ -828,7 +810,7 @@ static int __init gameport_init(void)
 
        error = bus_register(&gameport_bus);
        if (error) {
-               printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);
+               pr_err("failed to register gameport bus, error: %d\n", error);
                return error;
        }
 
@@ -836,7 +818,7 @@ static int __init gameport_init(void)
        if (IS_ERR(gameport_task)) {
                bus_unregister(&gameport_bus);
                error = PTR_ERR(gameport_task);
-               printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error);
+               pr_err("Failed to start kgameportd, error: %d\n", error);
                return error;
        }
 
index db556b71dddadc609568fbb772f0f6379a20b381..7c217848613ef2a0e2367bf32f36c5b7ed63e1d7 100644 (file)
@@ -166,7 +166,7 @@ static int ns558_isa_probe(int io)
 
 #ifdef CONFIG_PNP
 
-static struct pnp_device_id pnp_devids[] = {
+static const struct pnp_device_id pnp_devids[] = {
        { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */
        { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */
        { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */
index 47cd9eaee66a6b7ef4cd2b706ec05611681fff68..4d8ea32e8a001847746a796c43cf79dc70ae3c3c 100644 (file)
@@ -21,8 +21,6 @@
    you why the ifdefs are needed? Think about it again. -AK */
 #ifdef CONFIG_X86_64
 #  define INPUT_COMPAT_TEST is_compat_task()
-#elif defined(CONFIG_IA64)
-#  define INPUT_COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current))
 #elif defined(CONFIG_S390)
 #  define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT)
 #elif defined(CONFIG_MIPS)
index 86cb2d2196ff9792f18c39646e44983af46fcf61..41168d5f8c17bb0d1847b03695db8c095565ade5 100644 (file)
@@ -87,12 +87,14 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz)
 }
 
 /*
- * Pass event through all open handles. This function is called with
+ * Pass event first through all filters and then, if event has not been
+ * filtered out, through all open handles. This function is called with
  * dev->event_lock held and interrupts disabled.
  */
 static void input_pass_event(struct input_dev *dev,
                             unsigned int type, unsigned int code, int value)
 {
+       struct input_handler *handler;
        struct input_handle *handle;
 
        rcu_read_lock();
@@ -100,11 +102,25 @@ static void input_pass_event(struct input_dev *dev,
        handle = rcu_dereference(dev->grab);
        if (handle)
                handle->handler->event(handle, type, code, value);
-       else
-               list_for_each_entry_rcu(handle, &dev->h_list, d_node)
-                       if (handle->open)
-                               handle->handler->event(handle,
-                                                       type, code, value);
+       else {
+               bool filtered = false;
+
+               list_for_each_entry_rcu(handle, &dev->h_list, d_node) {
+                       if (!handle->open)
+                               continue;
+
+                       handler = handle->handler;
+                       if (!handler->filter) {
+                               if (filtered)
+                                       break;
+
+                               handler->event(handle, type, code, value);
+
+                       } else if (handler->filter(handle, type, code, value))
+                               filtered = true;
+               }
+       }
+
        rcu_read_unlock();
 }
 
@@ -615,12 +631,12 @@ static int input_default_setkeycode(struct input_dev *dev,
                }
        }
 
-       clear_bit(old_keycode, dev->keybit);
-       set_bit(keycode, dev->keybit);
+       __clear_bit(old_keycode, dev->keybit);
+       __set_bit(keycode, dev->keybit);
 
        for (i = 0; i < dev->keycodemax; i++) {
                if (input_fetch_keycode(dev, i) == old_keycode) {
-                       set_bit(old_keycode, dev->keybit);
+                       __set_bit(old_keycode, dev->keybit);
                        break; /* Setting the bit twice is useless, so break */
                }
        }
@@ -678,6 +694,9 @@ int input_set_keycode(struct input_dev *dev, int scancode, int keycode)
        if (retval)
                goto out;
 
+       /* Make sure KEY_RESERVED did not get enabled. */
+       __clear_bit(KEY_RESERVED, dev->keybit);
+
        /*
         * Simulate keyup event if keycode is not present
         * in the keymap anymore
@@ -705,12 +724,13 @@ EXPORT_SYMBOL(input_set_keycode);
                if (i != BITS_TO_LONGS(max)) \
                        continue;
 
-static const struct input_device_id *input_match_device(const struct input_device_id *id,
+static const struct input_device_id *input_match_device(struct input_handler *handler,
                                                        struct input_dev *dev)
 {
+       const struct input_device_id *id;
        int i;
 
-       for (; id->flags || id->driver_info; id++) {
+       for (id = handler->id_table; id->flags || id->driver_info; id++) {
 
                if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
                        if (id->bustype != dev->id.bustype)
@@ -738,7 +758,8 @@ static const struct input_device_id *input_match_device(const struct input_devic
                MATCH_BIT(ffbit,  FF_MAX);
                MATCH_BIT(swbit,  SW_MAX);
 
-               return id;
+               if (!handler->match || handler->match(handler, dev))
+                       return id;
        }
 
        return NULL;
@@ -749,10 +770,7 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han
        const struct input_device_id *id;
        int error;
 
-       if (handler->blacklist && input_match_device(handler->blacklist, dev))
-               return -ENODEV;
-
-       id = input_match_device(handler->id_table, dev);
+       id = input_match_device(handler, dev);
        if (!id)
                return -ENODEV;
 
@@ -988,6 +1006,8 @@ static int input_handlers_seq_show(struct seq_file *seq, void *v)
        union input_seq_state *state = (union input_seq_state *)&seq->private;
 
        seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name);
+       if (handler->filter)
+               seq_puts(seq, " (filter)");
        if (handler->fops)
                seq_printf(seq, " Minor=%d", handler->minor);
        seq_putc(seq, '\n');
@@ -1551,6 +1571,25 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
 }
 EXPORT_SYMBOL(input_set_capability);
 
+#define INPUT_CLEANSE_BITMASK(dev, type, bits)                         \
+       do {                                                            \
+               if (!test_bit(EV_##type, dev->evbit))                   \
+                       memset(dev->bits##bit, 0,                       \
+                               sizeof(dev->bits##bit));                \
+       } while (0)
+
+static void input_cleanse_bitmasks(struct input_dev *dev)
+{
+       INPUT_CLEANSE_BITMASK(dev, KEY, key);
+       INPUT_CLEANSE_BITMASK(dev, REL, rel);
+       INPUT_CLEANSE_BITMASK(dev, ABS, abs);
+       INPUT_CLEANSE_BITMASK(dev, MSC, msc);
+       INPUT_CLEANSE_BITMASK(dev, LED, led);
+       INPUT_CLEANSE_BITMASK(dev, SND, snd);
+       INPUT_CLEANSE_BITMASK(dev, FF, ff);
+       INPUT_CLEANSE_BITMASK(dev, SW, sw);
+}
+
 /**
  * input_register_device - register device with input core
  * @dev: device to be registered
@@ -1570,13 +1609,19 @@ int input_register_device(struct input_dev *dev)
        const char *path;
        int error;
 
+       /* Every input device generates EV_SYN/SYN_REPORT events. */
        __set_bit(EV_SYN, dev->evbit);
 
+       /* KEY_RESERVED is not supposed to be transmitted to userspace. */
+       __clear_bit(KEY_RESERVED, dev->keybit);
+
+       /* Make sure that bitmasks not mentioned in dev->evbit are clean. */
+       input_cleanse_bitmasks(dev);
+
        /*
         * If delay and period are pre-set by the driver, then autorepeating
         * is handled by the driver itself and we don't do it in input.c.
         */
-
        init_timer(&dev->timer);
        if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) {
                dev->timer.data = (long) dev;
@@ -1776,7 +1821,16 @@ int input_register_handle(struct input_handle *handle)
        error = mutex_lock_interruptible(&dev->mutex);
        if (error)
                return error;
-       list_add_tail_rcu(&handle->d_node, &dev->h_list);
+
+       /*
+        * Filters go to the head of the list, normal handlers
+        * to the tail.
+        */
+       if (handler->filter)
+               list_add_rcu(&handle->d_node, &dev->h_list);
+       else
+               list_add_tail_rcu(&handle->d_node, &dev->h_list);
+
        mutex_unlock(&dev->mutex);
 
        /*
index b1bd6dd322864d0bd04c2f9a48c9f80b3217dcce..c52bec4d0530f632667031e023e980e78dc4fcaf 100644 (file)
@@ -286,6 +286,8 @@ static int joydev_open(struct inode *inode, struct file *file)
                goto err_free_client;
 
        file->private_data = client;
+       nonseekable_open(inode, file);
+
        return 0;
 
  err_free_client:
@@ -775,6 +777,20 @@ static void joydev_cleanup(struct joydev *joydev)
                input_close_device(handle);
 }
 
+
+static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
+{
+       /* Avoid touchpads and touchscreens */
+       if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit))
+               return false;
+
+       /* Avoid tablets, digitisers and similar devices */
+       if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit))
+               return false;
+
+       return true;
+}
+
 static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
                          const struct input_device_id *id)
 {
@@ -894,22 +910,6 @@ static void joydev_disconnect(struct input_handle *handle)
        put_device(&joydev->dev);
 }
 
-static const struct input_device_id joydev_blacklist[] = {
-       {
-               .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
-                               INPUT_DEVICE_ID_MATCH_KEYBIT,
-               .evbit = { BIT_MASK(EV_KEY) },
-               .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
-       },      /* Avoid itouchpads and touchscreens */
-       {
-               .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
-                               INPUT_DEVICE_ID_MATCH_KEYBIT,
-               .evbit = { BIT_MASK(EV_KEY) },
-               .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) },
-       },      /* Avoid tablets, digitisers and similar devices */
-       { }     /* Terminating entry */
-};
-
 static const struct input_device_id joydev_ids[] = {
        {
                .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
@@ -936,13 +936,13 @@ MODULE_DEVICE_TABLE(input, joydev_ids);
 
 static struct input_handler joydev_handler = {
        .event          = joydev_event,
+       .match          = joydev_match,
        .connect        = joydev_connect,
        .disconnect     = joydev_disconnect,
        .fops           = &joydev_fops,
        .minor          = JOYDEV_MINOR_BASE,
        .name           = "joydev",
        .id_table       = joydev_ids,
-       .blacklist      = joydev_blacklist,
 };
 
 static int __init joydev_init(void)
index b11419590cfe21e61da8324f233d86fcf7a12209..5b596165b571f72976aeedd30fc6ee5eb6442994 100644 (file)
@@ -221,6 +221,7 @@ config JOYSTICK_DB9
 config JOYSTICK_GAMECON
        tristate "Multisystem, NES, SNES, N64, PSX joysticks and gamepads"
        depends on PARPORT
+       select INPUT_FF_MEMLESS
        ---help---
          Say Y here if you have a Nintendo Entertainment System gamepad,
          Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad,
index 07a32aff5a31340cdd87b6285d77f041326f73aa..ae998d99a5ae619b87d66bd8e20ebf5c1c2a5571 100644 (file)
@@ -30,6 +30,8 @@
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/module.h>
@@ -61,48 +63,73 @@ MODULE_PARM_DESC(map3, "Describes third set of devices");
 
 /* see also gs_psx_delay parameter in PSX support section */
 
-#define GC_SNES                1
-#define GC_NES         2
-#define GC_NES4                3
-#define GC_MULTI       4
-#define GC_MULTI2      5
-#define GC_N64         6
-#define GC_PSX         7
-#define GC_DDR         8
-#define GC_SNESMOUSE   9
-
-#define GC_MAX         9
+enum gc_type {
+       GC_NONE = 0,
+       GC_SNES,
+       GC_NES,
+       GC_NES4,
+       GC_MULTI,
+       GC_MULTI2,
+       GC_N64,
+       GC_PSX,
+       GC_DDR,
+       GC_SNESMOUSE,
+       GC_MAX
+};
 
 #define GC_REFRESH_TIME        HZ/100
 
+struct gc_pad {
+       struct input_dev *dev;
+       enum gc_type type;
+       char phys[32];
+};
+
 struct gc {
        struct pardevice *pd;
+       struct gc_pad pads[GC_MAX_DEVICES];
        struct input_dev *dev[GC_MAX_DEVICES];
        struct timer_list timer;
-       unsigned char pads[GC_MAX + 1];
+       int pad_count[GC_MAX];
        int used;
        struct mutex mutex;
-       char phys[GC_MAX_DEVICES][32];
+};
+
+struct gc_subdev {
+       unsigned int idx;
 };
 
 static struct gc *gc_base[3];
 
-static int gc_status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 };
+static const int gc_status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 };
+
+static const char *gc_names[] = {
+       NULL, "SNES pad", "NES pad", "NES FourPort", "Multisystem joystick",
+       "Multisystem 2-button joystick", "N64 controller", "PSX controller",
+       "PSX DDR controller", "SNES mouse"
+};
 
-static char *gc_names[] = { NULL, "SNES pad", "NES pad", "NES FourPort", "Multisystem joystick",
-                               "Multisystem 2-button joystick", "N64 controller", "PSX controller",
-                               "PSX DDR controller", "SNES mouse" };
 /*
  * N64 support.
  */
 
-static unsigned char gc_n64_bytes[] = { 0, 1, 13, 15, 14, 12, 10, 11, 2, 3 };
-static short gc_n64_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TRIGGER, BTN_START };
+static const unsigned char gc_n64_bytes[] = { 0, 1, 13, 15, 14, 12, 10, 11, 2, 3 };
+static const short gc_n64_btn[] = {
+       BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z,
+       BTN_TL, BTN_TR, BTN_TRIGGER, BTN_START
+};
 
 #define GC_N64_LENGTH          32              /* N64 bit length, not including stop bit */
-#define GC_N64_REQUEST_LENGTH  37              /* transmit request sequence is 9 bits long */
+#define GC_N64_STOP_LENGTH     5               /* Length of encoded stop bit */
+#define GC_N64_CMD_00          0x11111111UL
+#define GC_N64_CMD_01          0xd1111111UL
+#define GC_N64_CMD_03          0xdd111111UL
+#define GC_N64_CMD_1b          0xdd1dd111UL
+#define GC_N64_CMD_c0          0x111111ddUL
+#define GC_N64_CMD_80          0x1111111dUL
+#define GC_N64_STOP_BIT                0x1d            /* Encoded stop bit */
+#define GC_N64_REQUEST_DATA    GC_N64_CMD_01   /* the request data command */
 #define GC_N64_DELAY           133             /* delay between transmit request, and response ready (us) */
-#define GC_N64_REQUEST         0x1dd1111111ULL /* the request data command (encoded for 000000011) */
 #define GC_N64_DWS             3               /* delay between write segments (required for sound playback because of ISA DMA) */
                                                /* GC_N64_DWS > 24 is known to fail */
 #define GC_N64_POWER_W         0xe2            /* power during write (transmit request) */
@@ -113,9 +140,41 @@ static short gc_n64_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL,
                                                /* than 123 us */
 #define GC_N64_CLOCK           0x02            /* clock bits for read */
 
+/*
+ * Used for rumble code.
+ */
+
+/* Send encoded command */
+static void gc_n64_send_command(struct gc *gc, unsigned long cmd,
+                               unsigned char target)
+{
+       struct parport *port = gc->pd->port;
+       int i;
+
+       for (i = 0; i < GC_N64_LENGTH; i++) {
+               unsigned char data = (cmd >> i) & 1 ? target : 0;
+               parport_write_data(port, GC_N64_POWER_W | data);
+               udelay(GC_N64_DWS);
+       }
+}
+
+/* Send stop bit */
+static void gc_n64_send_stop_bit(struct gc *gc, unsigned char target)
+{
+       struct parport *port = gc->pd->port;
+       int i;
+
+       for (i = 0; i < GC_N64_STOP_LENGTH; i++) {
+               unsigned char data = (GC_N64_STOP_BIT >> i) & 1 ? target : 0;
+               parport_write_data(port, GC_N64_POWER_W | data);
+               udelay(GC_N64_DWS);
+       }
+}
+
 /*
  * gc_n64_read_packet() reads an N64 packet.
- * Each pad uses one bit per byte. So all pads connected to this port are read in parallel.
+ * Each pad uses one bit per byte. So all pads connected to this port
+ * are read in parallel.
  */
 
 static void gc_n64_read_packet(struct gc *gc, unsigned char *data)
@@ -128,14 +187,13 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data)
  */
 
        local_irq_save(flags);
-       for (i = 0; i < GC_N64_REQUEST_LENGTH; i++) {
-               parport_write_data(gc->pd->port, GC_N64_POWER_W | ((GC_N64_REQUEST >> i) & 1 ? GC_N64_OUT : 0));
-               udelay(GC_N64_DWS);
-       }
+       gc_n64_send_command(gc, GC_N64_REQUEST_DATA, GC_N64_OUT);
+       gc_n64_send_stop_bit(gc, GC_N64_OUT);
        local_irq_restore(flags);
 
 /*
- * Wait for the pad response to be loaded into the 33-bit register of the adapter
+ * Wait for the pad response to be loaded into the 33-bit register
+ * of the adapter.
  */
 
        udelay(GC_N64_DELAY);
@@ -146,13 +204,15 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data)
 
        for (i = 0; i < GC_N64_LENGTH; i++) {
                parport_write_data(gc->pd->port, GC_N64_POWER_R);
+               udelay(2);
                data[i] = parport_read_status(gc->pd->port);
                parport_write_data(gc->pd->port, GC_N64_POWER_R | GC_N64_CLOCK);
         }
 
 /*
- * We must wait 200 ms here for the controller to reinitialize before the next read request.
- * No worries as long as gc_read is polled less frequently than this.
+ * We must wait 200 ms here for the controller to reinitialize before
+ * the next read request. No worries as long as gc_read is polled less
+ * frequently than this.
  */
 
 }
@@ -160,45 +220,112 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data)
 static void gc_n64_process_packet(struct gc *gc)
 {
        unsigned char data[GC_N64_LENGTH];
-       signed char axes[2];
        struct input_dev *dev;
        int i, j, s;
+       signed char x, y;
 
        gc_n64_read_packet(gc, data);
 
        for (i = 0; i < GC_MAX_DEVICES; i++) {
 
-               dev = gc->dev[i];
-               if (!dev)
+               if (gc->pads[i].type != GC_N64)
                        continue;
 
+               dev = gc->pads[i].dev;
                s = gc_status_bit[i];
 
-               if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) {
+               if (s & ~(data[8] | data[9])) {
 
-                       axes[0] = axes[1] = 0;
+                       x = y = 0;
 
                        for (j = 0; j < 8; j++) {
                                if (data[23 - j] & s)
-                                       axes[0] |= 1 << j;
+                                       x |= 1 << j;
                                if (data[31 - j] & s)
-                                       axes[1] |= 1 << j;
+                                       y |= 1 << j;
                        }
 
-                       input_report_abs(dev, ABS_X,  axes[0]);
-                       input_report_abs(dev, ABS_Y, -axes[1]);
+                       input_report_abs(dev, ABS_X,  x);
+                       input_report_abs(dev, ABS_Y, -y);
 
-                       input_report_abs(dev, ABS_HAT0X, !(s & data[6]) - !(s & data[7]));
-                       input_report_abs(dev, ABS_HAT0Y, !(s & data[4]) - !(s & data[5]));
+                       input_report_abs(dev, ABS_HAT0X,
+                                        !(s & data[6]) - !(s & data[7]));
+                       input_report_abs(dev, ABS_HAT0Y,
+                                        !(s & data[4]) - !(s & data[5]));
 
                        for (j = 0; j < 10; j++)
-                               input_report_key(dev, gc_n64_btn[j], s & data[gc_n64_bytes[j]]);
+                               input_report_key(dev, gc_n64_btn[j],
+                                                s & data[gc_n64_bytes[j]]);
 
                        input_sync(dev);
                }
        }
 }
 
+static int gc_n64_play_effect(struct input_dev *dev, void *data,
+                             struct ff_effect *effect)
+{
+       int i;
+       unsigned long flags;
+       struct gc *gc = input_get_drvdata(dev);
+       struct gc_subdev *sdev = data;
+       unsigned char target = 1 << sdev->idx; /* select desired pin */
+
+       if (effect->type == FF_RUMBLE) {
+               struct ff_rumble_effect *rumble = &effect->u.rumble;
+               unsigned int cmd =
+                       rumble->strong_magnitude || rumble->weak_magnitude ?
+                       GC_N64_CMD_01 : GC_N64_CMD_00;
+
+               local_irq_save(flags);
+
+               /* Init Rumble - 0x03, 0x80, 0x01, (34)0x80 */
+               gc_n64_send_command(gc, GC_N64_CMD_03, target);
+               gc_n64_send_command(gc, GC_N64_CMD_80, target);
+               gc_n64_send_command(gc, GC_N64_CMD_01, target);
+               for (i = 0; i < 32; i++)
+                       gc_n64_send_command(gc, GC_N64_CMD_80, target);
+               gc_n64_send_stop_bit(gc, target);
+
+               udelay(GC_N64_DELAY);
+
+               /* Now start or stop it - 0x03, 0xc0, 0zx1b, (32)0x01/0x00 */
+               gc_n64_send_command(gc, GC_N64_CMD_03, target);
+               gc_n64_send_command(gc, GC_N64_CMD_c0, target);
+               gc_n64_send_command(gc, GC_N64_CMD_1b, target);
+               for (i = 0; i < 32; i++)
+                       gc_n64_send_command(gc, cmd, target);
+               gc_n64_send_stop_bit(gc, target);
+
+               local_irq_restore(flags);
+
+       }
+
+       return 0;
+}
+
+static int __init gc_n64_init_ff(struct input_dev *dev, int i)
+{
+       struct gc_subdev *sdev;
+       int err;
+
+       sdev = kmalloc(sizeof(*sdev), GFP_KERNEL);
+       if (!sdev)
+               return -ENOMEM;
+
+       sdev->idx = i;
+
+       input_set_capability(dev, EV_FF, FF_RUMBLE);
+
+       err = input_ff_create_memless(dev, sdev, gc_n64_play_effect);
+       if (err) {
+               kfree(sdev);
+               return err;
+       }
+
+       return 0;
+}
+
 /*
  * NES/SNES support.
  */
@@ -214,9 +341,11 @@ static void gc_n64_process_packet(struct gc *gc)
 #define GC_NES_CLOCK   0x01
 #define GC_NES_LATCH   0x02
 
-static unsigned char gc_nes_bytes[] = { 0, 1, 2, 3 };
-static unsigned char gc_snes_bytes[] = { 8, 0, 2, 3, 9, 1, 10, 11 };
-static short gc_snes_btn[] = { BTN_A, BTN_B, BTN_SELECT, BTN_START, BTN_X, BTN_Y, BTN_TL, BTN_TR };
+static const unsigned char gc_nes_bytes[] = { 0, 1, 2, 3 };
+static const unsigned char gc_snes_bytes[] = { 8, 0, 2, 3, 9, 1, 10, 11 };
+static const short gc_snes_btn[] = {
+       BTN_A, BTN_B, BTN_SELECT, BTN_START, BTN_X, BTN_Y, BTN_TL, BTN_TR
+};
 
 /*
  * gc_nes_read_packet() reads a NES/SNES packet.
@@ -244,40 +373,51 @@ static void gc_nes_read_packet(struct gc *gc, int length, unsigned char *data)
 static void gc_nes_process_packet(struct gc *gc)
 {
        unsigned char data[GC_SNESMOUSE_LENGTH];
+       struct gc_pad *pad;
        struct input_dev *dev;
        int i, j, s, len;
        char x_rel, y_rel;
 
-       len = gc->pads[GC_SNESMOUSE] ? GC_SNESMOUSE_LENGTH :
-                       (gc->pads[GC_SNES] ? GC_SNES_LENGTH : GC_NES_LENGTH);
+       len = gc->pad_count[GC_SNESMOUSE] ? GC_SNESMOUSE_LENGTH :
+                       (gc->pad_count[GC_SNES] ? GC_SNES_LENGTH : GC_NES_LENGTH);
 
        gc_nes_read_packet(gc, len, data);
 
        for (i = 0; i < GC_MAX_DEVICES; i++) {
 
+               pad = &gc->pads[i];
                dev = gc->dev[i];
-               if (!dev)
-                       continue;
-
                s = gc_status_bit[i];
 
-               if (s & (gc->pads[GC_NES] | gc->pads[GC_SNES])) {
+               switch (pad->type) {
+
+               case GC_NES:
+
                        input_report_abs(dev, ABS_X, !(s & data[6]) - !(s & data[7]));
                        input_report_abs(dev, ABS_Y, !(s & data[4]) - !(s & data[5]));
-               }
 
-               if (s & gc->pads[GC_NES])
                        for (j = 0; j < 4; j++)
-                               input_report_key(dev, gc_snes_btn[j], s & data[gc_nes_bytes[j]]);
+                               input_report_key(dev, gc_snes_btn[j],
+                                                s & data[gc_nes_bytes[j]]);
+                       input_sync(dev);
+                       break;
+
+               case GC_SNES:
+
+                       input_report_abs(dev, ABS_X, !(s & data[6]) - !(s & data[7]));
+                       input_report_abs(dev, ABS_Y, !(s & data[4]) - !(s & data[5]));
 
-               if (s & gc->pads[GC_SNES])
                        for (j = 0; j < 8; j++)
-                               input_report_key(dev, gc_snes_btn[j], s & data[gc_snes_bytes[j]]);
+                               input_report_key(dev, gc_snes_btn[j],
+                                                s & data[gc_snes_bytes[j]]);
+                       input_sync(dev);
+                       break;
 
-               if (s & gc->pads[GC_SNESMOUSE]) {
+               case GC_SNESMOUSE:
                        /*
-                        * The 4 unused bits from SNES controllers appear to be ID bits
-                        * so use them to make sure iwe are dealing with a mouse.
+                        * The 4 unused bits from SNES controllers appear
+                        * to be ID bits so use them to make sure we are
+                        * dealing with a mouse.
                         * gamepad is connected. This is important since
                         * my SNES gamepad sends 1's for bits 16-31, which
                         * cause the mouse pointer to quickly move to the
@@ -310,9 +450,14 @@ static void gc_nes_process_packet(struct gc *gc)
                                                y_rel = -y_rel;
                                        input_report_rel(dev, REL_Y, y_rel);
                                }
+
+                               input_sync(dev);
                        }
+                       break;
+
+               default:
+                       break;
                }
-               input_sync(dev);
        }
 }
 
@@ -340,29 +485,35 @@ static void gc_multi_read_packet(struct gc *gc, int length, unsigned char *data)
 static void gc_multi_process_packet(struct gc *gc)
 {
        unsigned char data[GC_MULTI2_LENGTH];
+       int data_len = gc->pad_count[GC_MULTI2] ? GC_MULTI2_LENGTH : GC_MULTI_LENGTH;
+       struct gc_pad *pad;
        struct input_dev *dev;
        int i, s;
 
-       gc_multi_read_packet(gc, gc->pads[GC_MULTI2] ? GC_MULTI2_LENGTH : GC_MULTI_LENGTH, data);
+       gc_multi_read_packet(gc, data_len, data);
 
        for (i = 0; i < GC_MAX_DEVICES; i++) {
-
-               dev = gc->dev[i];
-               if (!dev)
-                       continue;
-
+               pad = &gc->pads[i];
+               dev = pad->dev;
                s = gc_status_bit[i];
 
-               if (s & (gc->pads[GC_MULTI] | gc->pads[GC_MULTI2])) {
-                       input_report_abs(dev, ABS_X,  !(s & data[2]) - !(s & data[3]));
-                       input_report_abs(dev, ABS_Y,  !(s & data[0]) - !(s & data[1]));
-                       input_report_key(dev, BTN_TRIGGER, s & data[4]);
-               }
-
-               if (s & gc->pads[GC_MULTI2])
+               switch (pad->type) {
+               case GC_MULTI2:
                        input_report_key(dev, BTN_THUMB, s & data[5]);
+                       /* fall through */
 
-               input_sync(dev);
+               case GC_MULTI:
+                       input_report_abs(dev, ABS_X,
+                                        !(s & data[2]) - !(s & data[3]));
+                       input_report_abs(dev, ABS_Y,
+                                        !(s & data[0]) - !(s & data[1]));
+                       input_report_key(dev, BTN_TRIGGER, s & data[4]);
+                       input_sync(dev);
+                       break;
+
+               default:
+                       break;
+               }
        }
 }
 
@@ -398,30 +549,41 @@ static int gc_psx_delay = GC_PSX_DELAY;
 module_param_named(psx_delay, gc_psx_delay, uint, 0);
 MODULE_PARM_DESC(psx_delay, "Delay when accessing Sony PSX controller (usecs)");
 
-static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y };
-static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y,
-                               BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR };
-static short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 };
+static const short gc_psx_abs[] = {
+       ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y
+};
+static const short gc_psx_btn[] = {
+       BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y,
+       BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR
+};
+static const short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 };
 
 /*
  * gc_psx_command() writes 8bit command and reads 8bit data from
  * the psx pad.
  */
 
-static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_MAX_DEVICES])
+static void gc_psx_command(struct gc *gc, int b, unsigned char *data)
 {
+       struct parport *port = gc->pd->port;
        int i, j, cmd, read;
 
-       for (i = 0; i < GC_MAX_DEVICES; i++)
-               data[i] = 0;
+       memset(data, 0, GC_MAX_DEVICES);
 
        for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) {
                cmd = (b & 1) ? GC_PSX_COMMAND : 0;
-               parport_write_data(gc->pd->port, cmd | GC_PSX_POWER);
+               parport_write_data(port, cmd | GC_PSX_POWER);
                udelay(gc_psx_delay);
-               read = parport_read_status(gc->pd->port) ^ 0x80;
-               for (j = 0; j < GC_MAX_DEVICES; j++)
-                       data[j] |= (read & gc_status_bit[j] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) ? (1 << i) : 0;
+
+               read = parport_read_status(port) ^ 0x80;
+
+               for (j = 0; j < GC_MAX_DEVICES; j++) {
+                       struct gc_pad *pad = &gc->pads[i];
+
+                       if (pad->type == GC_PSX || pad->type == GC_DDR)
+                               data[j] |= (read & gc_status_bit[j]) ? (1 << i) : 0;
+               }
+
                parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER);
                udelay(gc_psx_delay);
        }
@@ -432,31 +594,40 @@ static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_MAX_DEVIC
  * device identifier code.
  */
 
-static void gc_psx_read_packet(struct gc *gc, unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES],
+static void gc_psx_read_packet(struct gc *gc,
+                              unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES],
                               unsigned char id[GC_MAX_DEVICES])
 {
        int i, j, max_len = 0;
        unsigned long flags;
        unsigned char data2[GC_MAX_DEVICES];
 
-       parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER);  /* Select pad */
+       /* Select pad */
+       parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER);
        udelay(gc_psx_delay);
-       parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER);                  /* Deselect, begin command */
+       /* Deselect, begin command */
+       parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER);
        udelay(gc_psx_delay);
 
        local_irq_save(flags);
 
-       gc_psx_command(gc, 0x01, data2);                                                /* Access pad */
-       gc_psx_command(gc, 0x42, id);                                                   /* Get device ids */
-       gc_psx_command(gc, 0, data2);                                                   /* Dump status */
+       gc_psx_command(gc, 0x01, data2);        /* Access pad */
+       gc_psx_command(gc, 0x42, id);           /* Get device ids */
+       gc_psx_command(gc, 0, data2);           /* Dump status */
+
+       /* Find the longest pad */
+       for (i = 0; i < GC_MAX_DEVICES; i++) {
+               struct gc_pad *pad = &gc->pads[i];
 
-       for (i =0; i < GC_MAX_DEVICES; i++)                                                             /* Find the longest pad */
-               if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR]))
-                       && (GC_PSX_LEN(id[i]) > max_len)
-                       && (GC_PSX_LEN(id[i]) <= GC_PSX_BYTES))
+               if ((pad->type == GC_PSX || pad->type == GC_DDR) &&
+                   GC_PSX_LEN(id[i]) > max_len &&
+                   GC_PSX_LEN(id[i]) <= GC_PSX_BYTES) {
                        max_len = GC_PSX_LEN(id[i]);
+               }
+       }
 
-       for (i = 0; i < max_len; i++) {                                         /* Read in all the data */
+       /* Read in all the data */
+       for (i = 0; i < max_len; i++) {
                gc_psx_command(gc, 0, data2);
                for (j = 0; j < GC_MAX_DEVICES; j++)
                        data[j][i] = data2[j];
@@ -466,86 +637,104 @@ static void gc_psx_read_packet(struct gc *gc, unsigned char data[GC_MAX_DEVICES]
 
        parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER);
 
-       for(i = 0; i < GC_MAX_DEVICES; i++)                                                             /* Set id's to the real value */
+       /* Set id's to the real value */
+       for (i = 0; i < GC_MAX_DEVICES; i++)
                id[i] = GC_PSX_ID(id[i]);
 }
 
-static void gc_psx_process_packet(struct gc *gc)
+static void gc_psx_report_one(struct gc_pad *pad, unsigned char psx_type,
+                             unsigned char *data)
 {
-       unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES];
-       unsigned char id[GC_MAX_DEVICES];
-       struct input_dev *dev;
-       int i, j;
+       struct input_dev *dev = pad->dev;
+       int i;
 
-       gc_psx_read_packet(gc, data, id);
+       switch (psx_type) {
 
-       for (i = 0; i < GC_MAX_DEVICES; i++) {
+       case GC_PSX_RUMBLE:
 
-               dev = gc->dev[i];
-               if (!dev)
-                       continue;
+               input_report_key(dev, BTN_THUMBL, ~data[0] & 0x04);
+               input_report_key(dev, BTN_THUMBR, ~data[0] & 0x02);
 
-               switch (id[i]) {
+       case GC_PSX_NEGCON:
+       case GC_PSX_ANALOG:
 
-                       case GC_PSX_RUMBLE:
+               if (pad->type == GC_DDR) {
+                       for (i = 0; i < 4; i++)
+                               input_report_key(dev, gc_psx_ddr_btn[i],
+                                                ~data[0] & (0x10 << i));
+               } else {
+                       for (i = 0; i < 4; i++)
+                               input_report_abs(dev, gc_psx_abs[i + 2],
+                                                data[i + 2]);
 
-                               input_report_key(dev, BTN_THUMBL, ~data[i][0] & 0x04);
-                               input_report_key(dev, BTN_THUMBR, ~data[i][0] & 0x02);
+                       input_report_abs(dev, ABS_X,
+                               !!(data[0] & 0x80) * 128 + !(data[0] & 0x20) * 127);
+                       input_report_abs(dev, ABS_Y,
+                               !!(data[0] & 0x10) * 128 + !(data[0] & 0x40) * 127);
+               }
 
-                       case GC_PSX_NEGCON:
-                       case GC_PSX_ANALOG:
+               for (i = 0; i < 8; i++)
+                       input_report_key(dev, gc_psx_btn[i], ~data[1] & (1 << i));
 
-                               if (gc->pads[GC_DDR] & gc_status_bit[i]) {
-                                       for(j = 0; j < 4; j++)
-                                               input_report_key(dev, gc_psx_ddr_btn[j], ~data[i][0] & (0x10 << j));
-                               } else {
-                                       for (j = 0; j < 4; j++)
-                                               input_report_abs(dev, gc_psx_abs[j + 2], data[i][j + 2]);
+               input_report_key(dev, BTN_START,  ~data[0] & 0x08);
+               input_report_key(dev, BTN_SELECT, ~data[0] & 0x01);
 
-                                       input_report_abs(dev, ABS_X, 128 + !(data[i][0] & 0x20) * 127 - !(data[i][0] & 0x80) * 128);
-                                       input_report_abs(dev, ABS_Y, 128 + !(data[i][0] & 0x40) * 127 - !(data[i][0] & 0x10) * 128);
-                               }
+               input_sync(dev);
 
-                               for (j = 0; j < 8; j++)
-                                       input_report_key(dev, gc_psx_btn[j], ~data[i][1] & (1 << j));
+               break;
 
-                               input_report_key(dev, BTN_START,  ~data[i][0] & 0x08);
-                               input_report_key(dev, BTN_SELECT, ~data[i][0] & 0x01);
+       case GC_PSX_NORMAL:
 
-                               input_sync(dev);
+               if (pad->type == GC_DDR) {
+                       for (i = 0; i < 4; i++)
+                               input_report_key(dev, gc_psx_ddr_btn[i],
+                                                ~data[0] & (0x10 << i));
+               } else {
+                       input_report_abs(dev, ABS_X,
+                               !!(data[0] & 0x80) * 128 + !(data[0] & 0x20) * 127);
+                       input_report_abs(dev, ABS_Y,
+                               !!(data[0] & 0x10) * 128 + !(data[0] & 0x40) * 127);
 
-                               break;
-
-                       case GC_PSX_NORMAL:
-                               if (gc->pads[GC_DDR] & gc_status_bit[i]) {
-                                       for(j = 0; j < 4; j++)
-                                               input_report_key(dev, gc_psx_ddr_btn[j], ~data[i][0] & (0x10 << j));
-                               } else {
-                                       input_report_abs(dev, ABS_X, 128 + !(data[i][0] & 0x20) * 127 - !(data[i][0] & 0x80) * 128);
-                                       input_report_abs(dev, ABS_Y, 128 + !(data[i][0] & 0x40) * 127 - !(data[i][0] & 0x10) * 128);
-
-                                       /* for some reason if the extra axes are left unset they drift */
-                                       /* for (j = 0; j < 4; j++)
-                                               input_report_abs(dev, gc_psx_abs[j + 2], 128);
-                                        * This needs to be debugged properly,
-                                        * maybe fuzz processing needs to be done in input_sync()
-                                        *                               --vojtech
-                                        */
-                               }
+                       /*
+                        * For some reason if the extra axes are left unset
+                        * they drift.
+                        * for (i = 0; i < 4; i++)
+                               input_report_abs(dev, gc_psx_abs[i + 2], 128);
+                        * This needs to be debugged properly,
+                        * maybe fuzz processing needs to be done
+                        * in input_sync()
+                        *                               --vojtech
+                        */
+               }
 
-                               for (j = 0; j < 8; j++)
-                                       input_report_key(dev, gc_psx_btn[j], ~data[i][1] & (1 << j));
+               for (i = 0; i < 8; i++)
+                       input_report_key(dev, gc_psx_btn[i], ~data[1] & (1 << i));
 
-                               input_report_key(dev, BTN_START,  ~data[i][0] & 0x08);
-                               input_report_key(dev, BTN_SELECT, ~data[i][0] & 0x01);
+               input_report_key(dev, BTN_START,  ~data[0] & 0x08);
+               input_report_key(dev, BTN_SELECT, ~data[0] & 0x01);
 
-                               input_sync(dev);
+               input_sync(dev);
 
-                               break;
+               break;
 
-                       case 0: /* not a pad, ignore */
-                               break;
-               }
+       default: /* not a pad, ignore */
+               break;
+       }
+}
+
+static void gc_psx_process_packet(struct gc *gc)
+{
+       unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES];
+       unsigned char id[GC_MAX_DEVICES];
+       struct gc_pad *pad;
+       int i;
+
+       gc_psx_read_packet(gc, data, id);
+
+       for (i = 0; i < GC_MAX_DEVICES; i++) {
+               pad = &gc->pads[i];
+               if (pad->type == GC_PSX || pad->type == GC_DDR)
+                       gc_psx_report_one(pad, id[i], data[i]);
        }
 }
 
@@ -561,28 +750,31 @@ static void gc_timer(unsigned long private)
  * N64 pads - must be read first, any read confuses them for 200 us
  */
 
-       if (gc->pads[GC_N64])
+       if (gc->pad_count[GC_N64])
                gc_n64_process_packet(gc);
 
 /*
  * NES and SNES pads or mouse
  */
 
-       if (gc->pads[GC_NES] || gc->pads[GC_SNES] || gc->pads[GC_SNESMOUSE])
+       if (gc->pad_count[GC_NES] ||
+           gc->pad_count[GC_SNES] ||
+           gc->pad_count[GC_SNESMOUSE]) {
                gc_nes_process_packet(gc);
+       }
 
 /*
  * Multi and Multi2 joysticks
  */
 
-       if (gc->pads[GC_MULTI] || gc->pads[GC_MULTI2])
+       if (gc->pad_count[GC_MULTI] || gc->pad_count[GC_MULTI2])
                gc_multi_process_packet(gc);
 
 /*
  * PSX controllers
  */
 
-       if (gc->pads[GC_PSX] || gc->pads[GC_DDR])
+       if (gc->pad_count[GC_PSX] || gc->pad_count[GC_DDR])
                gc_psx_process_packet(gc);
 
        mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME);
@@ -622,25 +814,29 @@ static void gc_close(struct input_dev *dev)
 
 static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
 {
+       struct gc_pad *pad = &gc->pads[idx];
        struct input_dev *input_dev;
        int i;
-
-       if (!pad_type)
-               return 0;
+       int err;
 
        if (pad_type < 1 || pad_type > GC_MAX) {
-               printk(KERN_WARNING "gamecon.c: Pad type %d unknown\n", pad_type);
+               pr_err("Pad type %d unknown\n", pad_type);
                return -EINVAL;
        }
 
-       gc->dev[idx] = input_dev = input_allocate_device();
+       pad->dev = input_dev = input_allocate_device();
        if (!input_dev) {
-               printk(KERN_ERR "gamecon.c: Not enough memory for input device\n");
+               pr_err("Not enough memory for input device\n");
                return -ENOMEM;
        }
 
+       pad->type = pad_type;
+
+       snprintf(pad->phys, sizeof(pad->phys),
+                "%s/input%d", gc->pd->port->name, idx);
+
        input_dev->name = gc_names[pad_type];
-       input_dev->phys = gc->phys[idx];
+       input_dev->phys = pad->phys;
        input_dev->id.bustype = BUS_PARPORT;
        input_dev->id.vendor = 0x0001;
        input_dev->id.product = pad_type;
@@ -659,61 +855,76 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
        } else
                input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
 
-       gc->pads[0] |= gc_status_bit[idx];
-       gc->pads[pad_type] |= gc_status_bit[idx];
+       gc->pad_count[pad_type]++;
 
        switch (pad_type) {
 
-               case GC_N64:
-                       for (i = 0; i < 10; i++)
-                               set_bit(gc_n64_btn[i], input_dev->keybit);
-
-                       for (i = 0; i < 2; i++) {
-                               input_set_abs_params(input_dev, ABS_X + i, -127, 126, 0, 2);
-                               input_set_abs_params(input_dev, ABS_HAT0X + i, -1, 1, 0, 0);
-                       }
-
-                       break;
-
-               case GC_SNESMOUSE:
-                       set_bit(BTN_LEFT, input_dev->keybit);
-                       set_bit(BTN_RIGHT, input_dev->keybit);
-                       set_bit(REL_X, input_dev->relbit);
-                       set_bit(REL_Y, input_dev->relbit);
-                       break;
-
-               case GC_SNES:
-                       for (i = 4; i < 8; i++)
-                               set_bit(gc_snes_btn[i], input_dev->keybit);
-               case GC_NES:
-                       for (i = 0; i < 4; i++)
-                               set_bit(gc_snes_btn[i], input_dev->keybit);
-                       break;
-
-               case GC_MULTI2:
-                       set_bit(BTN_THUMB, input_dev->keybit);
-               case GC_MULTI:
-                       set_bit(BTN_TRIGGER, input_dev->keybit);
-                       break;
-
-               case GC_PSX:
-                       for (i = 0; i < 6; i++)
-                               input_set_abs_params(input_dev, gc_psx_abs[i], 4, 252, 0, 2);
-                       for (i = 0; i < 12; i++)
-                               set_bit(gc_psx_btn[i], input_dev->keybit);
+       case GC_N64:
+               for (i = 0; i < 10; i++)
+                       __set_bit(gc_n64_btn[i], input_dev->keybit);
 
-                       break;
+               for (i = 0; i < 2; i++) {
+                       input_set_abs_params(input_dev, ABS_X + i, -127, 126, 0, 2);
+                       input_set_abs_params(input_dev, ABS_HAT0X + i, -1, 1, 0, 0);
+               }
 
-               case GC_DDR:
-                       for (i = 0; i < 4; i++)
-                               set_bit(gc_psx_ddr_btn[i], input_dev->keybit);
-                       for (i = 0; i < 12; i++)
-                               set_bit(gc_psx_btn[i], input_dev->keybit);
+               err = gc_n64_init_ff(input_dev, idx);
+               if (err) {
+                       pr_warning("Failed to initiate rumble for N64 device %d\n", idx);
+                       goto err_free_dev;
+               }
 
-                       break;
+               break;
+
+       case GC_SNESMOUSE:
+               __set_bit(BTN_LEFT, input_dev->keybit);
+               __set_bit(BTN_RIGHT, input_dev->keybit);
+               __set_bit(REL_X, input_dev->relbit);
+               __set_bit(REL_Y, input_dev->relbit);
+               break;
+
+       case GC_SNES:
+               for (i = 4; i < 8; i++)
+                       __set_bit(gc_snes_btn[i], input_dev->keybit);
+       case GC_NES:
+               for (i = 0; i < 4; i++)
+                       __set_bit(gc_snes_btn[i], input_dev->keybit);
+               break;
+
+       case GC_MULTI2:
+               __set_bit(BTN_THUMB, input_dev->keybit);
+       case GC_MULTI:
+               __set_bit(BTN_TRIGGER, input_dev->keybit);
+               break;
+
+       case GC_PSX:
+               for (i = 0; i < 6; i++)
+                       input_set_abs_params(input_dev,
+                                            gc_psx_abs[i], 4, 252, 0, 2);
+               for (i = 0; i < 12; i++)
+                       __set_bit(gc_psx_btn[i], input_dev->keybit);
+
+               break;
+
+       case GC_DDR:
+               for (i = 0; i < 4; i++)
+                       __set_bit(gc_psx_ddr_btn[i], input_dev->keybit);
+               for (i = 0; i < 12; i++)
+                       __set_bit(gc_psx_btn[i], input_dev->keybit);
+
+               break;
        }
 
+       err = input_register_device(pad->dev);
+       if (err)
+               goto err_free_dev;
+
        return 0;
+
+err_free_dev:
+       input_free_device(pad->dev);
+       pad->dev = NULL;
+       return err;
 }
 
 static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
@@ -722,52 +933,47 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
        struct parport *pp;
        struct pardevice *pd;
        int i;
+       int count = 0;
        int err;
 
        pp = parport_find_number(parport);
        if (!pp) {
-               printk(KERN_ERR "gamecon.c: no such parport\n");
+               pr_err("no such parport %d\n", parport);
                err = -EINVAL;
                goto err_out;
        }
 
        pd = parport_register_device(pp, "gamecon", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
        if (!pd) {
-               printk(KERN_ERR "gamecon.c: parport busy already - lp.o loaded?\n");
+               pr_err("parport busy already - lp.o loaded?\n");
                err = -EBUSY;
                goto err_put_pp;
        }
 
        gc = kzalloc(sizeof(struct gc), GFP_KERNEL);
        if (!gc) {
-               printk(KERN_ERR "gamecon.c: Not enough memory\n");
+               pr_err("Not enough memory\n");
                err = -ENOMEM;
                goto err_unreg_pardev;
        }
 
        mutex_init(&gc->mutex);
        gc->pd = pd;
-       init_timer(&gc->timer);
-       gc->timer.data = (long) gc;
-       gc->timer.function = gc_timer;
+       setup_timer(&gc->timer, gc_timer, (long) gc);
 
        for (i = 0; i < n_pads && i < GC_MAX_DEVICES; i++) {
                if (!pads[i])
                        continue;
 
-               snprintf(gc->phys[i], sizeof(gc->phys[i]),
-                        "%s/input%d", gc->pd->port->name, i);
                err = gc_setup_pad(gc, i, pads[i]);
                if (err)
                        goto err_unreg_devs;
 
-               err = input_register_device(gc->dev[i]);
-               if (err)
-                       goto err_free_dev;
+               count++;
        }
 
-       if (!gc->pads[0]) {
-               printk(KERN_ERR "gamecon.c: No valid devices specified\n");
+       if (count == 0) {
+               pr_err("No valid devices specified\n");
                err = -EINVAL;
                goto err_free_gc;
        }
@@ -775,12 +981,10 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
        parport_put_port(pp);
        return gc;
 
- err_free_dev:
-       input_free_device(gc->dev[i]);
  err_unreg_devs:
        while (--i >= 0)
-               if (gc->dev[i])
-                       input_unregister_device(gc->dev[i]);
+               if (gc->pads[i].dev)
+                       input_unregister_device(gc->pads[i].dev);
  err_free_gc:
        kfree(gc);
  err_unreg_pardev:
@@ -796,8 +1000,8 @@ static void gc_remove(struct gc *gc)
        int i;
 
        for (i = 0; i < GC_MAX_DEVICES; i++)
-               if (gc->dev[i])
-                       input_unregister_device(gc->dev[i]);
+               if (gc->pads[i].dev)
+                       input_unregister_device(gc->pads[i].dev);
        parport_unregister_device(gc->pd);
        kfree(gc);
 }
@@ -813,7 +1017,7 @@ static int __init gc_init(void)
                        continue;
 
                if (gc_cfg[i].nargs < 2) {
-                       printk(KERN_ERR "gamecon.c: at least one device must be specified\n");
+                       pr_err("at least one device must be specified\n");
                        err = -EINVAL;
                        break;
                }
index 8a28fb7846dc1f16a18a064b6cc631d2ca82afa4..9b3353b404da9180cdfcc8e7bfcda7ab74ade553 100644 (file)
@@ -86,9 +86,8 @@
 
 /* xbox d-pads should map to buttons, as is required for DDR pads
    but we map them to axes when possible to simplify things */
-#define MAP_DPAD_TO_BUTTONS    0
-#define MAP_DPAD_TO_AXES       1
-#define MAP_DPAD_UNKNOWN       2
+#define MAP_DPAD_TO_BUTTONS            (1 << 0)
+#define MAP_TRIGGERS_TO_BUTTONS                (1 << 1)
 
 #define XTYPE_XBOX        0
 #define XTYPE_XBOX360     1
@@ -99,57 +98,61 @@ static int dpad_to_buttons;
 module_param(dpad_to_buttons, bool, S_IRUGO);
 MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads");
 
+static int triggers_to_buttons;
+module_param(triggers_to_buttons, bool, S_IRUGO);
+MODULE_PARM_DESC(triggers_to_buttons, "Map triggers to buttons rather than axes for unknown pads");
+
 static const struct xpad_device {
        u16 idVendor;
        u16 idProduct;
        char *name;
-       u8 dpad_mapping;
+       u8 mapping;
        u8 xtype;
 } xpad_device[] = {
-       { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x045e, 0x0287, "Microsoft Xbox Controller S", MAP_DPAD_TO_AXES, XTYPE_XBOX },
+       { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX },
+       { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX },
+       { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
+       { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX },
        { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
        { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x046d, 0xc242, "Logitech Chillstream Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4516, "Mad Catz Control Pad", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4522, "Mad Catz LumiCON", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4526, "Mad Catz Control Pad Pro", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX },
+       { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
+       { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
+       { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
+       { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
+       { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX },
+       { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX },
+       { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX },
+       { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX },
+       { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX },
+       { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX },
        { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
+       { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX },
+       { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
+       { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
        { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e4c, 0x2390, "Radica Games Jtech Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
+       { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX },
+       { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX },
+       { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX },
+       { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX },
+       { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 },
+       { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX },
+       { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
+       { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
+       { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX },
        { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
+       { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
        { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
-       { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0x045e, 0x028e, "Microsoft X-Box 360 pad", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
+       { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
+       { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
        { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
-       { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
-       { 0xffff, 0xffff, "Chinese-made Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
-       { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN }
+       { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
+       { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
 };
 
 /* buttons shared with xbox and xbox360 */
@@ -165,13 +168,20 @@ static const signed short xpad_btn[] = {
        -1                      /* terminating entry */
 };
 
-/* only used if MAP_DPAD_TO_BUTTONS */
+/* used when dpad is mapped to nuttons */
 static const signed short xpad_btn_pad[] = {
        BTN_LEFT, BTN_RIGHT,            /* d-pad left, right */
        BTN_0, BTN_1,                   /* d-pad up, down (XXX names??) */
        -1                              /* terminating entry */
 };
 
+/* used when triggers are mapped to buttons */
+static const signed short xpad_btn_triggers[] = {
+       BTN_TL2, BTN_TR2,               /* triggers left/right */
+       -1
+};
+
+
 static const signed short xpad360_btn[] = {  /* buttons for x360 controller */
        BTN_TL, BTN_TR,         /* Button LB/RB */
        BTN_MODE,               /* The big X button */
@@ -181,16 +191,21 @@ static const signed short xpad360_btn[] = {  /* buttons for x360 controller */
 static const signed short xpad_abs[] = {
        ABS_X, ABS_Y,           /* left stick */
        ABS_RX, ABS_RY,         /* right stick */
-       ABS_Z, ABS_RZ,          /* triggers left/right */
        -1                      /* terminating entry */
 };
 
-/* only used if MAP_DPAD_TO_AXES */
+/* used when dpad is mapped to axes */
 static const signed short xpad_abs_pad[] = {
        ABS_HAT0X, ABS_HAT0Y,   /* d-pad axes */
        -1                      /* terminating entry */
 };
 
+/* used when triggers are mapped to axes */
+static const signed short xpad_abs_triggers[] = {
+       ABS_Z, ABS_RZ,          /* triggers left/right */
+       -1
+};
+
 /* Xbox 360 has a vendor-specific class, so we cannot match it with only
  * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we
  * match against vendor id as well. Wired Xbox 360 devices have protocol 1,
@@ -246,7 +261,7 @@ struct usb_xpad {
 
        char phys[64];                  /* physical device path */
 
-       int dpad_mapping;               /* map d-pad to buttons or to axes */
+       int mapping;                    /* map d-pad to buttons or to axes */
        int xtype;                      /* type of xbox device */
 };
 
@@ -277,20 +292,25 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
                         ~(__s16) le16_to_cpup((__le16 *)(data + 18)));
 
        /* triggers left/right */
-       input_report_abs(dev, ABS_Z, data[10]);
-       input_report_abs(dev, ABS_RZ, data[11]);
+       if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
+               input_report_key(dev, BTN_TL2, data[10]);
+               input_report_key(dev, BTN_TR2, data[11]);
+       } else {
+               input_report_abs(dev, ABS_Z, data[10]);
+               input_report_abs(dev, ABS_RZ, data[11]);
+       }
 
        /* digital pad */
-       if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
-               input_report_abs(dev, ABS_HAT0X,
-                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
-               input_report_abs(dev, ABS_HAT0Y,
-                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
-       } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ {
+       if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
                input_report_key(dev, BTN_LEFT,  data[2] & 0x04);
                input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
                input_report_key(dev, BTN_0,     data[2] & 0x01); /* up */
                input_report_key(dev, BTN_1,     data[2] & 0x02); /* down */
+       } else {
+               input_report_abs(dev, ABS_HAT0X,
+                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
+               input_report_abs(dev, ABS_HAT0Y,
+                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
        }
 
        /* start/back buttons and stick press left/right */
@@ -328,17 +348,17 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
        struct input_dev *dev = xpad->dev;
 
        /* digital pad */
-       if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
-               input_report_abs(dev, ABS_HAT0X,
-                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
-               input_report_abs(dev, ABS_HAT0Y,
-                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
-       } else if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) {
+       if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
                /* dpad as buttons (right, left, down, up) */
                input_report_key(dev, BTN_LEFT, data[2] & 0x04);
                input_report_key(dev, BTN_RIGHT, data[2] & 0x08);
                input_report_key(dev, BTN_0, data[2] & 0x01);   /* up */
                input_report_key(dev, BTN_1, data[2] & 0x02);   /* down */
+       } else {
+               input_report_abs(dev, ABS_HAT0X,
+                                !!(data[2] & 0x08) - !!(data[2] & 0x04));
+               input_report_abs(dev, ABS_HAT0Y,
+                                !!(data[2] & 0x02) - !!(data[2] & 0x01));
        }
 
        /* start/back buttons */
@@ -371,8 +391,13 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
                         ~(__s16) le16_to_cpup((__le16 *)(data + 12)));
 
        /* triggers left/right */
-       input_report_abs(dev, ABS_Z, data[4]);
-       input_report_abs(dev, ABS_RZ, data[5]);
+       if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
+               input_report_key(dev, BTN_TL2, data[4]);
+               input_report_key(dev, BTN_TR2, data[5]);
+       } else {
+               input_report_abs(dev, ABS_Z, data[4]);
+               input_report_abs(dev, ABS_RZ, data[5]);
+       }
 
        input_sync(dev);
 }
@@ -505,7 +530,7 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
        struct usb_endpoint_descriptor *ep_irq_out;
        int error = -ENOMEM;
 
-       if (xpad->xtype != XTYPE_XBOX360)
+       if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX)
                return 0;
 
        xpad->odata = usb_buffer_alloc(xpad->udev, XPAD_PKT_LEN,
@@ -535,13 +560,13 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
 
 static void xpad_stop_output(struct usb_xpad *xpad)
 {
-       if (xpad->xtype == XTYPE_XBOX360)
+       if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX)
                usb_kill_urb(xpad->irq_out);
 }
 
 static void xpad_deinit_output(struct usb_xpad *xpad)
 {
-       if (xpad->xtype == XTYPE_XBOX360) {
+       if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) {
                usb_free_urb(xpad->irq_out);
                usb_buffer_free(xpad->udev, XPAD_PKT_LEN,
                                xpad->odata, xpad->odata_dma);
@@ -554,24 +579,45 @@ static void xpad_stop_output(struct usb_xpad *xpad) {}
 #endif
 
 #ifdef CONFIG_JOYSTICK_XPAD_FF
-static int xpad_play_effect(struct input_dev *dev, void *data,
-                           struct ff_effect *effect)
+static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect)
 {
        struct usb_xpad *xpad = input_get_drvdata(dev);
 
        if (effect->type == FF_RUMBLE) {
                __u16 strong = effect->u.rumble.strong_magnitude;
                __u16 weak = effect->u.rumble.weak_magnitude;
-               xpad->odata[0] = 0x00;
-               xpad->odata[1] = 0x08;
-               xpad->odata[2] = 0x00;
-               xpad->odata[3] = strong / 256;
-               xpad->odata[4] = weak / 256;
-               xpad->odata[5] = 0x00;
-               xpad->odata[6] = 0x00;
-               xpad->odata[7] = 0x00;
-               xpad->irq_out->transfer_buffer_length = 8;
-               usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
+
+               switch (xpad->xtype) {
+
+               case XTYPE_XBOX:
+                       xpad->odata[0] = 0x00;
+                       xpad->odata[1] = 0x06;
+                       xpad->odata[2] = 0x00;
+                       xpad->odata[3] = strong / 256;  /* left actuator */
+                       xpad->odata[4] = 0x00;
+                       xpad->odata[5] = weak / 256;    /* right actuator */
+                       xpad->irq_out->transfer_buffer_length = 6;
+
+                       return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
+
+               case XTYPE_XBOX360:
+                       xpad->odata[0] = 0x00;
+                       xpad->odata[1] = 0x08;
+                       xpad->odata[2] = 0x00;
+                       xpad->odata[3] = strong / 256;  /* left actuator? */
+                       xpad->odata[4] = weak / 256;    /* right actuator? */
+                       xpad->odata[5] = 0x00;
+                       xpad->odata[6] = 0x00;
+                       xpad->odata[7] = 0x00;
+                       xpad->irq_out->transfer_buffer_length = 8;
+
+                       return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
+
+               default:
+                       dbg("%s - rumble command sent to unsupported xpad type: %d",
+                               __func__, xpad->xtype);
+                       return -1;
+               }
        }
 
        return 0;
@@ -579,7 +625,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data,
 
 static int xpad_init_ff(struct usb_xpad *xpad)
 {
-       if (xpad->xtype != XTYPE_XBOX360)
+       if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX)
                return 0;
 
        input_set_capability(xpad->dev, EV_FF, FF_RUMBLE);
@@ -712,11 +758,11 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
                input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128);
                break;
        case ABS_Z:
-       case ABS_RZ:    /* the triggers */
+       case ABS_RZ:    /* the triggers (if mapped to axes) */
                input_set_abs_params(input_dev, abs, 0, 255, 0, 0);
                break;
        case ABS_HAT0X:
-       case ABS_HAT0Y: /* the d-pad (only if MAP_DPAD_TO_AXES) */
+       case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */
                input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
                break;
        }
@@ -752,10 +798,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
                goto fail2;
 
        xpad->udev = udev;
-       xpad->dpad_mapping = xpad_device[i].dpad_mapping;
+       xpad->mapping = xpad_device[i].mapping;
        xpad->xtype = xpad_device[i].xtype;
-       if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN)
-               xpad->dpad_mapping = !dpad_to_buttons;
+
        if (xpad->xtype == XTYPE_UNKNOWN) {
                if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) {
                        if (intf->cur_altsetting->desc.bInterfaceProtocol == 129)
@@ -764,7 +809,13 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
                                xpad->xtype = XTYPE_XBOX360;
                } else
                        xpad->xtype = XTYPE_XBOX;
+
+               if (dpad_to_buttons)
+                       xpad->mapping |= MAP_DPAD_TO_BUTTONS;
+               if (triggers_to_buttons)
+                       xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS;
        }
+
        xpad->dev = input_dev;
        usb_make_path(udev, xpad->phys, sizeof(xpad->phys));
        strlcat(xpad->phys, "/input0", sizeof(xpad->phys));
@@ -781,25 +832,37 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 
        input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
 
-       /* set up buttons */
+       /* set up standard buttons and axes */
        for (i = 0; xpad_common_btn[i] >= 0; i++)
-               set_bit(xpad_common_btn[i], input_dev->keybit);
-       if ((xpad->xtype == XTYPE_XBOX360) || (xpad->xtype == XTYPE_XBOX360W))
-               for (i = 0; xpad360_btn[i] >= 0; i++)
-                       set_bit(xpad360_btn[i], input_dev->keybit);
-       else
-               for (i = 0; xpad_btn[i] >= 0; i++)
-                       set_bit(xpad_btn[i], input_dev->keybit);
-       if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS)
-               for (i = 0; xpad_btn_pad[i] >= 0; i++)
-                       set_bit(xpad_btn_pad[i], input_dev->keybit);
+               __set_bit(xpad_common_btn[i], input_dev->keybit);
 
-       /* set up axes */
        for (i = 0; xpad_abs[i] >= 0; i++)
                xpad_set_up_abs(input_dev, xpad_abs[i]);
-       if (xpad->dpad_mapping == MAP_DPAD_TO_AXES)
+
+       /* Now set up model-specific ones */
+       if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W) {
+               for (i = 0; xpad360_btn[i] >= 0; i++)
+                       __set_bit(xpad360_btn[i], input_dev->keybit);
+       } else {
+               for (i = 0; xpad_btn[i] >= 0; i++)
+                       __set_bit(xpad_btn[i], input_dev->keybit);
+       }
+
+       if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
+               for (i = 0; xpad_btn_pad[i] >= 0; i++)
+                       __set_bit(xpad_btn_pad[i], input_dev->keybit);
+       } else {
                for (i = 0; xpad_abs_pad[i] >= 0; i++)
                    xpad_set_up_abs(input_dev, xpad_abs_pad[i]);
+       }
+
+       if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) {
+               for (i = 0; xpad_btn_triggers[i] >= 0; i++)
+                       __set_bit(xpad_btn_triggers[i], input_dev->keybit);
+       } else {
+               for (i = 0; xpad_abs_triggers[i] >= 0; i++)
+                       xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);
+       }
 
        error = xpad_init_output(intf, xpad);
        if (error)
index 02c836e11813601471de72653381584bdca9684a..64c102355f532198829b7c381ddf75376a132a8a 100644 (file)
@@ -35,10 +35,10 @@ config KEYBOARD_ADP5520
          be called adp5520-keys.
 
 config KEYBOARD_ADP5588
-       tristate "ADP5588 I2C QWERTY Keypad and IO Expander"
+       tristate "ADP5588/87 I2C QWERTY Keypad and IO Expander"
        depends on I2C
        help
-         Say Y here if you want to use a ADP5588 attached to your
+         Say Y here if you want to use a ADP5588/87 attached to your
          system I2C bus.
 
          To compile this driver as a module, choose M here: the
@@ -144,13 +144,15 @@ config KEYBOARD_BFIN
          module will be called bf54x-keys.
 
 config KEYBOARD_CORGI
-       tristate "Corgi keyboard"
+       tristate "Corgi keyboard (deprecated)"
        depends on PXA_SHARPSL
-       default y
        help
          Say Y here to enable the keyboard on the Sharp Zaurus SL-C7xx
          series of PDAs.
 
+         This driver is now deprecated, use generic GPIO based matrix
+         keyboard driver instead.
+
          To compile this driver as a module, choose M here: the
          module will be called corgikbd.
 
@@ -292,6 +294,15 @@ config KEYBOARD_MAX7359
          To compile this driver as a module, choose M here: the
          module will be called max7359_keypad.
 
+config KEYBOARD_IMX
+       tristate "IMX keypad support"
+       depends on ARCH_MXC
+       help
+         Enable support for IMX keypad port.
+
+         To compile this driver as a module, choose M here: the
+         module will be called imx_keypad.
+
 config KEYBOARD_NEWTON
        tristate "Newton keyboard"
        select SERIO
@@ -329,13 +340,15 @@ config KEYBOARD_PXA930_ROTARY
          module will be called pxa930_rotary.
 
 config KEYBOARD_SPITZ
-       tristate "Spitz keyboard"
+       tristate "Spitz keyboard (deprecated)"
        depends on PXA_SHARPSL
-       default y
        help
          Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000,
          SL-C3000 and Sl-C3100 series of PDAs.
 
+         This driver is now deprecated, use generic GPIO based matrix
+         keyboard driver instead.
+
          To compile this driver as a module, choose M here: the
          module will be called spitzkbd.
 
@@ -363,7 +376,7 @@ config KEYBOARD_SUNKBD
 
 config KEYBOARD_SH_KEYSC
        tristate "SuperH KEYSC keypad support"
-       depends on SUPERH
+       depends on SUPERH || ARCH_SHMOBILE
        help
          Say Y here if you want to use a keypad attached to the KEYSC block
          on SuperH processors such as sh7722 and sh7343.
@@ -402,12 +415,14 @@ config KEYBOARD_TWL4030
          module will be called twl4030_keypad.
 
 config KEYBOARD_TOSA
-       tristate "Tosa keyboard"
+       tristate "Tosa keyboard (deprecated)"
        depends on MACH_TOSA
-       default y
        help
          Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa)
 
+         This driver is now deprecated, use generic GPIO based matrix
+         keyboard driver instead.
+
          To compile this driver as a module, choose M here: the
          module will be called tosakbd.
 
index 78654ef6520644c98710b6ff640acd37bc8c224d..706c6b5ed5f44a7f9c95973503c073a3081e97b4 100644 (file)
@@ -17,6 +17,7 @@ obj-$(CONFIG_KEYBOARD_EP93XX)         += ep93xx_keypad.o
 obj-$(CONFIG_KEYBOARD_GPIO)            += gpio_keys.o
 obj-$(CONFIG_KEYBOARD_HIL)             += hil_kbd.o
 obj-$(CONFIG_KEYBOARD_HIL_OLD)         += hilkbd.o
+obj-$(CONFIG_KEYBOARD_IMX)             += imx_keypad.o
 obj-$(CONFIG_KEYBOARD_HP6XX)           += jornada680_kbd.o
 obj-$(CONFIG_KEYBOARD_HP7XX)           += jornada720_kbd.o
 obj-$(CONFIG_KEYBOARD_LKKBD)           += lkkbd.o
index 1edb596d927bd885dea073593a3183fc63b45a54..b5142d2d5112a0470cf34e924e9c0063124d56f3 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * File: drivers/input/keyboard/adp5588_keys.c
- * Description:  keypad driver for ADP5588 I2C QWERTY Keypad and IO Expander
+ * Description:  keypad driver for ADP5588 and ADP5587
+ *              I2C QWERTY Keypad and IO Expander
  * Bugs: Enter bugs at http://blackfin.uclinux.org/
  *
  * Copyright (C) 2008-2009 Analog Devices Inc.
@@ -327,6 +328,7 @@ static const struct dev_pm_ops adp5588_dev_pm_ops = {
 
 static const struct i2c_device_id adp5588_id[] = {
        { KBUILD_MODNAME, 0 },
+       { "adp5587-keys", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, adp5588_id);
@@ -357,5 +359,5 @@ module_exit(adp5588_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
-MODULE_DESCRIPTION("ADP5588 Keypad driver");
+MODULE_DESCRIPTION("ADP5588/87 Keypad driver");
 MODULE_ALIAS("platform:adp5588-keys");
index 7b4056292eaf9387b95fe80c147ad6c9a65920e5..d358ef8623f490709875b901d82580b1afc7a7fc 100644 (file)
@@ -40,26 +40,26 @@ module_param_named(set, atkbd_set, int, 0);
 MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)");
 
 #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__)
-static int atkbd_reset;
+static bool atkbd_reset;
 #else
-static int atkbd_reset = 1;
+static bool atkbd_reset = true;
 #endif
 module_param_named(reset, atkbd_reset, bool, 0);
 MODULE_PARM_DESC(reset, "Reset keyboard during initialization");
 
-static int atkbd_softrepeat;
+static bool atkbd_softrepeat;
 module_param_named(softrepeat, atkbd_softrepeat, bool, 0);
 MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat");
 
-static int atkbd_softraw = 1;
+static bool atkbd_softraw = true;
 module_param_named(softraw, atkbd_softraw, bool, 0);
 MODULE_PARM_DESC(softraw, "Use software generated rawmode");
 
-static int atkbd_scroll;
+static bool atkbd_scroll;
 module_param_named(scroll, atkbd_scroll, bool, 0);
 MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards");
 
-static int atkbd_extra;
+static bool atkbd_extra;
 module_param_named(extra, atkbd_extra, bool, 0);
 MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards");
 
@@ -153,16 +153,16 @@ static const unsigned short atkbd_unxlate_table[128] = {
 #define ATKBD_RET_HANGEUL      0xf2
 #define ATKBD_RET_ERR          0xff
 
-#define ATKBD_KEY_UNKNOWN        0
+#define ATKBD_KEY_UNKNOWN      0
 #define ATKBD_KEY_NULL         255
 
-#define ATKBD_SCR_1            254
-#define ATKBD_SCR_2            253
-#define ATKBD_SCR_4            252
-#define ATKBD_SCR_8            251
-#define ATKBD_SCR_CLICK                250
-#define ATKBD_SCR_LEFT         249
-#define ATKBD_SCR_RIGHT                248
+#define ATKBD_SCR_1            0xfffe
+#define ATKBD_SCR_2            0xfffd
+#define ATKBD_SCR_4            0xfffc
+#define ATKBD_SCR_8            0xfffb
+#define ATKBD_SCR_CLICK                0xfffa
+#define ATKBD_SCR_LEFT         0xfff9
+#define ATKBD_SCR_RIGHT                0xfff8
 
 #define ATKBD_SPECIAL          ATKBD_SCR_RIGHT
 
@@ -177,7 +177,7 @@ static const unsigned short atkbd_unxlate_table[128] = {
 #define ATKBD_XL_HANJA         0x20
 
 static const struct {
-       unsigned char keycode;
+       unsigned short keycode;
        unsigned char set2;
 } atkbd_scroll_keys[] = {
        { ATKBD_SCR_1,     0xc5 },
@@ -206,18 +206,18 @@ struct atkbd {
        unsigned short keycode[ATKBD_KEYMAP_SIZE];
        DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE);
        unsigned char set;
-       unsigned char translated;
-       unsigned char extra;
-       unsigned char write;
-       unsigned char softrepeat;
-       unsigned char softraw;
-       unsigned char scroll;
-       unsigned char enabled;
+       bool translated;
+       bool extra;
+       bool write;
+       bool softrepeat;
+       bool softraw;
+       bool scroll;
+       bool enabled;
 
        /* Accessed only from interrupt */
        unsigned char emul;
-       unsigned char resend;
-       unsigned char release;
+       bool resend;
+       bool release;
        unsigned long xl_bit;
        unsigned int last;
        unsigned long time;
@@ -301,18 +301,18 @@ static const unsigned int xl_table[] = {
  * Checks if we should mangle the scancode to extract 'release' bit
  * in translated mode.
  */
-static int atkbd_need_xlate(unsigned long xl_bit, unsigned char code)
+static bool atkbd_need_xlate(unsigned long xl_bit, unsigned char code)
 {
        int i;
 
        if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1)
-               return 0;
+               return false;
 
        for (i = 0; i < ARRAY_SIZE(xl_table); i++)
                if (code == xl_table[i])
                        return test_bit(i, &xl_bit);
 
-       return 1;
+       return true;
 }
 
 /*
@@ -359,7 +359,7 @@ static unsigned int atkbd_compat_scancode(struct atkbd *atkbd, unsigned int code
  */
 
 static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
-                       unsigned int flags)
+                                  unsigned int flags)
 {
        struct atkbd *atkbd = serio_get_drvdata(serio);
        struct input_dev *dev = atkbd->dev;
@@ -368,20 +368,18 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
        int value;
        unsigned short keycode;
 
-#ifdef ATKBD_DEBUG
-       printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags);
-#endif
+       dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags);
 
 #if !defined(__i386__) && !defined (__x86_64__)
        if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) {
-               printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags);
+               dev_warn(&serio->dev, "Frame/parity error: %02x\n", flags);
                serio_write(serio, ATKBD_CMD_RESEND);
-               atkbd->resend = 1;
+               atkbd->resend = true;
                goto out;
        }
 
        if (!flags && data == ATKBD_RET_ACK)
-               atkbd->resend = 0;
+               atkbd->resend = false;
 #endif
 
        if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK))
@@ -412,32 +410,32 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
        }
 
        switch (code) {
-               case ATKBD_RET_BAT:
-                       atkbd->enabled = 0;
-                       serio_reconnect(atkbd->ps2dev.serio);
-                       goto out;
-               case ATKBD_RET_EMUL0:
-                       atkbd->emul = 1;
-                       goto out;
-               case ATKBD_RET_EMUL1:
-                       atkbd->emul = 2;
-                       goto out;
-               case ATKBD_RET_RELEASE:
-                       atkbd->release = 1;
-                       goto out;
-               case ATKBD_RET_ACK:
-               case ATKBD_RET_NAK:
-                       if (printk_ratelimit())
-                               printk(KERN_WARNING "atkbd.c: Spurious %s on %s. "
-                                      "Some program might be trying access hardware directly.\n",
-                                      data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
-                       goto out;
-               case ATKBD_RET_ERR:
-                       atkbd->err_count++;
-#ifdef ATKBD_DEBUG
-                       printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys);
-#endif
-                       goto out;
+       case ATKBD_RET_BAT:
+               atkbd->enabled = false;
+               serio_reconnect(atkbd->ps2dev.serio);
+               goto out;
+       case ATKBD_RET_EMUL0:
+               atkbd->emul = 1;
+               goto out;
+       case ATKBD_RET_EMUL1:
+               atkbd->emul = 2;
+               goto out;
+       case ATKBD_RET_RELEASE:
+               atkbd->release = true;
+               goto out;
+       case ATKBD_RET_ACK:
+       case ATKBD_RET_NAK:
+               if (printk_ratelimit())
+                       dev_warn(&serio->dev,
+                                "Spurious %s on %s. "
+                                "Some program might be trying access hardware directly.\n",
+                                data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
+               goto out;
+       case ATKBD_RET_ERR:
+               atkbd->err_count++;
+               dev_dbg(&serio->dev, "Keyboard on %s reports too many keys pressed.\n",
+                       serio->phys);
+               goto out;
        }
 
        code = atkbd_compat_scancode(atkbd, code);
@@ -451,71 +449,72 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
                input_event(dev, EV_MSC, MSC_SCAN, code);
 
        switch (keycode) {
-               case ATKBD_KEY_NULL:
-                       break;
-               case ATKBD_KEY_UNKNOWN:
-                       printk(KERN_WARNING
-                              "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n",
-                              atkbd->release ? "released" : "pressed",
-                              atkbd->translated ? "translated" : "raw",
-                              atkbd->set, code, serio->phys);
-                       printk(KERN_WARNING
-                              "atkbd.c: Use 'setkeycodes %s%02x <keycode>' to make it known.\n",
-                              code & 0x80 ? "e0" : "", code & 0x7f);
-                       input_sync(dev);
-                       break;
-               case ATKBD_SCR_1:
-                       scroll = 1 - atkbd->release * 2;
-                       break;
-               case ATKBD_SCR_2:
-                       scroll = 2 - atkbd->release * 4;
-                       break;
-               case ATKBD_SCR_4:
-                       scroll = 4 - atkbd->release * 8;
-                       break;
-               case ATKBD_SCR_8:
-                       scroll = 8 - atkbd->release * 16;
-                       break;
-               case ATKBD_SCR_CLICK:
-                       click = !atkbd->release;
-                       break;
-               case ATKBD_SCR_LEFT:
-                       hscroll = -1;
-                       break;
-               case ATKBD_SCR_RIGHT:
-                       hscroll = 1;
-                       break;
-               default:
-                       if (atkbd->release) {
-                               value = 0;
-                               atkbd->last = 0;
-                       } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) {
-                               /* Workaround Toshiba laptop multiple keypress */
-                               value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2;
-                       } else {
-                               value = 1;
-                               atkbd->last = code;
-                               atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2;
-                       }
-
-                       input_event(dev, EV_KEY, keycode, value);
-                       input_sync(dev);
+       case ATKBD_KEY_NULL:
+               break;
+       case ATKBD_KEY_UNKNOWN:
+               dev_warn(&serio->dev,
+                        "Unknown key %s (%s set %d, code %#x on %s).\n",
+                        atkbd->release ? "released" : "pressed",
+                        atkbd->translated ? "translated" : "raw",
+                        atkbd->set, code, serio->phys);
+               dev_warn(&serio->dev,
+                        "Use 'setkeycodes %s%02x <keycode>' to make it known.\n",
+                        code & 0x80 ? "e0" : "", code & 0x7f);
+               input_sync(dev);
+               break;
+       case ATKBD_SCR_1:
+               scroll = 1;
+               break;
+       case ATKBD_SCR_2:
+               scroll = 2;
+               break;
+       case ATKBD_SCR_4:
+               scroll = 4;
+               break;
+       case ATKBD_SCR_8:
+               scroll = 8;
+               break;
+       case ATKBD_SCR_CLICK:
+               click = !atkbd->release;
+               break;
+       case ATKBD_SCR_LEFT:
+               hscroll = -1;
+               break;
+       case ATKBD_SCR_RIGHT:
+               hscroll = 1;
+               break;
+       default:
+               if (atkbd->release) {
+                       value = 0;
+                       atkbd->last = 0;
+               } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) {
+                       /* Workaround Toshiba laptop multiple keypress */
+                       value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2;
+               } else {
+                       value = 1;
+                       atkbd->last = code;
+                       atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2;
+               }
+
+               input_event(dev, EV_KEY, keycode, value);
+               input_sync(dev);
 
-                       if (value && test_bit(code, atkbd->force_release_mask)) {
-                               input_report_key(dev, keycode, 0);
-                               input_sync(dev);
-                       }
+               if (value && test_bit(code, atkbd->force_release_mask)) {
+                       input_report_key(dev, keycode, 0);
+                       input_sync(dev);
+               }
        }
 
        if (atkbd->scroll) {
                if (click != -1)
                        input_report_key(dev, BTN_MIDDLE, click);
-               input_report_rel(dev, REL_WHEEL, scroll);
+               input_report_rel(dev, REL_WHEEL,
+                                atkbd->release ? -scroll : scroll);
                input_report_rel(dev, REL_HWHEEL, hscroll);
                input_sync(dev);
        }
 
-       atkbd->release = 0;
+       atkbd->release = false;
 out:
        return IRQ_HANDLED;
 }
@@ -634,17 +633,18 @@ static int atkbd_event(struct input_dev *dev,
 
        switch (type) {
 
-               case EV_LED:
-                       atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT);
-                       return 0;
+       case EV_LED:
+               atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT);
+               return 0;
 
-               case EV_REP:
-                       if (!atkbd->softrepeat)
-                               atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT);
-                       return 0;
-       }
+       case EV_REP:
+               if (!atkbd->softrepeat)
+                       atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT);
+               return 0;
 
-       return -1;
+       default:
+               return -1;
+       }
 }
 
 /*
@@ -655,7 +655,7 @@ static int atkbd_event(struct input_dev *dev,
 static inline void atkbd_enable(struct atkbd *atkbd)
 {
        serio_pause_rx(atkbd->ps2dev.serio);
-       atkbd->enabled = 1;
+       atkbd->enabled = true;
        serio_continue_rx(atkbd->ps2dev.serio);
 }
 
@@ -667,7 +667,7 @@ static inline void atkbd_enable(struct atkbd *atkbd)
 static inline void atkbd_disable(struct atkbd *atkbd)
 {
        serio_pause_rx(atkbd->ps2dev.serio);
-       atkbd->enabled = 0;
+       atkbd->enabled = false;
        serio_continue_rx(atkbd->ps2dev.serio);
 }
 
@@ -688,7 +688,9 @@ static int atkbd_probe(struct atkbd *atkbd)
 
        if (atkbd_reset)
                if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT))
-                       printk(KERN_WARNING "atkbd.c: keyboard reset failed on %s\n", ps2dev->serio->phys);
+                       dev_warn(&ps2dev->serio->dev,
+                                "keyboard reset failed on %s\n",
+                                ps2dev->serio->phys);
 
 /*
  * Then we check the keyboard ID. We should get 0xab83 under normal conditions.
@@ -718,8 +720,9 @@ static int atkbd_probe(struct atkbd *atkbd)
        atkbd->id = (param[0] << 8) | param[1];
 
        if (atkbd->id == 0xaca1 && atkbd->translated) {
-               printk(KERN_ERR "atkbd.c: NCD terminal keyboards are only supported on non-translating\n");
-               printk(KERN_ERR "atkbd.c: controllers. Use i8042.direct=1 to disable translation.\n");
+               dev_err(&ps2dev->serio->dev,
+                       "NCD terminal keyboards are only supported on non-translating controlelrs. "
+                       "Use i8042.direct=1 to disable translation.\n");
                return -1;
        }
 
@@ -737,7 +740,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra
        struct ps2dev *ps2dev = &atkbd->ps2dev;
        unsigned char param[2];
 
-       atkbd->extra = 0;
+       atkbd->extra = false;
 /*
  * For known special keyboards we can go ahead and set the correct set.
  * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and
@@ -756,7 +759,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra
        if (allow_extra) {
                param[0] = 0x71;
                if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) {
-                       atkbd->extra = 1;
+                       atkbd->extra = true;
                        return 2;
                }
        }
@@ -821,7 +824,8 @@ static int atkbd_activate(struct atkbd *atkbd)
  */
 
        if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) {
-               printk(KERN_ERR "atkbd.c: Failed to enable keyboard on %s\n",
+               dev_err(&ps2dev->serio->dev,
+                       "Failed to enable keyboard on %s\n",
                        ps2dev->serio->phys);
                return -1;
        }
@@ -1070,9 +1074,13 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
        input_dev->keycodesize = sizeof(unsigned short);
        input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
 
-       for (i = 0; i < ATKBD_KEYMAP_SIZE; i++)
-               if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL)
+       for (i = 0; i < ATKBD_KEYMAP_SIZE; i++) {
+               if (atkbd->keycode[i] != KEY_RESERVED &&
+                   atkbd->keycode[i] != ATKBD_KEY_NULL &&
+                   atkbd->keycode[i] < ATKBD_SPECIAL) {
                        __set_bit(atkbd->keycode[i], input_dev->keybit);
+               }
+       }
 }
 
 /*
@@ -1100,12 +1108,14 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
 
        switch (serio->id.type) {
 
-               case SERIO_8042_XL:
-                       atkbd->translated = 1;
-               case SERIO_8042:
-                       if (serio->write)
-                               atkbd->write = 1;
-                       break;
+       case SERIO_8042_XL:
+               atkbd->translated = true;
+               /* Fall through */
+
+       case SERIO_8042:
+               if (serio->write)
+                       atkbd->write = true;
+               break;
        }
 
        atkbd->softraw = atkbd_softraw;
@@ -1113,7 +1123,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
        atkbd->scroll = atkbd_scroll;
 
        if (atkbd->softrepeat)
-               atkbd->softraw = 1;
+               atkbd->softraw = true;
 
        serio_set_drvdata(serio, atkbd);
 
@@ -1172,7 +1182,8 @@ static int atkbd_reconnect(struct serio *serio)
        int retval = -1;
 
        if (!atkbd || !drv) {
-               printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n");
+               dev_dbg(&serio->dev,
+                       "reconnect request, but serio is disconnected, ignoring...\n");
                return -1;
        }
 
@@ -1286,7 +1297,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_extra, old_set;
+       bool old_extra;
+       unsigned char old_set;
 
        if (!atkbd->write)
                return -EIO;
@@ -1369,7 +1381,7 @@ static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t cou
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_scroll;
+       bool old_scroll;
 
        if (strict_strtoul(buf, 10, &value) || value > 1)
                return -EINVAL;
@@ -1413,7 +1425,8 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_set, old_extra;
+       unsigned char old_set;
+       bool old_extra;
 
        if (!atkbd->write)
                return -EIO;
@@ -1463,7 +1476,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_softrepeat, old_softraw;
+       bool old_softrepeat, old_softraw;
 
        if (!atkbd->write)
                return -EIO;
@@ -1483,7 +1496,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t
                atkbd->dev = new_dev;
                atkbd->softrepeat = value;
                if (atkbd->softrepeat)
-                       atkbd->softraw = 1;
+                       atkbd->softraw = true;
                atkbd_set_device_attrs(atkbd);
 
                err = input_register_device(atkbd->dev);
@@ -1513,7 +1526,7 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co
        struct input_dev *old_dev, *new_dev;
        unsigned long value;
        int err;
-       unsigned char old_softraw;
+       bool old_softraw;
 
        if (strict_strtoul(buf, 10, &value) || value > 1)
                return -EINVAL;
index e45740429f7e4e34db3e08e6c9698df2632fb640..bd25a3af16644a63885e7be741bb6a97728a7329 100644 (file)
@@ -69,7 +69,7 @@ struct ep93xx_keypad {
 
        void __iomem *mmio_base;
 
-       unsigned int matrix_keycodes[EP93XX_MATRIX_SIZE];
+       unsigned short keycodes[EP93XX_MATRIX_SIZE];
 
        int key1;
        int key2;
@@ -79,24 +79,6 @@ struct ep93xx_keypad {
        bool enabled;
 };
 
-static void ep93xx_keypad_build_keycode(struct ep93xx_keypad *keypad)
-{
-       struct ep93xx_keypad_platform_data *pdata = keypad->pdata;
-       struct input_dev *input_dev = keypad->input_dev;
-       unsigned int *key;
-       int i;
-
-       key = &pdata->matrix_key_map[0];
-       for (i = 0; i < pdata->matrix_key_map_size; i++, key++) {
-               int row = KEY_ROW(*key);
-               int col = KEY_COL(*key);
-               int code = KEY_VAL(*key);
-
-               keypad->matrix_keycodes[(row << 3) + col] = code;
-               __set_bit(code, input_dev->keybit);
-       }
-}
-
 static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id)
 {
        struct ep93xx_keypad *keypad = dev_id;
@@ -107,10 +89,10 @@ static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id)
        status = __raw_readl(keypad->mmio_base + KEY_REG);
 
        keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT;
-       key1 = keypad->matrix_keycodes[keycode];
+       key1 = keypad->keycodes[keycode];
 
        keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT;
-       key2 = keypad->matrix_keycodes[keycode];
+       key2 = keypad->keycodes[keycode];
 
        if (status & KEY_REG_2KEYS) {
                if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1)
@@ -256,6 +238,7 @@ static int ep93xx_keypad_resume(struct platform_device *pdev)
 static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
 {
        struct ep93xx_keypad *keypad;
+       const struct matrix_keymap_data *keymap_data;
        struct input_dev *input_dev;
        struct resource *res;
        int err;
@@ -270,6 +253,12 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
                goto failed_free;
        }
 
+       keymap_data = keypad->pdata->keymap_data;
+       if (!keymap_data) {
+               err = -EINVAL;
+               goto failed_free;
+       }
+
        keypad->irq = platform_get_irq(pdev, 0);
        if (!keypad->irq) {
                err = -ENXIO;
@@ -317,9 +306,9 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
        input_dev->open = ep93xx_keypad_open;
        input_dev->close = ep93xx_keypad_close;
        input_dev->dev.parent = &pdev->dev;
-       input_dev->keycode = keypad->matrix_keycodes;
-       input_dev->keycodesize = sizeof(keypad->matrix_keycodes[0]);
-       input_dev->keycodemax = ARRAY_SIZE(keypad->matrix_keycodes);
+       input_dev->keycode = keypad->keycodes;
+       input_dev->keycodesize = sizeof(keypad->keycodes[0]);
+       input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
 
        input_set_drvdata(input_dev, keypad);
 
@@ -327,7 +316,8 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev)
        if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT)
                input_dev->evbit[0] |= BIT_MASK(EV_REP);
 
-       ep93xx_keypad_build_keycode(keypad);
+       matrix_keypad_build_keymap(keymap_data, 3,
+                                  input_dev->keycode, input_dev->keybit);
        platform_set_drvdata(pdev, keypad);
 
        err = request_irq(keypad->irq, ep93xx_keypad_irq_handler,
index 1aff3b76effdb0b05ee4201cba2525cce5b44769..2b708aa85553358a2b375cbb602fb07d1ea36c02 100644 (file)
@@ -30,13 +30,289 @@ struct gpio_button_data {
        struct input_dev *input;
        struct timer_list timer;
        struct work_struct work;
+       bool disabled;
 };
 
 struct gpio_keys_drvdata {
        struct input_dev *input;
+       struct mutex disable_lock;
+       unsigned int n_buttons;
        struct gpio_button_data data[0];
 };
 
+/*
+ * SYSFS interface for enabling/disabling keys and switches:
+ *
+ * There are 4 attributes under /sys/devices/platform/gpio-keys/
+ *     keys [ro]              - bitmap of keys (EV_KEY) which can be
+ *                              disabled
+ *     switches [ro]          - bitmap of switches (EV_SW) which can be
+ *                              disabled
+ *     disabled_keys [rw]     - bitmap of keys currently disabled
+ *     disabled_switches [rw] - bitmap of switches currently disabled
+ *
+ * Userland can change these values and hence disable event generation
+ * for each key (or switch). Disabling a key means its interrupt line
+ * is disabled.
+ *
+ * For example, if we have following switches set up as gpio-keys:
+ *     SW_DOCK = 5
+ *     SW_CAMERA_LENS_COVER = 9
+ *     SW_KEYPAD_SLIDE = 10
+ *     SW_FRONT_PROXIMITY = 11
+ * This is read from switches:
+ *     11-9,5
+ * Next we want to disable proximity (11) and dock (5), we write:
+ *     11,5
+ * to file disabled_switches. Now proximity and dock IRQs are disabled.
+ * This can be verified by reading the file disabled_switches:
+ *     11,5
+ * If we now want to enable proximity (11) switch we write:
+ *     5
+ * to disabled_switches.
+ *
+ * We can disable only those keys which don't allow sharing the irq.
+ */
+
+/**
+ * get_n_events_by_type() - returns maximum number of events per @type
+ * @type: type of button (%EV_KEY, %EV_SW)
+ *
+ * Return value of this function can be used to allocate bitmap
+ * large enough to hold all bits for given type.
+ */
+static inline int get_n_events_by_type(int type)
+{
+       BUG_ON(type != EV_SW && type != EV_KEY);
+
+       return (type == EV_KEY) ? KEY_CNT : SW_CNT;
+}
+
+/**
+ * gpio_keys_disable_button() - disables given GPIO button
+ * @bdata: button data for button to be disabled
+ *
+ * Disables button pointed by @bdata. This is done by masking
+ * IRQ line. After this function is called, button won't generate
+ * input events anymore. Note that one can only disable buttons
+ * that don't share IRQs.
+ *
+ * Make sure that @bdata->disable_lock is locked when entering
+ * this function to avoid races when concurrent threads are
+ * disabling buttons at the same time.
+ */
+static void gpio_keys_disable_button(struct gpio_button_data *bdata)
+{
+       if (!bdata->disabled) {
+               /*
+                * Disable IRQ and possible debouncing timer.
+                */
+               disable_irq(gpio_to_irq(bdata->button->gpio));
+               if (bdata->button->debounce_interval)
+                       del_timer_sync(&bdata->timer);
+
+               bdata->disabled = true;
+       }
+}
+
+/**
+ * gpio_keys_enable_button() - enables given GPIO button
+ * @bdata: button data for button to be disabled
+ *
+ * Enables given button pointed by @bdata.
+ *
+ * Make sure that @bdata->disable_lock is locked when entering
+ * this function to avoid races with concurrent threads trying
+ * to enable the same button at the same time.
+ */
+static void gpio_keys_enable_button(struct gpio_button_data *bdata)
+{
+       if (bdata->disabled) {
+               enable_irq(gpio_to_irq(bdata->button->gpio));
+               bdata->disabled = false;
+       }
+}
+
+/**
+ * gpio_keys_attr_show_helper() - fill in stringified bitmap of buttons
+ * @ddata: pointer to drvdata
+ * @buf: buffer where stringified bitmap is written
+ * @type: button type (%EV_KEY, %EV_SW)
+ * @only_disabled: does caller want only those buttons that are
+ *                 currently disabled or all buttons that can be
+ *                 disabled
+ *
+ * This function writes buttons that can be disabled to @buf. If
+ * @only_disabled is true, then @buf contains only those buttons
+ * that are currently disabled. Returns 0 on success or negative
+ * errno on failure.
+ */
+static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata,
+                                         char *buf, unsigned int type,
+                                         bool only_disabled)
+{
+       int n_events = get_n_events_by_type(type);
+       unsigned long *bits;
+       ssize_t ret;
+       int i;
+
+       bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL);
+       if (!bits)
+               return -ENOMEM;
+
+       for (i = 0; i < ddata->n_buttons; i++) {
+               struct gpio_button_data *bdata = &ddata->data[i];
+
+               if (bdata->button->type != type)
+                       continue;
+
+               if (only_disabled && !bdata->disabled)
+                       continue;
+
+               __set_bit(bdata->button->code, bits);
+       }
+
+       ret = bitmap_scnlistprintf(buf, PAGE_SIZE - 2, bits, n_events);
+       buf[ret++] = '\n';
+       buf[ret] = '\0';
+
+       kfree(bits);
+
+       return ret;
+}
+
+/**
+ * gpio_keys_attr_store_helper() - enable/disable buttons based on given bitmap
+ * @ddata: pointer to drvdata
+ * @buf: buffer from userspace that contains stringified bitmap
+ * @type: button type (%EV_KEY, %EV_SW)
+ *
+ * This function parses stringified bitmap from @buf and disables/enables
+ * GPIO buttons accordinly. Returns 0 on success and negative error
+ * on failure.
+ */
+static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata,
+                                          const char *buf, unsigned int type)
+{
+       int n_events = get_n_events_by_type(type);
+       unsigned long *bits;
+       ssize_t error;
+       int i;
+
+       bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL);
+       if (!bits)
+               return -ENOMEM;
+
+       error = bitmap_parselist(buf, bits, n_events);
+       if (error)
+               goto out;
+
+       /* First validate */
+       for (i = 0; i < ddata->n_buttons; i++) {
+               struct gpio_button_data *bdata = &ddata->data[i];
+
+               if (bdata->button->type != type)
+                       continue;
+
+               if (test_bit(bdata->button->code, bits) &&
+                   !bdata->button->can_disable) {
+                       error = -EINVAL;
+                       goto out;
+               }
+       }
+
+       mutex_lock(&ddata->disable_lock);
+
+       for (i = 0; i < ddata->n_buttons; i++) {
+               struct gpio_button_data *bdata = &ddata->data[i];
+
+               if (bdata->button->type != type)
+                       continue;
+
+               if (test_bit(bdata->button->code, bits))
+                       gpio_keys_disable_button(bdata);
+               else
+                       gpio_keys_enable_button(bdata);
+       }
+
+       mutex_unlock(&ddata->disable_lock);
+
+out:
+       kfree(bits);
+       return error;
+}
+
+#define ATTR_SHOW_FN(name, type, only_disabled)                                \
+static ssize_t gpio_keys_show_##name(struct device *dev,               \
+                                    struct device_attribute *attr,     \
+                                    char *buf)                         \
+{                                                                      \
+       struct platform_device *pdev = to_platform_device(dev);         \
+       struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);   \
+                                                                       \
+       return gpio_keys_attr_show_helper(ddata, buf,                   \
+                                         type, only_disabled);         \
+}
+
+ATTR_SHOW_FN(keys, EV_KEY, false);
+ATTR_SHOW_FN(switches, EV_SW, false);
+ATTR_SHOW_FN(disabled_keys, EV_KEY, true);
+ATTR_SHOW_FN(disabled_switches, EV_SW, true);
+
+/*
+ * ATTRIBUTES:
+ *
+ * /sys/devices/platform/gpio-keys/keys [ro]
+ * /sys/devices/platform/gpio-keys/switches [ro]
+ */
+static DEVICE_ATTR(keys, S_IRUGO, gpio_keys_show_keys, NULL);
+static DEVICE_ATTR(switches, S_IRUGO, gpio_keys_show_switches, NULL);
+
+#define ATTR_STORE_FN(name, type)                                      \
+static ssize_t gpio_keys_store_##name(struct device *dev,              \
+                                     struct device_attribute *attr,    \
+                                     const char *buf,                  \
+                                     size_t count)                     \
+{                                                                      \
+       struct platform_device *pdev = to_platform_device(dev);         \
+       struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);   \
+       ssize_t error;                                                  \
+                                                                       \
+       error = gpio_keys_attr_store_helper(ddata, buf, type);          \
+       if (error)                                                      \
+               return error;                                           \
+                                                                       \
+       return count;                                                   \
+}
+
+ATTR_STORE_FN(disabled_keys, EV_KEY);
+ATTR_STORE_FN(disabled_switches, EV_SW);
+
+/*
+ * ATTRIBUTES:
+ *
+ * /sys/devices/platform/gpio-keys/disabled_keys [rw]
+ * /sys/devices/platform/gpio-keys/disables_switches [rw]
+ */
+static DEVICE_ATTR(disabled_keys, S_IWUSR | S_IRUGO,
+                  gpio_keys_show_disabled_keys,
+                  gpio_keys_store_disabled_keys);
+static DEVICE_ATTR(disabled_switches, S_IWUSR | S_IRUGO,
+                  gpio_keys_show_disabled_switches,
+                  gpio_keys_store_disabled_switches);
+
+static struct attribute *gpio_keys_attrs[] = {
+       &dev_attr_keys.attr,
+       &dev_attr_switches.attr,
+       &dev_attr_disabled_keys.attr,
+       &dev_attr_disabled_switches.attr,
+       NULL,
+};
+
+static struct attribute_group gpio_keys_attr_group = {
+       .attrs = gpio_keys_attrs,
+};
+
 static void gpio_keys_report_event(struct gpio_button_data *bdata)
 {
        struct gpio_keys_button *button = bdata->button;
@@ -79,11 +355,13 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static int __devinit gpio_keys_setup_key(struct device *dev,
+static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
                                         struct gpio_button_data *bdata,
                                         struct gpio_keys_button *button)
 {
        char *desc = button->desc ? button->desc : "gpio_keys";
+       struct device *dev = &pdev->dev;
+       unsigned long irqflags;
        int irq, error;
 
        setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata);
@@ -112,10 +390,15 @@ static int __devinit gpio_keys_setup_key(struct device *dev,
                goto fail3;
        }
 
-       error = request_irq(irq, gpio_keys_isr,
-                           IRQF_SHARED |
-                           IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                           desc, bdata);
+       irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
+       /*
+        * If platform has specified that the button can be disabled,
+        * we don't want it to share the interrupt line.
+        */
+       if (!button->can_disable)
+               irqflags |= IRQF_SHARED;
+
+       error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
        if (error) {
                dev_err(dev, "Unable to claim irq %d; error %d\n",
                        irq, error);
@@ -149,6 +432,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
                goto fail1;
        }
 
+       ddata->input = input;
+       ddata->n_buttons = pdata->nbuttons;
+       mutex_init(&ddata->disable_lock);
+
        platform_set_drvdata(pdev, ddata);
 
        input->name = pdev->name;
@@ -164,8 +451,6 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
        if (pdata->rep)
                __set_bit(EV_REP, input->evbit);
 
-       ddata->input = input;
-
        for (i = 0; i < pdata->nbuttons; i++) {
                struct gpio_keys_button *button = &pdata->buttons[i];
                struct gpio_button_data *bdata = &ddata->data[i];
@@ -174,7 +459,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
                bdata->input = input;
                bdata->button = button;
 
-               error = gpio_keys_setup_key(dev, bdata, button);
+               error = gpio_keys_setup_key(pdev, bdata, button);
                if (error)
                        goto fail2;
 
@@ -184,13 +469,20 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
                input_set_capability(input, type, button->code);
        }
 
-       error = input_register_device(input);
+       error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group);
        if (error) {
-               dev_err(dev, "Unable to register input device, "
-                       "error: %d\n", error);
+               dev_err(dev, "Unable to export keys/switches, error: %d\n",
+                       error);
                goto fail2;
        }
 
+       error = input_register_device(input);
+       if (error) {
+               dev_err(dev, "Unable to register input device, error: %d\n",
+                       error);
+               goto fail3;
+       }
+
        /* get current state of buttons */
        for (i = 0; i < pdata->nbuttons; i++)
                gpio_keys_report_event(&ddata->data[i]);
@@ -200,6 +492,8 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
 
        return 0;
 
+ fail3:
+       sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
  fail2:
        while (--i >= 0) {
                free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]);
@@ -224,6 +518,8 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
        struct input_dev *input = ddata->input;
        int i;
 
+       sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
+
        device_init_wakeup(&pdev->dev, 0);
 
        for (i = 0; i < pdata->nbuttons; i++) {
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
new file mode 100644 (file)
index 0000000..2ee5b79
--- /dev/null
@@ -0,0 +1,594 @@
+/*
+ * Driver for the IMX keypad port.
+ * Copyright (C) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * <<Power management needs to be implemented>>.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input/matrix_keypad.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/timer.h>
+
+/*
+ * Keypad Controller registers (halfword)
+ */
+#define KPCR           0x00 /* Keypad Control Register */
+
+#define KPSR           0x02 /* Keypad Status Register */
+#define KBD_STAT_KPKD  (0x1 << 0) /* Key Press Interrupt Status bit (w1c) */
+#define KBD_STAT_KPKR  (0x1 << 1) /* Key Release Interrupt Status bit (w1c) */
+#define KBD_STAT_KDSC  (0x1 << 2) /* Key Depress Synch Chain Status bit (w1c)*/
+#define KBD_STAT_KRSS  (0x1 << 3) /* Key Release Synch Status bit (w1c)*/
+#define KBD_STAT_KDIE  (0x1 << 8) /* Key Depress Interrupt Enable Status bit */
+#define KBD_STAT_KRIE  (0x1 << 9) /* Key Release Interrupt Enable */
+#define KBD_STAT_KPPEN (0x1 << 10) /* Keypad Clock Enable */
+
+#define KDDR           0x04 /* Keypad Data Direction Register */
+#define KPDR           0x06 /* Keypad Data Register */
+
+#define MAX_MATRIX_KEY_ROWS    8
+#define MAX_MATRIX_KEY_COLS    8
+#define MATRIX_ROW_SHIFT       3
+
+#define MAX_MATRIX_KEY_NUM     (MAX_MATRIX_KEY_ROWS * MAX_MATRIX_KEY_COLS)
+
+struct imx_keypad {
+
+       struct clk *clk;
+       struct input_dev *input_dev;
+       void __iomem *mmio_base;
+
+       int                     irq;
+       struct timer_list       check_matrix_timer;
+
+       /*
+        * The matrix is stable only if no changes are detected after
+        * IMX_KEYPAD_SCANS_FOR_STABILITY scans
+        */
+#define IMX_KEYPAD_SCANS_FOR_STABILITY 3
+       int                     stable_count;
+
+       bool                    enabled;
+
+       /* Masks for enabled rows/cols */
+       unsigned short          rows_en_mask;
+       unsigned short          cols_en_mask;
+
+       unsigned short          keycodes[MAX_MATRIX_KEY_NUM];
+
+       /*
+        * Matrix states:
+        * -stable: achieved after a complete debounce process.
+        * -unstable: used in the debouncing process.
+        */
+       unsigned short          matrix_stable_state[MAX_MATRIX_KEY_COLS];
+       unsigned short          matrix_unstable_state[MAX_MATRIX_KEY_COLS];
+};
+
+/* Scan the matrix and return the new state in *matrix_volatile_state. */
+static void imx_keypad_scan_matrix(struct imx_keypad *keypad,
+                                 unsigned short *matrix_volatile_state)
+{
+       int col;
+       unsigned short reg_val;
+
+       for (col = 0; col < MAX_MATRIX_KEY_COLS; col++) {
+               if ((keypad->cols_en_mask & (1 << col)) == 0)
+                       continue;
+               /*
+                * Discharge keypad capacitance:
+                * 2. write 1s on column data.
+                * 3. configure columns as totem-pole to discharge capacitance.
+                * 4. configure columns as open-drain.
+                */
+               reg_val = readw(keypad->mmio_base + KPDR);
+               reg_val |= 0xff00;
+               writew(reg_val, keypad->mmio_base + KPDR);
+
+               reg_val = readw(keypad->mmio_base + KPCR);
+               reg_val &= ~((keypad->cols_en_mask & 0xff) << 8);
+               writew(reg_val, keypad->mmio_base + KPCR);
+
+               udelay(2);
+
+               reg_val = readw(keypad->mmio_base + KPCR);
+               reg_val |= (keypad->cols_en_mask & 0xff) << 8;
+               writew(reg_val, keypad->mmio_base + KPCR);
+
+               /*
+                * 5. Write a single column to 0, others to 1.
+                * 6. Sample row inputs and save data.
+                * 7. Repeat steps 2 - 6 for remaining columns.
+                */
+               reg_val = readw(keypad->mmio_base + KPDR);
+               reg_val &= ~(1 << (8 + col));
+               writew(reg_val, keypad->mmio_base + KPDR);
+
+               /*
+                * Delay added to avoid propagating the 0 from column to row
+                * when scanning.
+                */
+               udelay(5);
+
+               /*
+                * 1s in matrix_volatile_state[col] means key pressures
+                * throw data from non enabled rows.
+                */
+               reg_val = readw(keypad->mmio_base + KPDR);
+               matrix_volatile_state[col] = (~reg_val) & keypad->rows_en_mask;
+       }
+
+       /*
+        * Return in standby mode:
+        * 9. write 0s to columns
+        */
+       reg_val = readw(keypad->mmio_base + KPDR);
+       reg_val &= 0x00ff;
+       writew(reg_val, keypad->mmio_base + KPDR);
+}
+
+/*
+ * Compare the new matrix state (volatile) with the stable one stored in
+ * keypad->matrix_stable_state and fire events if changes are detected.
+ */
+static void imx_keypad_fire_events(struct imx_keypad *keypad,
+                                  unsigned short *matrix_volatile_state)
+{
+       struct input_dev *input_dev = keypad->input_dev;
+       int row, col;
+
+       for (col = 0; col < MAX_MATRIX_KEY_COLS; col++) {
+               unsigned short bits_changed;
+               int code;
+
+               if ((keypad->cols_en_mask & (1 << col)) == 0)
+                       continue; /* Column is not enabled */
+
+               bits_changed = keypad->matrix_stable_state[col] ^
+                                               matrix_volatile_state[col];
+
+               if (bits_changed == 0)
+                       continue; /* Column does not contain changes */
+
+               for (row = 0; row < MAX_MATRIX_KEY_ROWS; row++) {
+                       if ((keypad->rows_en_mask & (1 << row)) == 0)
+                               continue; /* Row is not enabled */
+                       if ((bits_changed & (1 << row)) == 0)
+                               continue; /* Row does not contain changes */
+
+                       code = MATRIX_SCAN_CODE(row, col, MATRIX_ROW_SHIFT);
+                       input_event(input_dev, EV_MSC, MSC_SCAN, code);
+                       input_report_key(input_dev, keypad->keycodes[code],
+                               matrix_volatile_state[col] & (1 << row));
+                       dev_dbg(&input_dev->dev, "Event code: %d, val: %d",
+                               keypad->keycodes[code],
+                               matrix_volatile_state[col] & (1 << row));
+               }
+       }
+       input_sync(input_dev);
+}
+
+/*
+ * imx_keypad_check_for_events is the timer handler.
+ */
+static void imx_keypad_check_for_events(unsigned long data)
+{
+       struct imx_keypad *keypad = (struct imx_keypad *) data;
+       unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS];
+       unsigned short reg_val;
+       bool state_changed, is_zero_matrix;
+       int i;
+
+       memset(matrix_volatile_state, 0, sizeof(matrix_volatile_state));
+
+       imx_keypad_scan_matrix(keypad, matrix_volatile_state);
+
+       state_changed = false;
+       for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) {
+               if ((keypad->cols_en_mask & (1 << i)) == 0)
+                       continue;
+
+               if (keypad->matrix_unstable_state[i] ^ matrix_volatile_state[i]) {
+                       state_changed = true;
+                       break;
+               }
+       }
+
+       /*
+        * If the matrix state is changed from the previous scan
+        *   (Re)Begin the debouncing process, saving the new state in
+        *    keypad->matrix_unstable_state.
+        * else
+        *   Increase the count of number of scans with a stable state.
+        */
+       if (state_changed) {
+               memcpy(keypad->matrix_unstable_state, matrix_volatile_state,
+                       sizeof(matrix_volatile_state));
+               keypad->stable_count = 0;
+       } else
+               keypad->stable_count++;
+
+       /*
+        * If the matrix is not as stable as we want reschedule scan
+        * in the near future.
+        */
+       if (keypad->stable_count < IMX_KEYPAD_SCANS_FOR_STABILITY) {
+               mod_timer(&keypad->check_matrix_timer,
+                         jiffies + msecs_to_jiffies(10));
+               return;
+       }
+
+       /*
+        * If the matrix state is stable, fire the events and save the new
+        * stable state. Note, if the matrix is kept stable for longer
+        * (keypad->stable_count > IMX_KEYPAD_SCANS_FOR_STABILITY) all
+        * events have already been generated.
+        */
+       if (keypad->stable_count == IMX_KEYPAD_SCANS_FOR_STABILITY) {
+               imx_keypad_fire_events(keypad, matrix_volatile_state);
+
+               memcpy(keypad->matrix_stable_state, matrix_volatile_state,
+                       sizeof(matrix_volatile_state));
+       }
+
+       is_zero_matrix = true;
+       for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) {
+               if (matrix_volatile_state[i] != 0) {
+                       is_zero_matrix = false;
+                       break;
+               }
+       }
+
+
+       if (is_zero_matrix) {
+               /*
+                * All keys have been released. Enable only the KDI
+                * interrupt for future key presses (clear the KDI
+                * status bit and its sync chain before that).
+                */
+               reg_val = readw(keypad->mmio_base + KPSR);
+               reg_val |= KBD_STAT_KPKD | KBD_STAT_KDSC;
+               writew(reg_val, keypad->mmio_base + KPSR);
+
+               reg_val = readw(keypad->mmio_base + KPSR);
+               reg_val |= KBD_STAT_KDIE;
+               reg_val &= ~KBD_STAT_KRIE;
+               writew(reg_val, keypad->mmio_base + KPSR);
+       } else {
+               /*
+                * Some keys are still pressed. Schedule a rescan in
+                * attempt to detect multiple key presses and enable
+                * the KRI interrupt to react quickly to key release
+                * event.
+                */
+               mod_timer(&keypad->check_matrix_timer,
+                         jiffies + msecs_to_jiffies(60));
+
+               reg_val = readw(keypad->mmio_base + KPSR);
+               reg_val |= KBD_STAT_KPKR | KBD_STAT_KRSS;
+               writew(reg_val, keypad->mmio_base + KPSR);
+
+               reg_val = readw(keypad->mmio_base + KPSR);
+               reg_val |= KBD_STAT_KRIE;
+               reg_val &= ~KBD_STAT_KDIE;
+               writew(reg_val, keypad->mmio_base + KPSR);
+       }
+}
+
+static irqreturn_t imx_keypad_irq_handler(int irq, void *dev_id)
+{
+       struct imx_keypad *keypad = dev_id;
+       unsigned short reg_val;
+
+       reg_val = readw(keypad->mmio_base + KPSR);
+
+       /* Disable both interrupt types */
+       reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
+       /* Clear interrupts status bits */
+       reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD;
+       writew(reg_val, keypad->mmio_base + KPSR);
+
+       if (keypad->enabled) {
+               /* The matrix is supposed to be changed */
+               keypad->stable_count = 0;
+
+               /* Schedule the scanning procedure near in the future */
+               mod_timer(&keypad->check_matrix_timer,
+                         jiffies + msecs_to_jiffies(2));
+       }
+
+       return IRQ_HANDLED;
+}
+
+static void imx_keypad_config(struct imx_keypad *keypad)
+{
+       unsigned short reg_val;
+
+       /*
+        * Include enabled rows in interrupt generation (KPCR[7:0])
+        * Configure keypad columns as open-drain (KPCR[15:8])
+        */
+       reg_val = readw(keypad->mmio_base + KPCR);
+       reg_val |= keypad->rows_en_mask & 0xff;         /* rows */
+       reg_val |= (keypad->cols_en_mask & 0xff) << 8;  /* cols */
+       writew(reg_val, keypad->mmio_base + KPCR);
+
+       /* Write 0's to KPDR[15:8] (Colums) */
+       reg_val = readw(keypad->mmio_base + KPDR);
+       reg_val &= 0x00ff;
+       writew(reg_val, keypad->mmio_base + KPDR);
+
+       /* Configure columns as output, rows as input (KDDR[15:0]) */
+       writew(0xff00, keypad->mmio_base + KDDR);
+
+       /*
+        * Clear Key Depress and Key Release status bit.
+        * Clear both synchronizer chain.
+        */
+       reg_val = readw(keypad->mmio_base + KPSR);
+       reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD |
+                  KBD_STAT_KDSC | KBD_STAT_KRSS;
+       writew(reg_val, keypad->mmio_base + KPSR);
+
+       /* Enable KDI and disable KRI (avoid false release events). */
+       reg_val |= KBD_STAT_KDIE;
+       reg_val &= ~KBD_STAT_KRIE;
+       writew(reg_val, keypad->mmio_base + KPSR);
+}
+
+static void imx_keypad_inhibit(struct imx_keypad *keypad)
+{
+       unsigned short reg_val;
+
+       /* Inhibit KDI and KRI interrupts. */
+       reg_val = readw(keypad->mmio_base + KPSR);
+       reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
+       writew(reg_val, keypad->mmio_base + KPSR);
+
+       /* Colums as open drain and disable all rows */
+       writew(0xff00, keypad->mmio_base + KPCR);
+}
+
+static void imx_keypad_close(struct input_dev *dev)
+{
+       struct imx_keypad *keypad = input_get_drvdata(dev);
+
+       dev_dbg(&dev->dev, ">%s\n", __func__);
+
+       /* Mark keypad as being inactive */
+       keypad->enabled = false;
+       synchronize_irq(keypad->irq);
+       del_timer_sync(&keypad->check_matrix_timer);
+
+       imx_keypad_inhibit(keypad);
+
+       /* Disable clock unit */
+       clk_disable(keypad->clk);
+}
+
+static int imx_keypad_open(struct input_dev *dev)
+{
+       struct imx_keypad *keypad = input_get_drvdata(dev);
+
+       dev_dbg(&dev->dev, ">%s\n", __func__);
+
+       /* We became active from now */
+       keypad->enabled = true;
+
+       /* Enable the kpp clock */
+       clk_enable(keypad->clk);
+       imx_keypad_config(keypad);
+
+       /* Sanity control, not all the rows must be actived now. */
+       if ((readw(keypad->mmio_base + KPDR) & keypad->rows_en_mask) == 0) {
+               dev_err(&dev->dev,
+                       "too many keys pressed, control pins initialisation\n");
+               goto open_err;
+       }
+
+       return 0;
+
+open_err:
+       imx_keypad_close(dev);
+       return -EIO;
+}
+
+static int __devinit imx_keypad_probe(struct platform_device *pdev)
+{
+       const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
+       struct imx_keypad *keypad;
+       struct input_dev *input_dev;
+       struct resource *res;
+       int irq, error, i;
+
+       if (keymap_data == NULL) {
+               dev_err(&pdev->dev, "no keymap defined\n");
+               return -EINVAL;
+       }
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               dev_err(&pdev->dev, "no irq defined in platform data\n");
+               return -EINVAL;
+       }
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res == NULL) {
+               dev_err(&pdev->dev, "no I/O memory defined in platform data\n");
+               return -EINVAL;
+       }
+
+       res = request_mem_region(res->start, resource_size(res), pdev->name);
+       if (res == NULL) {
+               dev_err(&pdev->dev, "failed to request I/O memory\n");
+               return -EBUSY;
+       }
+
+       input_dev = input_allocate_device();
+       if (!input_dev) {
+               dev_err(&pdev->dev, "failed to allocate the input device\n");
+               error = -ENOMEM;
+               goto failed_rel_mem;
+       }
+
+       keypad = kzalloc(sizeof(struct imx_keypad), GFP_KERNEL);
+       if (!keypad) {
+               dev_err(&pdev->dev, "not enough memory for driver data\n");
+               error = -ENOMEM;
+               goto failed_free_input;
+       }
+
+       keypad->input_dev = input_dev;
+       keypad->irq = irq;
+       keypad->stable_count = 0;
+
+       setup_timer(&keypad->check_matrix_timer,
+                   imx_keypad_check_for_events, (unsigned long) keypad);
+
+       keypad->mmio_base = ioremap(res->start, resource_size(res));
+       if (keypad->mmio_base == NULL) {
+               dev_err(&pdev->dev, "failed to remap I/O memory\n");
+               error = -ENOMEM;
+               goto failed_free_priv;
+       }
+
+       keypad->clk = clk_get(&pdev->dev, "kpp");
+       if (IS_ERR(keypad->clk)) {
+               dev_err(&pdev->dev, "failed to get keypad clock\n");
+               error = PTR_ERR(keypad->clk);
+               goto failed_unmap;
+       }
+
+       /* Search for rows and cols enabled */
+       for (i = 0; i < keymap_data->keymap_size; i++) {
+               keypad->rows_en_mask |= 1 << KEY_ROW(keymap_data->keymap[i]);
+               keypad->cols_en_mask |= 1 << KEY_COL(keymap_data->keymap[i]);
+       }
+
+       if (keypad->rows_en_mask > ((1 << MAX_MATRIX_KEY_ROWS) - 1) ||
+          keypad->cols_en_mask > ((1 << MAX_MATRIX_KEY_COLS) - 1)) {
+               dev_err(&pdev->dev,
+                       "invalid key data (too many rows or colums)\n");
+               error = -EINVAL;
+               goto failed_clock_put;
+       }
+       dev_dbg(&pdev->dev, "enabled rows mask: %x\n", keypad->rows_en_mask);
+       dev_dbg(&pdev->dev, "enabled cols mask: %x\n", keypad->cols_en_mask);
+
+       /* Init the Input device */
+       input_dev->name = pdev->name;
+       input_dev->id.bustype = BUS_HOST;
+       input_dev->dev.parent = &pdev->dev;
+       input_dev->open = imx_keypad_open;
+       input_dev->close = imx_keypad_close;
+       input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
+       input_dev->keycode = keypad->keycodes;
+       input_dev->keycodesize = sizeof(keypad->keycodes[0]);
+       input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
+
+       matrix_keypad_build_keymap(keymap_data, MATRIX_ROW_SHIFT,
+                               keypad->keycodes, input_dev->keybit);
+
+       input_set_capability(input_dev, EV_MSC, MSC_SCAN);
+       input_set_drvdata(input_dev, keypad);
+
+       /* Ensure that the keypad will stay dormant until opened */
+       imx_keypad_inhibit(keypad);
+
+       error = request_irq(irq, imx_keypad_irq_handler, IRQF_DISABLED,
+                           pdev->name, keypad);
+       if (error) {
+               dev_err(&pdev->dev, "failed to request IRQ\n");
+               goto failed_clock_put;
+       }
+
+       /* Register the input device */
+       error = input_register_device(input_dev);
+       if (error) {
+               dev_err(&pdev->dev, "failed to register input device\n");
+               goto failed_free_irq;
+       }
+
+       platform_set_drvdata(pdev, keypad);
+       device_init_wakeup(&pdev->dev, 1);
+
+       return 0;
+
+failed_free_irq:
+       free_irq(irq, pdev);
+failed_clock_put:
+       clk_put(keypad->clk);
+failed_unmap:
+       iounmap(keypad->mmio_base);
+failed_free_priv:
+       kfree(keypad);
+failed_free_input:
+       input_free_device(input_dev);
+failed_rel_mem:
+       release_mem_region(res->start, resource_size(res));
+       return error;
+}
+
+static int __devexit imx_keypad_remove(struct platform_device *pdev)
+{
+       struct imx_keypad *keypad = platform_get_drvdata(pdev);
+       struct resource *res;
+
+       dev_dbg(&pdev->dev, ">%s\n", __func__);
+
+       platform_set_drvdata(pdev, NULL);
+
+       input_unregister_device(keypad->input_dev);
+
+       free_irq(keypad->irq, keypad);
+       clk_put(keypad->clk);
+
+       iounmap(keypad->mmio_base);
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(res->start, resource_size(res));
+
+       kfree(keypad);
+
+       return 0;
+}
+
+static struct platform_driver imx_keypad_driver = {
+       .driver         = {
+               .name   = "imx-keypad",
+               .owner  = THIS_MODULE,
+       },
+       .probe          = imx_keypad_probe,
+       .remove         = __devexit_p(imx_keypad_remove),
+};
+
+static int __init imx_keypad_init(void)
+{
+       return platform_driver_register(&imx_keypad_driver);
+}
+
+static void __exit imx_keypad_exit(void)
+{
+       platform_driver_unregister(&imx_keypad_driver);
+}
+
+module_init(imx_keypad_init);
+module_exit(imx_keypad_exit);
+
+MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>");
+MODULE_DESCRIPTION("IMX Keypad Port Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:imx-keypad");
index 191cc51d6cf8c5609689f6990d847f3820a77b3f..31f30087b591866c9e81af4401d0a3feeaae359e 100644 (file)
@@ -362,7 +362,7 @@ static int __devexit qt2160_remove(struct i2c_client *client)
        return 0;
 }
 
-static struct i2c_device_id qt2160_idtable[] = {
+static const struct i2c_device_id qt2160_idtable[] = {
        { "qt2160", 0, },
        { }
 };
index 8e9380bfed4097fcdc283cfc7c3532ed0e911318..854e2035cd6e66108fb14f57ee7038991d5106fc 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
+#include <linux/bitmap.h>
 #include <linux/clk.h>
 #include <linux/io.h>
 
-#define KYCR1_OFFS   0x00
-#define KYCR2_OFFS   0x04
-#define KYINDR_OFFS  0x08
-#define KYOUTDR_OFFS 0x0c
-
-#define KYCR2_IRQ_LEVEL    0x10
-#define KYCR2_IRQ_DISABLED 0x00
-
 static const struct {
        unsigned char kymd, keyout, keyin;
 } sh_keysc_mode[] = {
        [SH_KEYSC_MODE_1] = { 0, 6, 5 },
        [SH_KEYSC_MODE_2] = { 1, 5, 6 },
        [SH_KEYSC_MODE_3] = { 2, 4, 7 },
+       [SH_KEYSC_MODE_4] = { 3, 6, 6 },
+       [SH_KEYSC_MODE_5] = { 4, 6, 7 },
+       [SH_KEYSC_MODE_6] = { 5, 7, 7 },
 };
 
 struct sh_keysc_priv {
        void __iomem *iomem_base;
        struct clk *clk;
-       unsigned long last_keys;
+       DECLARE_BITMAP(last_keys, SH_KEYSC_MAXKEYS);
        struct input_dev *input;
        struct sh_keysc_info pdata;
 };
 
+#define KYCR1 0
+#define KYCR2 1
+#define KYINDR 2
+#define KYOUTDR 3
+
+#define KYCR2_IRQ_LEVEL    0x10
+#define KYCR2_IRQ_DISABLED 0x00
+
+static unsigned long sh_keysc_read(struct sh_keysc_priv *p, int reg_nr)
+{
+       return ioread16(p->iomem_base + (reg_nr << 2));
+}
+
+static void sh_keysc_write(struct sh_keysc_priv *p, int reg_nr,
+                          unsigned long value)
+{
+       iowrite16(value, p->iomem_base + (reg_nr << 2));
+}
+
+static void sh_keysc_level_mode(struct sh_keysc_priv *p,
+                               unsigned long keys_set)
+{
+       struct sh_keysc_info *pdata = &p->pdata;
+
+       sh_keysc_write(p, KYOUTDR, 0);
+       sh_keysc_write(p, KYCR2, KYCR2_IRQ_LEVEL | (keys_set << 8));
+
+       if (pdata->kycr2_delay)
+               udelay(pdata->kycr2_delay);
+}
+
+static void sh_keysc_map_dbg(struct device *dev, unsigned long *map,
+                            const char *str)
+{
+       int k;
+
+       for (k = 0; k < BITS_TO_LONGS(SH_KEYSC_MAXKEYS); k++)
+               dev_dbg(dev, "%s[%d] 0x%lx\n", str, k, map[k]);
+}
+
 static irqreturn_t sh_keysc_isr(int irq, void *dev_id)
 {
        struct platform_device *pdev = dev_id;
        struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
        struct sh_keysc_info *pdata = &priv->pdata;
-       unsigned long keys, keys1, keys0, mask;
+       int keyout_nr = sh_keysc_mode[pdata->mode].keyout;
+       int keyin_nr = sh_keysc_mode[pdata->mode].keyin;
+       DECLARE_BITMAP(keys, SH_KEYSC_MAXKEYS);
+       DECLARE_BITMAP(keys0, SH_KEYSC_MAXKEYS);
+       DECLARE_BITMAP(keys1, SH_KEYSC_MAXKEYS);
        unsigned char keyin_set, tmp;
-       int i, k;
+       int i, k, n;
 
        dev_dbg(&pdev->dev, "isr!\n");
 
-       keys1 = ~0;
-       keys0 = 0;
+       bitmap_fill(keys1, SH_KEYSC_MAXKEYS);
+       bitmap_zero(keys0, SH_KEYSC_MAXKEYS);
 
        do {
-               keys = 0;
+               bitmap_zero(keys, SH_KEYSC_MAXKEYS);
                keyin_set = 0;
 
-               iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS);
+               sh_keysc_write(priv, KYCR2, KYCR2_IRQ_DISABLED);
+
+               for (i = 0; i < keyout_nr; i++) {
+                       n = keyin_nr * i;
 
-               for (i = 0; i < sh_keysc_mode[pdata->mode].keyout; i++) {
-                       iowrite16(0xfff ^ (3 << (i * 2)),
-                                 priv->iomem_base + KYOUTDR_OFFS);
+                       /* drive one KEYOUT pin low, read KEYIN pins */
+                       sh_keysc_write(priv, KYOUTDR, 0xffff ^ (3 << (i * 2)));
                        udelay(pdata->delay);
-                       tmp = ioread16(priv->iomem_base + KYINDR_OFFS);
-                       keys |= tmp << (sh_keysc_mode[pdata->mode].keyin * i);
-                       tmp ^= (1 << sh_keysc_mode[pdata->mode].keyin) - 1;
-                       keyin_set |= tmp;
-               }
+                       tmp = sh_keysc_read(priv, KYINDR);
 
-               iowrite16(0, priv->iomem_base + KYOUTDR_OFFS);
-               iowrite16(KYCR2_IRQ_LEVEL | (keyin_set << 8),
-                         priv->iomem_base + KYCR2_OFFS);
+                       /* set bit if key press has been detected */
+                       for (k = 0; k < keyin_nr; k++) {
+                               if (tmp & (1 << k))
+                                       __set_bit(n + k, keys);
+                       }
 
-               if (pdata->kycr2_delay)
-                       udelay(pdata->kycr2_delay);
+                       /* keep track of which KEYIN bits that have been set */
+                       keyin_set |= tmp ^ ((1 << keyin_nr) - 1);
+               }
 
-               keys ^= ~0;
-               keys &= (1 << (sh_keysc_mode[pdata->mode].keyin *
-                              sh_keysc_mode[pdata->mode].keyout)) - 1;
-               keys1 &= keys;
-               keys0 |= keys;
+               sh_keysc_level_mode(priv, keyin_set);
 
-               dev_dbg(&pdev->dev, "keys 0x%08lx\n", keys);
+               bitmap_complement(keys, keys, SH_KEYSC_MAXKEYS);
+               bitmap_and(keys1, keys1, keys, SH_KEYSC_MAXKEYS);
+               bitmap_or(keys0, keys0, keys, SH_KEYSC_MAXKEYS);
 
-       } while (ioread16(priv->iomem_base + KYCR2_OFFS) & 0x01);
+               sh_keysc_map_dbg(&pdev->dev, keys, "keys");
 
-       dev_dbg(&pdev->dev, "last_keys 0x%08lx keys0 0x%08lx keys1 0x%08lx\n",
-               priv->last_keys, keys0, keys1);
+       } while (sh_keysc_read(priv, KYCR2) & 0x01);
+
+       sh_keysc_map_dbg(&pdev->dev, priv->last_keys, "last_keys");
+       sh_keysc_map_dbg(&pdev->dev, keys0, "keys0");
+       sh_keysc_map_dbg(&pdev->dev, keys1, "keys1");
 
        for (i = 0; i < SH_KEYSC_MAXKEYS; i++) {
                k = pdata->keycodes[i];
                if (!k)
                        continue;
 
-               mask = 1 << i;
-
-               if (!((priv->last_keys ^ keys0) & mask))
+               if (test_bit(i, keys0) == test_bit(i, priv->last_keys))
                        continue;
 
-               if ((keys1 | keys0) & mask) {
+               if (test_bit(i, keys1) || test_bit(i, keys0)) {
                        input_event(priv->input, EV_KEY, k, 1);
-                       priv->last_keys |= mask;
+                       __set_bit(i, priv->last_keys);
                }
 
-               if (!(keys1 & mask)) {
+               if (!test_bit(i, keys1)) {
                        input_event(priv->input, EV_KEY, k, 0);
-                       priv->last_keys &= ~mask;
+                       __clear_bit(i, priv->last_keys);
                }
 
        }
@@ -122,8 +162,6 @@ static irqreturn_t sh_keysc_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-#define res_size(res) ((res)->end - (res)->start + 1)
-
 static int __devinit sh_keysc_probe(struct platform_device *pdev)
 {
        struct sh_keysc_priv *priv;
@@ -164,7 +202,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
        memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
        pdata = &priv->pdata;
 
-       priv->iomem_base = ioremap_nocache(res->start, res_size(res));
+       priv->iomem_base = ioremap_nocache(res->start, resource_size(res));
        if (priv->iomem_base == NULL) {
                dev_err(&pdev->dev, "failed to remap I/O memory\n");
                error = -ENXIO;
@@ -220,10 +258,9 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
 
        clk_enable(priv->clk);
 
-       iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) |
-                 pdata->scan_timing, priv->iomem_base + KYCR1_OFFS);
-       iowrite16(0, priv->iomem_base + KYOUTDR_OFFS);
-       iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS);
+       sh_keysc_write(priv, KYCR1, (sh_keysc_mode[pdata->mode].kymd << 8) |
+                      pdata->scan_timing);
+       sh_keysc_level_mode(priv, 0);
 
        device_init_wakeup(&pdev->dev, 1);
 
@@ -248,7 +285,7 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev)
 {
        struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
 
-       iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS);
+       sh_keysc_write(priv, KYCR2, KYCR2_IRQ_DISABLED);
 
        input_unregister_device(priv->input);
        free_irq(platform_get_irq(pdev, 0), pdev);
@@ -270,7 +307,7 @@ static int sh_keysc_suspend(struct device *dev)
        int irq = platform_get_irq(pdev, 0);
        unsigned short value;
 
-       value = ioread16(priv->iomem_base + KYCR1_OFFS);
+       value = sh_keysc_read(priv, KYCR1);
 
        if (device_may_wakeup(dev)) {
                value |= 0x80;
@@ -279,7 +316,7 @@ static int sh_keysc_suspend(struct device *dev)
                value &= ~0x80;
        }
 
-       iowrite16(value, priv->iomem_base + KYCR1_OFFS);
+       sh_keysc_write(priv, KYCR1, value);
 
        return 0;
 }
index 71b82434264d1c3efde2a1f0f0bc187b3ead3b5e..a8d2b8db4e359fbe521cce279909527cea4d984e 100644 (file)
@@ -149,7 +149,7 @@ static void apanel_shutdown(struct i2c_client *client)
        apanel_remove(client);
 }
 
-static struct i2c_device_id apanel_id[] = {
+static const struct i2c_device_id apanel_id[] = {
        { "fujitsu_apanel", 0 },
        { }
 };
index 1b871917340addb3b7d0d992e366b075b615f90f..dfaa9a045ed8a9378ad74030f0bc87dfd5dc8f2e 100644 (file)
@@ -47,7 +47,7 @@ static acpi_status acpi_atlas_button_setup(acpi_handle region_handle,
 
 static acpi_status acpi_atlas_button_handler(u32 function,
                      acpi_physical_address address,
-                     u32 bit_width, acpi_integer *value,
+                     u32 bit_width, u64 *value,
                      void *handler_context, void *region_context)
 {
        acpi_status status;
index 3b9f588fc74746e5bfb5179418e414d1e8a8921e..4ae07935985e744f2987246ff04435034b81b5c8 100644 (file)
@@ -152,6 +152,13 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev)
                goto exit_unregister_input;
        }
 
+       err = gpio_direction_input(pdata->gpio_a);
+       if (err) {
+               dev_err(&pdev->dev, "unable to set GPIO %d for input\n",
+                       pdata->gpio_a);
+               goto exit_unregister_input;
+       }
+
        err = gpio_request(pdata->gpio_b, DRV_NAME);
        if (err) {
                dev_err(&pdev->dev, "unable to request GPIO %d\n",
@@ -159,6 +166,13 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev)
                goto exit_free_gpio_a;
        }
 
+       err = gpio_direction_input(pdata->gpio_b);
+       if (err) {
+               dev_err(&pdev->dev, "unable to set GPIO %d for input\n",
+                       pdata->gpio_b);
+               goto exit_free_gpio_a;
+       }
+
        /* request the IRQs */
        err = request_irq(encoder->irq_a, &rotary_encoder_irq,
                          IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE,
index d3f57245420a008a412afa9b55dd4bd8f015ce8d..1477466076ad1764989f82387cc737fd453181ab 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/smp_lock.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <linux/uinput.h>
@@ -284,7 +283,6 @@ static int uinput_open(struct inode *inode, struct file *file)
        if (!newdev)
                return -ENOMEM;
 
-       lock_kernel();
        mutex_init(&newdev->mutex);
        spin_lock_init(&newdev->requests_lock);
        init_waitqueue_head(&newdev->requests_waitq);
@@ -292,7 +290,7 @@ static int uinput_open(struct inode *inode, struct file *file)
        newdev->state = UIST_NEW_DEVICE;
 
        file->private_data = newdev;
-       unlock_kernel();
+       nonseekable_open(inode, file);
 
        return 0;
 }
index c8f5a9a3fa140d73218c7e4ce6a162da8287500f..cbec3dfdd42b5373de0865edfb1a49c4440468bb 100644 (file)
@@ -538,6 +538,7 @@ wbcir_reset_irdata(struct wbcir_data *data)
        data->irdata_count = 0;
        data->irdata_off = 0;
        data->irdata_error = 0;
+       data->idle_count = 0;
 }
 
 /* Adds one bit of irdata */
@@ -1006,7 +1007,6 @@ wbcir_irq_handler(int irqno, void *cookie)
                }
 
                wbcir_reset_irdata(data);
-               data->idle_count = 0;
        }
 
 out:
@@ -1018,7 +1018,7 @@ out:
 
 /*****************************************************************************
  *
- * SUSPEND/RESUME FUNCTIONS
+ * SETUP/INIT/SUSPEND/RESUME FUNCTIONS
  *
  *****************************************************************************/
 
@@ -1197,7 +1197,16 @@ finish:
        }
 
        /* Disable interrupts */
+       wbcir_select_bank(data, WBCIR_BANK_0);
        outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
+
+       /*
+        * ACPI will set the HW disable bit for SP3 which means that the
+        * output signals are left in an undefined state which may cause
+        * spurious interrupts which we need to ignore until the hardware
+        * is reinitialized.
+        */
+       disable_irq(data->irq);
 }
 
 static int
@@ -1207,37 +1216,15 @@ wbcir_suspend(struct pnp_dev *device, pm_message_t state)
        return 0;
 }
 
-static int
-wbcir_resume(struct pnp_dev *device)
-{
-       struct wbcir_data *data = pnp_get_drvdata(device);
-
-       /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
-       wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
-
-       /* Clear CEIR_EN */
-       wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
-
-       /* Enable interrupts */
-       wbcir_reset_irdata(data);
-       outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER);
-
-       return 0;
-}
-
-
-
-/*****************************************************************************
- *
- * SETUP/INIT FUNCTIONS
- *
- *****************************************************************************/
-
 static void
-wbcir_cfg_ceir(struct wbcir_data *data)
+wbcir_init_hw(struct wbcir_data *data)
 {
        u8 tmp;
 
+       /* Disable interrupts */
+       wbcir_select_bank(data, WBCIR_BANK_0);
+       outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
+
        /* Set PROT_SEL, RX_INV, Clear CEIR_EN (needed for the led) */
        tmp = protocol << 4;
        if (invert)
@@ -1264,6 +1251,93 @@ wbcir_cfg_ceir(struct wbcir_data *data)
         * set SP3_IRRX_SW to binary 01, helpfully not documented
         */
        outb(0x10, data->ebase + WBCIR_REG_ECEIR_CTS);
+
+       /* Enable extended mode */
+       wbcir_select_bank(data, WBCIR_BANK_2);
+       outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1);
+
+       /*
+        * Configure baud generator, IR data will be sampled at
+        * a bitrate of: (24Mhz * prescaler) / (divisor * 16).
+        *
+        * The ECIR registers include a flag to change the
+        * 24Mhz clock freq to 48Mhz.
+        *
+        * It's not documented in the specs, but fifo levels
+        * other than 16 seems to be unsupported.
+        */
+
+       /* prescaler 1.0, tx/rx fifo lvl 16 */
+       outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2);
+
+       /* Set baud divisor to generate one byte per bit/cell */
+       switch (protocol) {
+       case IR_PROTOCOL_RC5:
+               outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL);
+               break;
+       case IR_PROTOCOL_RC6:
+               outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL);
+               break;
+       case IR_PROTOCOL_NEC:
+               outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL);
+               break;
+       }
+       outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);
+
+       /* Set CEIR mode */
+       wbcir_select_bank(data, WBCIR_BANK_0);
+       outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR);
+       inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */
+       inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */
+
+       /* Disable RX demod, run-length encoding/decoding, set freq span */
+       wbcir_select_bank(data, WBCIR_BANK_7);
+       outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG);
+
+       /* Disable timer */
+       wbcir_select_bank(data, WBCIR_BANK_4);
+       outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1);
+
+       /* Enable MSR interrupt, Clear AUX_IRX */
+       wbcir_select_bank(data, WBCIR_BANK_5);
+       outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR2);
+
+       /* Disable CRC */
+       wbcir_select_bank(data, WBCIR_BANK_6);
+       outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3);
+
+       /* Set RX/TX (de)modulation freq, not really used */
+       wbcir_select_bank(data, WBCIR_BANK_7);
+       outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC);
+       outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC);
+
+       /* Set invert and pin direction */
+       if (invert)
+               outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4);
+       else
+               outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4);
+
+       /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */
+       wbcir_select_bank(data, WBCIR_BANK_0);
+       outb(0x97, data->sbase + WBCIR_REG_SP3_FCR);
+
+       /* Clear AUX status bits */
+       outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR);
+
+       /* Enable interrupts */
+       wbcir_reset_irdata(data);
+       outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER);
+}
+
+static int
+wbcir_resume(struct pnp_dev *device)
+{
+       struct wbcir_data *data = pnp_get_drvdata(device);
+
+       wbcir_init_hw(data);
+       enable_irq(data->irq);
+
+       return 0;
 }
 
 static int __devinit
@@ -1393,86 +1467,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
 
        device_init_wakeup(&device->dev, 1);
 
-       wbcir_cfg_ceir(data);
-
-       /* Disable interrupts */
-       wbcir_select_bank(data, WBCIR_BANK_0);
-       outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
-
-       /* Enable extended mode */
-       wbcir_select_bank(data, WBCIR_BANK_2);
-       outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1);
-
-       /*
-        * Configure baud generator, IR data will be sampled at
-        * a bitrate of: (24Mhz * prescaler) / (divisor * 16).
-        *
-        * The ECIR registers include a flag to change the
-        * 24Mhz clock freq to 48Mhz.
-        *
-        * It's not documented in the specs, but fifo levels
-        * other than 16 seems to be unsupported.
-        */
-
-       /* prescaler 1.0, tx/rx fifo lvl 16 */
-       outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2);
-
-       /* Set baud divisor to generate one byte per bit/cell */
-       switch (protocol) {
-       case IR_PROTOCOL_RC5:
-               outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL);
-               break;
-       case IR_PROTOCOL_RC6:
-               outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL);
-               break;
-       case IR_PROTOCOL_NEC:
-               outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL);
-               break;
-       }
-       outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);
-
-       /* Set CEIR mode */
-       wbcir_select_bank(data, WBCIR_BANK_0);
-       outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR);
-       inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */
-       inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */
-
-       /* Disable RX demod, run-length encoding/decoding, set freq span */
-       wbcir_select_bank(data, WBCIR_BANK_7);
-       outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG);
-
-       /* Disable timer */
-       wbcir_select_bank(data, WBCIR_BANK_4);
-       outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1);
-
-       /* Enable MSR interrupt, Clear AUX_IRX */
-       wbcir_select_bank(data, WBCIR_BANK_5);
-       outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR2);
-
-       /* Disable CRC */
-       wbcir_select_bank(data, WBCIR_BANK_6);
-       outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3);
-
-       /* Set RX/TX (de)modulation freq, not really used */
-       wbcir_select_bank(data, WBCIR_BANK_7);
-       outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC);
-       outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC);
-
-       /* Set invert and pin direction */
-       if (invert)
-               outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4);
-       else
-               outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4);
-
-       /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */
-       wbcir_select_bank(data, WBCIR_BANK_0);
-       outb(0x97, data->sbase + WBCIR_REG_SP3_FCR);
-
-       /* Clear AUX status bits */
-       outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR);
-
-       /* Enable interrupts */
-       outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER);
+       wbcir_init_hw(data);
 
        return 0;
 
index 90be30e9355606cbc0e50971fc4381c5b429952e..9169d1591c1fea50c854c82a129bff8663d2fe12 100644 (file)
@@ -68,10 +68,6 @@ module_param(post_interrupt_delay, int, 0644);
 MODULE_PARM_DESC(post_interrupt_delay,
        "delay (ms) before recal after recal interrupt detected");
 
-static int autorecal = 1;
-module_param(autorecal, int, 0644);
-MODULE_PARM_DESC(autorecal, "enable recalibration in the driver");
-
 /*
  * When the touchpad gets ultra-sensitive, one can keep their finger 1/2"
  * above the pad and still have it send packets.  This causes a jump cursor
index 1dacbe0d934832e54cae29353fd258e9a24bb339..797314be7af2ffadc6361a44f7d87403fda419ed 100644 (file)
@@ -186,7 +186,7 @@ static void __devexit pcips2_remove(struct pci_dev *dev)
        pci_disable_device(dev);
 }
 
-static struct pci_device_id pcips2_ids[] = {
+static const struct pci_device_id pcips2_ids[] = {
        {
                .vendor         = 0x14f2,       /* MOBILITY */
                .device         = 0x0123,       /* Keyboard */
index e0f30186d513d4633649beeb9a7f73e361c7d972..c3b626e9eae7c075cd7597779ddbef4becb731f6 100644 (file)
@@ -26,6 +26,8 @@
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/stddef.h>
 #include <linux/module.h>
 #include <linux/serio.h>
@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
 
                error = device_bind_driver(&serio->dev);
                if (error) {
-                       printk(KERN_WARNING
-                               "serio: device_bind_driver() failed "
-                               "for %s (%s) and %s, error: %d\n",
-                               serio->phys, serio->name,
-                               drv->description, error);
+                       dev_warn(&serio->dev,
+                                "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
+                                serio->phys, serio->name,
+                                drv->description, error);
                        serio_disconnect_driver(serio);
                        serio->dev.driver = NULL;
                        return error;
@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio)
 
        error = device_attach(&serio->dev);
        if (error < 0)
-               printk(KERN_WARNING
-                       "serio: device_attach() failed for %s (%s), error: %d\n",
-                       serio->phys, serio->name, error);
+               dev_warn(&serio->dev,
+                        "device_attach() failed for %s (%s), error: %d\n",
+                        serio->phys, serio->name, error);
 }
 
 
@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner,
 
        event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC);
        if (!event) {
-               printk(KERN_ERR
-                       "serio: Not enough memory to queue event %d\n",
-                       event_type);
+               pr_err("Not enough memory to queue event %d\n", event_type);
                retval = -ENOMEM;
                goto out;
        }
 
        if (!try_module_get(owner)) {
-               printk(KERN_WARNING
-                       "serio: Can't get module reference, dropping event %d\n",
-                       event_type);
+               pr_warning("Can't get module reference, dropping event %d\n",
+                          event_type);
                kfree(event);
                retval = -EINVAL;
                goto out;
@@ -230,14 +228,12 @@ static void serio_free_event(struct serio_event *event)
 
 static void serio_remove_duplicate_events(struct serio_event *event)
 {
-       struct list_head *node, *next;
-       struct serio_event *e;
+       struct serio_event *e, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&serio_event_lock, flags);
 
-       list_for_each_safe(node, next, &serio_event_list) {
-               e = list_entry(node, struct serio_event, node);
+       list_for_each_entry_safe(e, next, &serio_event_list, node) {
                if (event->object == e->object) {
                        /*
                         * If this event is of different type we should not
@@ -247,7 +243,7 @@ static void serio_remove_duplicate_events(struct serio_event *event)
                        if (event->type != e->type)
                                break;
 
-                       list_del_init(node);
+                       list_del_init(&e->node);
                        serio_free_event(e);
                }
        }
@@ -258,23 +254,18 @@ static void serio_remove_duplicate_events(struct serio_event *event)
 
 static struct serio_event *serio_get_event(void)
 {
-       struct serio_event *event;
-       struct list_head *node;
+       struct serio_event *event = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&serio_event_lock, flags);
 
-       if (list_empty(&serio_event_list)) {
-               spin_unlock_irqrestore(&serio_event_lock, flags);
-               return NULL;
+       if (!list_empty(&serio_event_list)) {
+               event = list_first_entry(&serio_event_list,
+                                        struct serio_event, node);
+               list_del_init(&event->node);
        }
 
-       node = serio_event_list.next;
-       event = list_entry(node, struct serio_event, node);
-       list_del_init(node);
-
        spin_unlock_irqrestore(&serio_event_lock, flags);
-
        return event;
 }
 
@@ -287,29 +278,27 @@ static void serio_handle_event(void)
        while ((event = serio_get_event())) {
 
                switch (event->type) {
-                       case SERIO_REGISTER_PORT:
-                               serio_add_port(event->object);
-                               break;
 
-                       case SERIO_RECONNECT_PORT:
-                               serio_reconnect_port(event->object);
-                               break;
+               case SERIO_REGISTER_PORT:
+                       serio_add_port(event->object);
+                       break;
 
-                       case SERIO_RESCAN_PORT:
-                               serio_disconnect_port(event->object);
-                               serio_find_driver(event->object);
-                               break;
+               case SERIO_RECONNECT_PORT:
+                       serio_reconnect_port(event->object);
+                       break;
 
-                       case SERIO_RECONNECT_CHAIN:
-                               serio_reconnect_chain(event->object);
-                               break;
+               case SERIO_RESCAN_PORT:
+                       serio_disconnect_port(event->object);
+                       serio_find_driver(event->object);
+                       break;
 
-                       case SERIO_ATTACH_DRIVER:
-                               serio_attach_driver(event->object);
-                               break;
+               case SERIO_RECONNECT_CHAIN:
+                       serio_reconnect_chain(event->object);
+                       break;
 
-                       default:
-                               break;
+               case SERIO_ATTACH_DRIVER:
+                       serio_attach_driver(event->object);
+                       break;
                }
 
                serio_remove_duplicate_events(event);
@@ -325,16 +314,14 @@ static void serio_handle_event(void)
  */
 static void serio_remove_pending_events(void *object)
 {
-       struct list_head *node, *next;
-       struct serio_event *event;
+       struct serio_event *event, *next;
        unsigned long flags;
 
        spin_lock_irqsave(&serio_event_lock, flags);
 
-       list_for_each_safe(node, next, &serio_event_list) {
-               event = list_entry(node, struct serio_event, node);
+       list_for_each_entry_safe(event, next, &serio_event_list, node) {
                if (event->object == object) {
-                       list_del_init(node);
+                       list_del_init(&event->node);
                        serio_free_event(event);
                }
        }
@@ -380,7 +367,6 @@ static int serio_thread(void *nothing)
                        kthread_should_stop() || !list_empty(&serio_event_list));
        } while (!kthread_should_stop());
 
-       printk(KERN_DEBUG "serio: kseriod exiting\n");
        return 0;
 }
 
@@ -445,6 +431,11 @@ static struct attribute_group serio_id_attr_group = {
        .attrs  = serio_device_id_attrs,
 };
 
+static const struct attribute_group *serio_device_attr_groups[] = {
+       &serio_id_attr_group,
+       NULL
+};
+
 static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        struct serio *serio = to_serio_port(dev);
@@ -532,6 +523,7 @@ static void serio_init_port(struct serio *serio)
                        (long)atomic_inc_return(&serio_no) - 1);
        serio->dev.bus = &serio_bus;
        serio->dev.release = serio_release_port;
+       serio->dev.groups = serio_device_attr_groups;
        if (serio->parent) {
                serio->dev.parent = &serio->parent->dev;
                serio->depth = serio->parent->depth + 1;
@@ -555,21 +547,15 @@ static void serio_add_port(struct serio *serio)
        }
 
        list_add_tail(&serio->node, &serio_list);
+
        if (serio->start)
                serio->start(serio);
+
        error = device_add(&serio->dev);
        if (error)
-               printk(KERN_ERR
-                       "serio: device_add() failed for %s (%s), error: %d\n",
+               dev_err(&serio->dev,
+                       "device_add() failed for %s (%s), error: %d\n",
                        serio->phys, serio->name, error);
-       else {
-               serio->registered = true;
-               error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
-               if (error)
-                       printk(KERN_ERR
-                               "serio: sysfs_create_group() failed for %s (%s), error: %d\n",
-                               serio->phys, serio->name, error);
-       }
 }
 
 /*
@@ -596,11 +582,8 @@ static void serio_destroy_port(struct serio *serio)
                serio->parent = NULL;
        }
 
-       if (serio->registered) {
-               sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
+       if (device_is_registered(&serio->dev))
                device_del(&serio->dev);
-               serio->registered = false;
-       }
 
        list_del_init(&serio->node);
        serio_remove_pending_events(serio);
@@ -798,9 +781,8 @@ static void serio_attach_driver(struct serio_driver *drv)
 
        error = driver_attach(&drv->driver);
        if (error)
-               printk(KERN_WARNING
-                       "serio: driver_attach() failed for %s with error %d\n",
-                       drv->driver.name, error);
+               pr_warning("driver_attach() failed for %s with error %d\n",
+                          drv->driver.name, error);
 }
 
 int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
@@ -820,8 +802,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
 
        error = driver_register(&drv->driver);
        if (error) {
-               printk(KERN_ERR
-                       "serio: driver_register() failed for %s, error: %d\n",
+               pr_err("driver_register() failed for %s, error: %d\n",
                        drv->driver.name, error);
                return error;
        }
@@ -987,7 +968,7 @@ irqreturn_t serio_interrupt(struct serio *serio,
 
         if (likely(serio->drv)) {
                 ret = serio->drv->interrupt(serio, data, dfl);
-       } else if (!dfl && serio->registered) {
+       } else if (!dfl && device_is_registered(&serio->dev)) {
                serio_rescan(serio);
                ret = IRQ_HANDLED;
        }
@@ -1018,7 +999,7 @@ static int __init serio_init(void)
 
        error = bus_register(&serio_bus);
        if (error) {
-               printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error);
+               pr_err("Failed to register serio bus, error: %d\n", error);
                return error;
        }
 
@@ -1026,7 +1007,7 @@ static int __init serio_init(void)
        if (IS_ERR(serio_task)) {
                bus_unregister(&serio_bus);
                error = PTR_ERR(serio_task);
-               printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error);
+               pr_err("Failed to start kseriod, error: %d\n", error);
                return error;
        }
 
index ebb22f88c8426bdd3cebff9e2f822d0b7412ade7..8298e1f68234df7cbd33afbc4d452595155530c0 100644 (file)
@@ -270,7 +270,7 @@ static int __devinit xps2_of_probe(struct of_device *ofdev,
        drvdata->irq = r_irq.start;
 
        phys_addr = r_mem.start;
-       remap_size = r_mem.end - r_mem.start + 1;
+       remap_size = resource_size(&r_mem);
        if (!request_mem_region(phys_addr, remap_size, DRIVER_NAME)) {
                dev_err(dev, "Couldn't lock memory region at 0x%08llX\n",
                        (unsigned long long)phys_addr);
@@ -344,7 +344,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev)
        if (of_address_to_resource(of_dev->node, 0, &r_mem))
                dev_err(dev, "invalid address\n");
        else
-               release_mem_region(r_mem.start, r_mem.end - r_mem.start + 1);
+               release_mem_region(r_mem.start, resource_size(&r_mem));
 
        kfree(drvdata);
 
@@ -354,7 +354,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev)
 }
 
 /* Match table for of_platform binding */
-static struct of_device_id xps2_of_match[] __devinitdata = {
+static const struct of_device_id xps2_of_match[] __devinitconst = {
        { .compatible = "xlnx,xps-ps2-1.00.a", },
        { /* end of list */ },
 };
index 3d32d3f4e486629d653330b38aafc59fb44d1af7..866a9ee1af1ae8f6093a3108867e2b6da5deb0a9 100644 (file)
@@ -92,7 +92,7 @@ Scott Hill shill@gtcocalcomp.com
 /* DATA STRUCTURES */
 
 /* Device table */
-static struct usb_device_id gtco_usbid_table [] = {
+static const struct usb_device_id gtco_usbid_table[] = {
        { USB_DEVICE(VENDOR_ID_GTCO, PID_400) },
        { USB_DEVICE(VENDOR_ID_GTCO, PID_401) },
        { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) },
index 16310f368dab0d24d3eeae9fe75e7f26d5b1135b..8fef1b689c692c0d51aff284b338684130bf28e2 100644 (file)
@@ -85,6 +85,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/usb/input.h>
 #include <asm/unaligned.h>
@@ -120,6 +121,8 @@ struct wacom_combo {
        struct urb *urb;
 };
 
+extern const struct usb_device_id wacom_ids[];
+
 extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo);
 extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data);
 extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data);
@@ -142,7 +145,5 @@ extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wa
 extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac);
 extern __u16 wacom_le16_to_cpu(unsigned char *data);
 extern __u16 wacom_be16_to_cpu(unsigned char *data);
-extern struct wacom_features *get_wacom_feature(const struct usb_device_id *id);
-extern const struct usb_device_id *get_device_table(void);
 
 #endif
index 072f33b3b2b027c52512569438376929226b5886..a1770e6feeecbce050078a8bdd6571aa9aab2018 100644 (file)
@@ -211,7 +211,8 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
        input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) |
                BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) |
                BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2);
-       input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
+       input_set_abs_params(input_dev, ABS_DISTANCE,
+                            0, wacom_wac->features.distance_max, 0, 0);
 }
 
 void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
@@ -261,7 +262,8 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
                BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) |
                BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) |
                BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2);
-       input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
+       input_set_abs_params(input_dev, ABS_DISTANCE,
+                            0, wacom_wac->features.distance_max, 0, 0);
        input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
        input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
        input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
@@ -282,17 +284,19 @@ void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 
 void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 {
-       if (wacom_wac->features->device_type == BTN_TOOL_DOUBLETAP ||
-           wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) {
-               input_set_abs_params(input_dev, ABS_RX, 0, wacom_wac->features->x_phy, 0, 0);
-               input_set_abs_params(input_dev, ABS_RY, 0, wacom_wac->features->y_phy, 0, 0);
-               input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_DOUBLETAP);
+       struct wacom_features *features = &wacom_wac->features;
+
+       if (features->device_type == BTN_TOOL_DOUBLETAP ||
+           features->device_type == BTN_TOOL_TRIPLETAP) {
+               input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0);
+               input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0);
+               __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
        }
 }
 
 void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 {
-       if (wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) {
+       if (wacom_wac->features.device_type == BTN_TOOL_TRIPLETAP) {
                input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP);
                input_dev->evbit[0] |= BIT_MASK(EV_MSC);
                input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL);
@@ -532,21 +536,38 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
        struct wacom_wac *wacom_wac;
        struct wacom_features *features;
        struct input_dev *input_dev;
-       int error = -ENOMEM;
+       int error;
+
+       if (!id->driver_info)
+               return -EINVAL;
 
        wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
        wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL);
        input_dev = input_allocate_device();
-       if (!wacom || !input_dev || !wacom_wac)
+       if (!wacom || !input_dev || !wacom_wac) {
+               error = -ENOMEM;
                goto fail1;
+       }
 
-       wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, GFP_KERNEL, &wacom->data_dma);
-       if (!wacom_wac->data)
+       wacom_wac->features = *((struct wacom_features *)id->driver_info);
+       features = &wacom_wac->features;
+       if (features->pktlen > WACOM_PKGLEN_MAX) {
+               error = -EINVAL;
                goto fail1;
+       }
+
+       wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX,
+                                          GFP_KERNEL, &wacom->data_dma);
+       if (!wacom_wac->data) {
+               error = -ENOMEM;
+               goto fail1;
+       }
 
        wacom->irq = usb_alloc_urb(0, GFP_KERNEL);
-       if (!wacom->irq)
+       if (!wacom->irq) {
+               error = -ENOMEM;
                goto fail2;
+       }
 
        wacom->usbdev = dev;
        wacom->dev = input_dev;
@@ -555,11 +576,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
        usb_make_path(dev, wacom->phys, sizeof(wacom->phys));
        strlcat(wacom->phys, "/input0", sizeof(wacom->phys));
 
-       wacom_wac->features = features = get_wacom_feature(id);
-       BUG_ON(features->pktlen > WACOM_PKGLEN_MAX);
-
-       input_dev->name = wacom_wac->features->name;
-       wacom->wacom_wac = wacom_wac;
        usb_to_input_id(dev, &input_dev->id);
 
        input_dev->dev.parent = &intf->dev;
@@ -576,6 +592,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
        if (error)
                goto fail2;
 
+       strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
+
+       if (features->type == TABLETPC || features->type == TABLETPC2FG) {
+               /* Append the device type to the name */
+               strlcat(wacom_wac->name,
+                       features->device_type == BTN_TOOL_PEN ?
+                               " Pen" : " Finger",
+                       sizeof(wacom_wac->name));
+       }
+
+       input_dev->name = wacom_wac->name;
+       wacom->wacom_wac = wacom_wac;
+
        input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
        input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH);
 
@@ -640,7 +669,7 @@ static int wacom_suspend(struct usb_interface *intf, pm_message_t message)
 static int wacom_resume(struct usb_interface *intf)
 {
        struct wacom *wacom = usb_get_intfdata(intf);
-       struct wacom_features *features = wacom->wacom_wac->features;
+       struct wacom_features *features = &wacom->wacom_wac->features;
        int rv;
 
        mutex_lock(&wacom->lock);
@@ -663,6 +692,7 @@ static int wacom_reset_resume(struct usb_interface *intf)
 
 static struct usb_driver wacom_driver = {
        .name =         "wacom",
+       .id_table =     wacom_ids,
        .probe =        wacom_probe,
        .disconnect =   wacom_disconnect,
        .suspend =      wacom_suspend,
@@ -674,7 +704,7 @@ static struct usb_driver wacom_driver = {
 static int __init wacom_init(void)
 {
        int result;
-       wacom_driver.id_table = get_device_table();
+
        result = usb_register(&wacom_driver);
        if (result == 0)
                printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
index 1056f149fe31653d423f1da1d10c6e2f0d783d6b..3d81443e683ab4d49a107a656ac6048601825909 100644 (file)
@@ -55,6 +55,7 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo)
 
 static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
 {
+       struct wacom_features *features = &wacom->features;
        unsigned char *data = wacom->data;
        int prox, pressure;
 
@@ -68,9 +69,9 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo)
        if (prox) {
                wacom->id[0] = ERASER_DEVICE_ID;
                pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
-               if (wacom->features->pressure_max > 255)
+               if (features->pressure_max > 255)
                        pressure = (pressure << 1) | ((data[4] >> 6) & 1);
-               pressure += (wacom->features->pressure_max + 1) / 2;
+               pressure += (features->pressure_max + 1) / 2;
 
                /*
                 * if going from out of proximity into proximity select between the eraser
@@ -152,6 +153,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo)
 
 static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
 {
+       struct wacom_features *features = &wacom->features;
        unsigned char *data = wacom->data;
        int x, y, rw;
        static int penData = 0;
@@ -179,8 +181,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
 
                        case 2: /* Mouse with wheel */
                                wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04);
-                               if (wacom->features->type == WACOM_G4 ||
-                                               wacom->features->type == WACOM_MO) {
+                               if (features->type == WACOM_G4 || features->type == WACOM_MO) {
                                        rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03);
                                        wacom_report_rel(wcombo, REL_WHEEL, -rw);
                                } else
@@ -192,8 +193,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
                                wacom->id[0] = CURSOR_DEVICE_ID;
                                wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
                                wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
-                               if (wacom->features->type == WACOM_G4 ||
-                                               wacom->features->type == WACOM_MO)
+                               if (features->type == WACOM_G4 || features->type == WACOM_MO)
                                        wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
                                else
                                        wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
@@ -230,7 +230,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
        }
 
        /* send pad data */
-       switch (wacom->features->type) {
+       switch (features->type) {
            case WACOM_G4:
                if (data[7] & 0xf8) {
                        if (penData) {
@@ -300,11 +300,12 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
 
 static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
 {
+       struct wacom_features *features = &wacom->features;
        unsigned char *data = wacom->data;
        int idx = 0;
 
        /* tool number */
-       if (wacom->features->type == INTUOS)
+       if (features->type == INTUOS)
                idx = data[1] & 0x01;
 
        /* Enter report */
@@ -402,7 +403,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
                        wacom_report_key(wcombo, BTN_STYLUS2, 0);
                        wacom_report_key(wcombo, BTN_TOUCH, 0);
                        wacom_report_abs(wcombo, ABS_WHEEL, 0);
-                       if (wacom->features->type >= INTUOS3S)
+                       if (features->type >= INTUOS3S)
                                wacom_report_abs(wcombo, ABS_Z, 0);
                }
                wacom_report_key(wcombo, wacom->tool[idx], 0);
@@ -416,13 +417,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
 
 static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
 {
+       struct wacom_features *features = &wacom->features;
        unsigned char *data = wacom->data;
        unsigned int t;
 
        /* general pen packet */
        if ((data[1] & 0xb8) == 0xa0) {
                t = (data[6] << 2) | ((data[7] >> 6) & 3);
-               if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L)
+               if (features->type >= INTUOS4S && features->type <= INTUOS4L)
                        t = (t << 1) | (data[1] & 1);
                wacom_report_abs(wcombo, ABS_PRESSURE, t);
                wacom_report_abs(wcombo, ABS_TILT_X,
@@ -446,6 +448,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo)
 
 static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
 {
+       struct wacom_features *features = &wacom->features;
        unsigned char *data = wacom->data;
        unsigned int t;
        int idx = 0, result;
@@ -457,7 +460,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
        }
 
        /* tool number */
-       if (wacom->features->type == INTUOS)
+       if (features->type == INTUOS)
                idx = data[1] & 0x01;
 
        /* pad packets. Works as a second tool and is always in prox */
@@ -466,7 +469,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                if (wacom->tool[1] != BTN_TOOL_FINGER)
                        wacom->tool[1] = BTN_TOOL_FINGER;
 
-               if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) {
+               if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
                        wacom_report_key(wcombo, BTN_0, (data[2] & 0x01));
                        wacom_report_key(wcombo, BTN_1, (data[3] & 0x01));
                        wacom_report_key(wcombo, BTN_2, (data[3] & 0x02));
@@ -480,7 +483,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                                /* Out of proximity, clear wheel value. */
                                wacom_report_abs(wcombo, ABS_WHEEL, 0);
                        }
-                       if (wacom->features->type != INTUOS4S) {
+                       if (features->type != INTUOS4S) {
                                wacom_report_key(wcombo, BTN_7, (data[3] & 0x40));
                                wacom_report_key(wcombo, BTN_8, (data[3] & 0x80));
                        }
@@ -528,18 +531,20 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                return 0;
 
        /* Only large Intuos support Lense Cursor */
-       if ((wacom->tool[idx] == BTN_TOOL_LENS)
-                       && ((wacom->features->type == INTUOS3)
-                       || (wacom->features->type == INTUOS3S)
-                       || (wacom->features->type == INTUOS4)
-                       || (wacom->features->type == INTUOS4S)))
+       if (wacom->tool[idx] == BTN_TOOL_LENS &&
+           (features->type == INTUOS3 ||
+            features->type == INTUOS3S ||
+            features->type == INTUOS4 ||
+            features->type == INTUOS4S)) {
+
                return 0;
+       }
 
        /* Cintiq doesn't send data when RDY bit isn't set */
-       if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40))
+       if (features->type == CINTIQ && !(data[1] & 0x40))
                  return 0;
 
-       if (wacom->features->type >= INTUOS3S) {
+       if (features->type >= INTUOS3S) {
                wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
                wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
                wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
@@ -557,7 +562,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
 
                if (data[1] & 0x02) {
                        /* Rotation packet */
-                       if (wacom->features->type >= INTUOS3S) {
+                       if (features->type >= INTUOS3S) {
                                /* I3 marker pen rotation */
                                t = (data[6] << 3) | ((data[7] >> 5) & 7);
                                t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
@@ -570,7 +575,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                                        ((t - 1) / 2) : -t / 2);
                        }
 
-               } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) {
+               } else if (!(data[1] & 0x10) && features->type < INTUOS3S) {
                        /* 4D mouse packet */
                        wacom_report_key(wcombo, BTN_LEFT,   data[8] & 0x01);
                        wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02);
@@ -583,7 +588,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
 
                } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
                        /* I4 mouse */
-                       if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) {
+                       if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
                                wacom_report_key(wcombo, BTN_LEFT,   data[6] & 0x01);
                                wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02);
                                wacom_report_key(wcombo, BTN_RIGHT,  data[6] & 0x04);
@@ -604,13 +609,13 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
                                                 - ((data[8] & 0x02) >> 1));
 
                                /* I3 2D mouse side buttons */
-                               if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) {
+                               if (features->type >= INTUOS3S && features->type <= INTUOS3L) {
                                        wacom_report_key(wcombo, BTN_SIDE,   data[8] & 0x40);
                                        wacom_report_key(wcombo, BTN_EXTRA,  data[8] & 0x20);
                                }
                        }
-               } else if ((wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L ||
-                               wacom->features->type == INTUOS4L) &&
+               } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
+                               features->type == INTUOS4L) &&
                           wacom->tool[idx] == BTN_TOOL_LENS) {
                        /* Lens cursor packets */
                        wacom_report_key(wcombo, BTN_LEFT,   data[8] & 0x01);
@@ -718,6 +723,7 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo)
 
 static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
 {
+       struct wacom_features *features = &wacom->features;
        char *data = wacom->data;
        int prox = 0, pressure, idx = -1;
        static int stylusInProx, touchInProx = 1, touchOut;
@@ -791,7 +797,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
                        wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
                        pressure = ((data[7] & 0x01) << 8) | data[6];
                        if (pressure < 0)
-                               pressure = wacom->features->pressure_max + pressure + 1;
+                               pressure = features->pressure_max + pressure + 1;
                        wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
                        wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05);
                } else {
@@ -815,7 +821,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
 
 int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
 {
-       switch (wacom_wac->features->type) {
+       switch (wacom_wac->features.type) {
                case PENPARTNER:
                        return wacom_penpartner_irq(wacom_wac, wcombo);
 
@@ -853,7 +859,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
 
 void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
 {
-       switch (wacom_wac->features->type) {
+       switch (wacom_wac->features.type) {
                case WACOM_MO:
                        input_dev_mo(input_dev, wacom_wac);
                case WACOM_G4:
@@ -888,7 +894,7 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
                        /* fall through */
                case TABLETPC:
                        input_dev_tpc(input_dev, wacom_wac);
-                       if (wacom_wac->features->device_type != BTN_TOOL_PEN)
+                       if (wacom_wac->features.device_type != BTN_TOOL_PEN)
                                break;  /* no need to process stylus stuff */
 
                        /* fall through */
@@ -903,153 +909,201 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
        return;
 }
 
-static struct wacom_features wacom_features[] = {
-       { "Wacom Penpartner",     WACOM_PKGLEN_PENPRTN,    5040,  3780,  255,  0, PENPARTNER },
-       { "Wacom Graphire",       WACOM_PKGLEN_GRAPHIRE,  10206,  7422,  511, 63, GRAPHIRE },
-       { "Wacom Graphire2 4x5",  WACOM_PKGLEN_GRAPHIRE,  10206,  7422,  511, 63, GRAPHIRE },
-       { "Wacom Graphire2 5x7",  WACOM_PKGLEN_GRAPHIRE,  13918, 10206,  511, 63, GRAPHIRE },
-       { "Wacom Graphire3",      WACOM_PKGLEN_GRAPHIRE,  10208,  7424,  511, 63, GRAPHIRE },
-       { "Wacom Graphire3 6x8",  WACOM_PKGLEN_GRAPHIRE,  16704, 12064,  511, 63, GRAPHIRE },
-       { "Wacom Graphire4 4x5",  WACOM_PKGLEN_GRAPHIRE,  10208,  7424,  511, 63, WACOM_G4 },
-       { "Wacom Graphire4 6x8",  WACOM_PKGLEN_GRAPHIRE,  16704, 12064,  511, 63, WACOM_G4 },
-       { "Wacom BambooFun 4x5",  WACOM_PKGLEN_BBFUN,     14760,  9225,  511, 63, WACOM_MO },
-       { "Wacom BambooFun 6x8",  WACOM_PKGLEN_BBFUN,     21648, 13530,  511, 63, WACOM_MO },
-       { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE,  16704, 12064,  511, 63, GRAPHIRE },
-       { "Wacom Volito",         WACOM_PKGLEN_GRAPHIRE,   5104,  3712,  511, 63, GRAPHIRE },
-       { "Wacom PenStation2",    WACOM_PKGLEN_GRAPHIRE,   3250,  2320,  255, 63, GRAPHIRE },
-       { "Wacom Volito2 4x5",    WACOM_PKGLEN_GRAPHIRE,   5104,  3712,  511, 63, GRAPHIRE },
-       { "Wacom Volito2 2x3",    WACOM_PKGLEN_GRAPHIRE,   3248,  2320,  511, 63, GRAPHIRE },
-       { "Wacom PenPartner2",    WACOM_PKGLEN_GRAPHIRE,   3250,  2320,  511, 63, GRAPHIRE },
-       { "Wacom Bamboo",         WACOM_PKGLEN_BBFUN,     14760,  9225,  511, 63, WACOM_MO },
-       { "Wacom Bamboo1",        WACOM_PKGLEN_GRAPHIRE,   5104,  3712,  511, 63, GRAPHIRE },
-       { "Wacom Intuos 4x5",     WACOM_PKGLEN_INTUOS,    12700, 10600, 1023, 31, INTUOS },
-       { "Wacom Intuos 6x8",     WACOM_PKGLEN_INTUOS,    20320, 16240, 1023, 31, INTUOS },
-       { "Wacom Intuos 9x12",    WACOM_PKGLEN_INTUOS,    30480, 24060, 1023, 31, INTUOS },
-       { "Wacom Intuos 12x12",   WACOM_PKGLEN_INTUOS,    30480, 31680, 1023, 31, INTUOS },
-       { "Wacom Intuos 12x18",   WACOM_PKGLEN_INTUOS,    45720, 31680, 1023, 31, INTUOS },
-       { "Wacom PL400",          WACOM_PKGLEN_GRAPHIRE,   5408,  4056,  255,  0, PL },
-       { "Wacom PL500",          WACOM_PKGLEN_GRAPHIRE,   6144,  4608,  255,  0, PL },
-       { "Wacom PL600",          WACOM_PKGLEN_GRAPHIRE,   6126,  4604,  255,  0, PL },
-       { "Wacom PL600SX",        WACOM_PKGLEN_GRAPHIRE,   6260,  5016,  255,  0, PL },
-       { "Wacom PL550",          WACOM_PKGLEN_GRAPHIRE,   6144,  4608,  511,  0, PL },
-       { "Wacom PL800",          WACOM_PKGLEN_GRAPHIRE,   7220,  5780,  511,  0, PL },
-       { "Wacom PL700",          WACOM_PKGLEN_GRAPHIRE,   6758,  5406,  511,  0, PL },
-       { "Wacom PL510",          WACOM_PKGLEN_GRAPHIRE,   6282,  4762,  511,  0, PL },
-       { "Wacom DTU710",         WACOM_PKGLEN_GRAPHIRE,  34080, 27660,  511,  0, PL },
-       { "Wacom DTF521",         WACOM_PKGLEN_GRAPHIRE,   6282,  4762,  511,  0, PL },
-       { "Wacom DTF720",         WACOM_PKGLEN_GRAPHIRE,   6858,  5506,  511,  0, PL },
-       { "Wacom DTF720a",        WACOM_PKGLEN_GRAPHIRE,   6858,  5506,  511,  0, PL },
-       { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE,  20480, 15360,  511,  0, PTU },
-       { "Wacom Intuos2 4x5",    WACOM_PKGLEN_INTUOS,    12700, 10600, 1023, 31, INTUOS },
-       { "Wacom Intuos2 6x8",    WACOM_PKGLEN_INTUOS,    20320, 16240, 1023, 31, INTUOS },
-       { "Wacom Intuos2 9x12",   WACOM_PKGLEN_INTUOS,    30480, 24060, 1023, 31, INTUOS },
-       { "Wacom Intuos2 12x12",  WACOM_PKGLEN_INTUOS,    30480, 31680, 1023, 31, INTUOS },
-       { "Wacom Intuos2 12x18",  WACOM_PKGLEN_INTUOS,    45720, 31680, 1023, 31, INTUOS },
-       { "Wacom Intuos3 4x5",    WACOM_PKGLEN_INTUOS,    25400, 20320, 1023, 63, INTUOS3S },
-       { "Wacom Intuos3 6x8",    WACOM_PKGLEN_INTUOS,    40640, 30480, 1023, 63, INTUOS3 },
-       { "Wacom Intuos3 9x12",   WACOM_PKGLEN_INTUOS,    60960, 45720, 1023, 63, INTUOS3 },
-       { "Wacom Intuos3 12x12",  WACOM_PKGLEN_INTUOS,    60960, 60960, 1023, 63, INTUOS3L },
-       { "Wacom Intuos3 12x19",  WACOM_PKGLEN_INTUOS,    97536, 60960, 1023, 63, INTUOS3L },
-       { "Wacom Intuos3 6x11",   WACOM_PKGLEN_INTUOS,    54204, 31750, 1023, 63, INTUOS3 },
-       { "Wacom Intuos3 4x6",    WACOM_PKGLEN_INTUOS,    31496, 19685, 1023, 63, INTUOS3S },
-       { "Wacom Intuos4 4x6",    WACOM_PKGLEN_INTUOS,    31496, 19685, 2047, 63, INTUOS4S },
-       { "Wacom Intuos4 6x9",    WACOM_PKGLEN_INTUOS,    44704, 27940, 2047, 63, INTUOS4 },
-       { "Wacom Intuos4 8x13",   WACOM_PKGLEN_INTUOS,    65024, 40640, 2047, 63, INTUOS4L },
-       { "Wacom Intuos4 12x19",  WACOM_PKGLEN_INTUOS,    97536, 60960, 2047, 63, INTUOS4L },
-       { "Wacom Cintiq 21UX",    WACOM_PKGLEN_INTUOS,    87200, 65600, 1023, 63, CINTIQ },
-       { "Wacom Cintiq 20WSX",   WACOM_PKGLEN_INTUOS,    86680, 54180, 1023, 63, WACOM_BEE },
-       { "Wacom Cintiq 12WX",    WACOM_PKGLEN_INTUOS,    53020, 33440, 1023, 63, WACOM_BEE },
-       { "Wacom DTU1931",        WACOM_PKGLEN_GRAPHIRE,  37832, 30305,  511,  0, PL },
-       { "Wacom ISDv4 90",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,  0, TABLETPC },
-       { "Wacom ISDv4 93",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,  0, TABLETPC },
-       { "Wacom ISDv4 9A",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,  0, TABLETPC },
-       { "Wacom ISDv4 9F",       WACOM_PKGLEN_PENABLED,  26202, 16325,  255,  0, TABLETPC },
-       { "Wacom ISDv4 E2",       WACOM_PKGLEN_TPC2FG,    26202, 16325,  255,  0, TABLETPC2FG },
-       { "Wacom ISDv4 E3",       WACOM_PKGLEN_TPC2FG,    26202, 16325,  255,  0, TABLETPC2FG },
-       { "Wacom Intuos2 6x8",    WACOM_PKGLEN_INTUOS,    20320, 16240, 1023, 31, INTUOS },
+static const struct wacom_features wacom_features_0x00 =
+       { "Wacom Penpartner",     WACOM_PKGLEN_PENPRTN,    5040,  3780,  255,  0, PENPARTNER };
+static const struct wacom_features wacom_features_0x10 =
+       { "Wacom Graphire",       WACOM_PKGLEN_GRAPHIRE,  10206,  7422,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x11 =
+       { "Wacom Graphire2 4x5",  WACOM_PKGLEN_GRAPHIRE,  10206,  7422,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x12 =
+       { "Wacom Graphire2 5x7",  WACOM_PKGLEN_GRAPHIRE,  13918, 10206,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x13 =
+       { "Wacom Graphire3",      WACOM_PKGLEN_GRAPHIRE,  10208,  7424,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x14 =
+       { "Wacom Graphire3 6x8",  WACOM_PKGLEN_GRAPHIRE,  16704, 12064,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x15 =
+       { "Wacom Graphire4 4x5",  WACOM_PKGLEN_GRAPHIRE,  10208,  7424,  511, 63, WACOM_G4 };
+static const struct wacom_features wacom_features_0x16 =
+       { "Wacom Graphire4 6x8",  WACOM_PKGLEN_GRAPHIRE,  16704, 12064,  511, 63, WACOM_G4 };
+static const struct wacom_features wacom_features_0x17 =
+       { "Wacom BambooFun 4x5",  WACOM_PKGLEN_BBFUN,     14760,  9225,  511, 63, WACOM_MO };
+static const struct wacom_features wacom_features_0x18 =
+       { "Wacom BambooFun 6x8",  WACOM_PKGLEN_BBFUN,     21648, 13530,  511, 63, WACOM_MO };
+static const struct wacom_features wacom_features_0x19 =
+       { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE,  16704, 12064,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x60 =
+       { "Wacom Volito",         WACOM_PKGLEN_GRAPHIRE,   5104,  3712,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x61 =
+       { "Wacom PenStation2",    WACOM_PKGLEN_GRAPHIRE,   3250,  2320,  255, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x62 =
+       { "Wacom Volito2 4x5",    WACOM_PKGLEN_GRAPHIRE,   5104,  3712,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x63 =
+       { "Wacom Volito2 2x3",    WACOM_PKGLEN_GRAPHIRE,   3248,  2320,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x64 =
+       { "Wacom PenPartner2",    WACOM_PKGLEN_GRAPHIRE,   3250,  2320,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x65 =
+       { "Wacom Bamboo",         WACOM_PKGLEN_BBFUN,     14760,  9225,  511, 63, WACOM_MO };
+static const struct wacom_features wacom_features_0x69 =
+       { "Wacom Bamboo1",        WACOM_PKGLEN_GRAPHIRE,   5104,  3712,  511, 63, GRAPHIRE };
+static const struct wacom_features wacom_features_0x20 =
+       { "Wacom Intuos 4x5",     WACOM_PKGLEN_INTUOS,    12700, 10600, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x21 =
+       { "Wacom Intuos 6x8",     WACOM_PKGLEN_INTUOS,    20320, 16240, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x22 =
+       { "Wacom Intuos 9x12",    WACOM_PKGLEN_INTUOS,    30480, 24060, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x23 =
+       { "Wacom Intuos 12x12",   WACOM_PKGLEN_INTUOS,    30480, 31680, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x24 =
+       { "Wacom Intuos 12x18",   WACOM_PKGLEN_INTUOS,    45720, 31680, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x30 =
+       { "Wacom PL400",          WACOM_PKGLEN_GRAPHIRE,   5408,  4056,  255,  0, PL };
+static const struct wacom_features wacom_features_0x31 =
+       { "Wacom PL500",          WACOM_PKGLEN_GRAPHIRE,   6144,  4608,  255,  0, PL };
+static const struct wacom_features wacom_features_0x32 =
+       { "Wacom PL600",          WACOM_PKGLEN_GRAPHIRE,   6126,  4604,  255,  0, PL };
+static const struct wacom_features wacom_features_0x33 =
+       { "Wacom PL600SX",        WACOM_PKGLEN_GRAPHIRE,   6260,  5016,  255,  0, PL };
+static const struct wacom_features wacom_features_0x34 =
+       { "Wacom PL550",          WACOM_PKGLEN_GRAPHIRE,   6144,  4608,  511,  0, PL };
+static const struct wacom_features wacom_features_0x35 =
+       { "Wacom PL800",          WACOM_PKGLEN_GRAPHIRE,   7220,  5780,  511,  0, PL };
+static const struct wacom_features wacom_features_0x37 =
+       { "Wacom PL700",          WACOM_PKGLEN_GRAPHIRE,   6758,  5406,  511,  0, PL };
+static const struct wacom_features wacom_features_0x38 =
+       { "Wacom PL510",          WACOM_PKGLEN_GRAPHIRE,   6282,  4762,  511,  0, PL };
+static const struct wacom_features wacom_features_0x39 =
+       { "Wacom DTU710",         WACOM_PKGLEN_GRAPHIRE,  34080, 27660,  511,  0, PL };
+static const struct wacom_features wacom_features_0xC4 =
+       { "Wacom DTF521",         WACOM_PKGLEN_GRAPHIRE,   6282,  4762,  511,  0, PL };
+static const struct wacom_features wacom_features_0xC0 =
+       { "Wacom DTF720",         WACOM_PKGLEN_GRAPHIRE,   6858,  5506,  511,  0, PL };
+static const struct wacom_features wacom_features_0xC2 =
+       { "Wacom DTF720a",        WACOM_PKGLEN_GRAPHIRE,   6858,  5506,  511,  0, PL };
+static const struct wacom_features wacom_features_0x03 =
+       { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE,  20480, 15360,  511,  0, PTU };
+static const struct wacom_features wacom_features_0x41 =
+       { "Wacom Intuos2 4x5",    WACOM_PKGLEN_INTUOS,    12700, 10600, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x42 =
+       { "Wacom Intuos2 6x8",    WACOM_PKGLEN_INTUOS,    20320, 16240, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x43 =
+       { "Wacom Intuos2 9x12",   WACOM_PKGLEN_INTUOS,    30480, 24060, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x44 =
+       { "Wacom Intuos2 12x12",  WACOM_PKGLEN_INTUOS,    30480, 31680, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0x45 =
+       { "Wacom Intuos2 12x18",  WACOM_PKGLEN_INTUOS,    45720, 31680, 1023, 31, INTUOS };
+static const struct wacom_features wacom_features_0xB0 =
+       { "Wacom Intuos3 4x5",    WACOM_PKGLEN_INTUOS,    25400, 20320, 1023, 63, INTUOS3S };
+static const struct wacom_features wacom_features_0xB1 =
+       { "Wacom Intuos3 6x8",    WACOM_PKGLEN_INTUOS,    40640, 30480, 1023, 63, INTUOS3 };
+static const struct wacom_features wacom_features_0xB2 =
+       { "Wacom Intuos3 9x12",   WACOM_PKGLEN_INTUOS,    60960, 45720, 1023, 63, INTUOS3 };
+static const struct wacom_features wacom_features_0xB3 =
+       { "Wacom Intuos3 12x12",  WACOM_PKGLEN_INTUOS,    60960, 60960, 1023, 63, INTUOS3L };
+static const struct wacom_features wacom_features_0xB4 =
+       { "Wacom Intuos3 12x19",  WACOM_PKGLEN_INTUOS,    97536, 60960, 1023, 63, INTUOS3L };
+static const struct wacom_features wacom_features_0xB5 =
+       { "Wacom Intuos3 6x11",   WACOM_PKGLEN_INTUOS,    54204, 31750, 1023, 63, INTUOS3 };
+static const struct wacom_features wacom_features_0xB7 =
+       { "Wacom Intuos3 4x6",    WACOM_PKGLEN_INTUOS,    31496, 19685, 1023, 63, INTUOS3S };
+static const struct wacom_features wacom_features_0xB8 =
+       { "Wacom Intuos4 4x6",    WACOM_PKGLEN_INTUOS,    31496, 19685, 2047, 63, INTUOS4S };
+static const struct wacom_features wacom_features_0xB9 =
+       { "Wacom Intuos4 6x9",    WACOM_PKGLEN_INTUOS,    44704, 27940, 2047, 63, INTUOS4 };
+static const struct wacom_features wacom_features_0xBA =
+       { "Wacom Intuos4 8x13",   WACOM_PKGLEN_INTUOS,    65024, 40640, 2047, 63, INTUOS4L };
+static const struct wacom_features wacom_features_0xBB =
+       { "Wacom Intuos4 12x19",  WACOM_PKGLEN_INTUOS,    97536, 60960, 2047, 63, INTUOS4L };
+static const struct wacom_features wacom_features_0x3F =
+       { "Wacom Cintiq 21UX",    WACOM_PKGLEN_INTUOS,    87200, 65600, 1023, 63, CINTIQ };
+static const struct wacom_features wacom_features_0xC5 =
+       { "Wacom Cintiq 20WSX",   WACOM_PKGLEN_INTUOS,    86680, 54180, 1023, 63, WACOM_BEE };
+static const struct wacom_features wacom_features_0xC6 =
+       { "Wacom Cintiq 12WX",    WACOM_PKGLEN_INTUOS,    53020, 33440, 1023, 63, WACOM_BEE };
+static const struct wacom_features wacom_features_0xC7 =
+       { "Wacom DTU1931",        WACOM_PKGLEN_GRAPHIRE,  37832, 30305,  511,  0, PL };
+static const struct wacom_features wacom_features_0x90 =
+       { "Wacom ISDv4 90",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,  0, TABLETPC };
+static const struct wacom_features wacom_features_0x93 =
+       { "Wacom ISDv4 93",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,  0, TABLETPC };
+static const struct wacom_features wacom_features_0x9A =
+       { "Wacom ISDv4 9A",       WACOM_PKGLEN_GRAPHIRE,  26202, 16325,  255,  0, TABLETPC };
+static const struct wacom_features wacom_features_0x9F =
+       { "Wacom ISDv4 9F",       WACOM_PKGLEN_PENABLED,  26202, 16325,  255,  0, TABLETPC };
+static const struct wacom_features wacom_features_0xE2 =
+       { "Wacom ISDv4 E2",       WACOM_PKGLEN_TPC2FG,    26202, 16325,  255,  0, TABLETPC2FG };
+static const struct wacom_features wacom_features_0xE3 =
+       { "Wacom ISDv4 E3",       WACOM_PKGLEN_TPC2FG,    26202, 16325,  255,  0, TABLETPC2FG };
+static const struct wacom_features wacom_features_0x47 =
+       { "Wacom Intuos2 6x8",    WACOM_PKGLEN_INTUOS,    20320, 16240, 1023, 31, INTUOS };
+
+#define USB_DEVICE_WACOM(prod)                                 \
+       USB_DEVICE(USB_VENDOR_ID_WACOM, prod),                  \
+       .driver_info = (kernel_ulong_t)&wacom_features_##prod
+
+const struct usb_device_id wacom_ids[] = {
+       { USB_DEVICE_WACOM(0x00) },
+       { USB_DEVICE_WACOM(0x10) },
+       { USB_DEVICE_WACOM(0x11) },
+       { USB_DEVICE_WACOM(0x12) },
+       { USB_DEVICE_WACOM(0x13) },
+       { USB_DEVICE_WACOM(0x14) },
+       { USB_DEVICE_WACOM(0x15) },
+       { USB_DEVICE_WACOM(0x16) },
+       { USB_DEVICE_WACOM(0x17) },
+       { USB_DEVICE_WACOM(0x18) },
+       { USB_DEVICE_WACOM(0x19) },
+       { USB_DEVICE_WACOM(0x60) },
+       { USB_DEVICE_WACOM(0x61) },
+       { USB_DEVICE_WACOM(0x62) },
+       { USB_DEVICE_WACOM(0x63) },
+       { USB_DEVICE_WACOM(0x64) },
+       { USB_DEVICE_WACOM(0x65) },
+       { USB_DEVICE_WACOM(0x69) },
+       { USB_DEVICE_WACOM(0x20) },
+       { USB_DEVICE_WACOM(0x21) },
+       { USB_DEVICE_WACOM(0x22) },
+       { USB_DEVICE_WACOM(0x23) },
+       { USB_DEVICE_WACOM(0x24) },
+       { USB_DEVICE_WACOM(0x30) },
+       { USB_DEVICE_WACOM(0x31) },
+       { USB_DEVICE_WACOM(0x32) },
+       { USB_DEVICE_WACOM(0x33) },
+       { USB_DEVICE_WACOM(0x34) },
+       { USB_DEVICE_WACOM(0x35) },
+       { USB_DEVICE_WACOM(0x37) },
+       { USB_DEVICE_WACOM(0x38) },
+       { USB_DEVICE_WACOM(0x39) },
+       { USB_DEVICE_WACOM(0xC4) },
+       { USB_DEVICE_WACOM(0xC0) },
+       { USB_DEVICE_WACOM(0xC2) },
+       { USB_DEVICE_WACOM(0x03) },
+       { USB_DEVICE_WACOM(0x41) },
+       { USB_DEVICE_WACOM(0x42) },
+       { USB_DEVICE_WACOM(0x43) },
+       { USB_DEVICE_WACOM(0x44) },
+       { USB_DEVICE_WACOM(0x45) },
+       { USB_DEVICE_WACOM(0xB0) },
+       { USB_DEVICE_WACOM(0xB1) },
+       { USB_DEVICE_WACOM(0xB2) },
+       { USB_DEVICE_WACOM(0xB3) },
+       { USB_DEVICE_WACOM(0xB4) },
+       { USB_DEVICE_WACOM(0xB5) },
+       { USB_DEVICE_WACOM(0xB7) },
+       { USB_DEVICE_WACOM(0xB8) },
+       { USB_DEVICE_WACOM(0xB9) },
+       { USB_DEVICE_WACOM(0xBA) },
+       { USB_DEVICE_WACOM(0xBB) },
+       { USB_DEVICE_WACOM(0x3F) },
+       { USB_DEVICE_WACOM(0xC5) },
+       { USB_DEVICE_WACOM(0xC6) },
+       { USB_DEVICE_WACOM(0xC7) },
+       { USB_DEVICE_WACOM(0x90) },
+       { USB_DEVICE_WACOM(0x93) },
+       { USB_DEVICE_WACOM(0x9A) },
+       { USB_DEVICE_WACOM(0x9F) },
+       { USB_DEVICE_WACOM(0xE2) },
+       { USB_DEVICE_WACOM(0xE3) },
+       { USB_DEVICE_WACOM(0x47) },
        { }
 };
-
-static struct usb_device_id wacom_ids[] = {
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x19) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x69) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x30) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x32) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC2) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB8) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB9) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBA) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBB) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC7) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x90) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x93) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9A) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9F) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xE2) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xE3) },
-       { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
-       { }
-};
-
-const struct usb_device_id *get_device_table(void)
-{
-        const struct usb_device_id *id_table = wacom_ids;
-
-        return id_table;
-}
-
-struct wacom_features * get_wacom_feature(const struct usb_device_id *id)
-{
-        int index = id - wacom_ids;
-        struct wacom_features *wf = &wacom_features[index];
-
-        return wf;
-}
-
 MODULE_DEVICE_TABLE(usb, wacom_ids);
index ee01e19027850fb70b5a61fae8d77843a8d7a981..8590b1e8ec3774294decc187a91e995bb0477bbc 100644 (file)
 /* packet length for individual models */
 #define WACOM_PKGLEN_PENPRTN    7
 #define WACOM_PKGLEN_GRAPHIRE   8
-#define WACOM_PKGLEN_BBFUN      9
-#define WACOM_PKGLEN_INTUOS    10
+#define WACOM_PKGLEN_BBFUN      9
+#define WACOM_PKGLEN_INTUOS    10
 #define WACOM_PKGLEN_PENABLED   8
 #define WACOM_PKGLEN_TPC1FG     5
-#define WACOM_PKGLEN_TPC2FG    14
+#define WACOM_PKGLEN_TPC2FG    14
 
 /* device IDs */
 #define STYLUS_DEVICE_ID       0x02
@@ -58,7 +58,7 @@ enum {
 };
 
 struct wacom_features {
-       char *name;
+       const char *name;
        int pktlen;
        int x_max;
        int y_max;
@@ -73,11 +73,12 @@ struct wacom_features {
 };
 
 struct wacom_wac {
+       char name[64];
        unsigned char *data;
-        int tool[2];
-        int id[2];
-        __u32 serial[2];
-       struct wacom_features *features;
+       int tool[2];
+       int id[2];
+       __u32 serial[2];
+       struct wacom_features features;
 };
 
 #endif
index dfafc76da4fbfbd2f6fb3d86f19e5ac6f6154be5..6457e060ae4915b421a61834880986952e094b6e 100644 (file)
@@ -90,7 +90,6 @@ config TOUCHSCREEN_CORGI
        tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)"
        depends on PXA_SHARPSL
        select CORGI_SSP_DEPRECATED
-       default y
        help
          Say Y here to enable the driver for the touchscreen on the
          Sharp SL-C7xx and SL-Cxx00 series of PDAs.
@@ -537,6 +536,11 @@ config TOUCHSCREEN_USB_ETT_TC5UH
        bool "ET&T TC5UH touchscreen controler support" if EMBEDDED
        depends on TOUCHSCREEN_USB_COMPOSITE
 
+config TOUCHSCREEN_USB_NEXIO
+       default y
+       bool "NEXIO/iNexio device support" if EMBEDDED
+       depends on TOUCHSCREEN_USB_COMPOSITE
+
 config TOUCHSCREEN_TOUCHIT213
        tristate "Sahara TouchIT-213 touchscreen"
        select SERIO
index 52d2ca147d8f004a3f24c4d5df4a80365300bd4c..8b05d8e975437501d73378d401e90a857db72d40 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
+#include <linux/regulator/consumer.h>
 #include <asm/irq.h>
 
 /*
@@ -85,6 +86,7 @@ struct ads7846 {
        char                    name[32];
 
        struct spi_device       *spi;
+       struct regulator        *reg;
 
 #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
        struct attribute_group  *attr_group;
@@ -788,6 +790,8 @@ static void ads7846_disable(struct ads7846 *ts)
                }
        }
 
+       regulator_disable(ts->reg);
+
        /* we know the chip's in lowpower mode since we always
         * leave it that way after every request
         */
@@ -799,6 +803,8 @@ static void ads7846_enable(struct ads7846 *ts)
        if (!ts->disabled)
                return;
 
+       regulator_enable(ts->reg);
+
        ts->disabled = 0;
        ts->irq_disabled = 0;
        enable_irq(ts->spi->irq);
@@ -1139,6 +1145,19 @@ static int __devinit ads7846_probe(struct spi_device *spi)
 
        ts->last_msg = m;
 
+       ts->reg = regulator_get(&spi->dev, "vcc");
+       if (IS_ERR(ts->reg)) {
+               dev_err(&spi->dev, "unable to get regulator: %ld\n",
+                       PTR_ERR(ts->reg));
+               goto err_free_gpio;
+       }
+
+       err = regulator_enable(ts->reg);
+       if (err) {
+               dev_err(&spi->dev, "unable to enable regulator: %d\n", err);
+               goto err_put_regulator;
+       }
+
        if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
                        spi->dev.driver->name, ts)) {
                dev_info(&spi->dev,
@@ -1148,7 +1167,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
                                  spi->dev.driver->name, ts);
                if (err) {
                        dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
-                       goto err_free_gpio;
+                       goto err_disable_regulator;
                }
        }
 
@@ -1180,6 +1199,10 @@ static int __devinit ads7846_probe(struct spi_device *spi)
        ads784x_hwmon_unregister(spi, ts);
  err_free_irq:
        free_irq(spi->irq, ts);
+ err_disable_regulator:
+       regulator_disable(ts->reg);
+ err_put_regulator:
+       regulator_put(ts->reg);
  err_free_gpio:
        if (ts->gpio_pendown != -1)
                gpio_free(ts->gpio_pendown);
@@ -1208,6 +1231,9 @@ static int __devexit ads7846_remove(struct spi_device *spi)
        /* suspend left the IRQ disabled */
        enable_irq(ts->spi->irq);
 
+       regulator_disable(ts->reg);
+       regulator_put(ts->reg);
+
        if (ts->gpio_pendown != -1)
                gpio_free(ts->gpio_pendown);
 
index 8f38c5e55ce6136782086534bdbf08e993f67702..486d31ba9c0952b28f95e73baa75a78b53316255 100644 (file)
@@ -72,45 +72,49 @@ static void elo_process_data_10(struct elo *elo, unsigned char data)
        struct input_dev *dev = elo->dev;
 
        elo->data[elo->idx] = data;
-       switch (elo->idx++) {
-               case 0:
-                       elo->csum = 0xaa;
-                       if (data != ELO10_LEAD_BYTE) {
-                               pr_debug("elo: unsynchronized data: 0x%02x\n", data);
-                               elo->idx = 0;
-                       }
-                       break;
 
-               case 9:
+       switch (elo->idx++) {
+       case 0:
+               elo->csum = 0xaa;
+               if (data != ELO10_LEAD_BYTE) {
+                       dev_dbg(&elo->serio->dev,
+                               "unsynchronized data: 0x%02x\n", data);
                        elo->idx = 0;
-                       if (data != elo->csum) {
-                               pr_debug("elo: bad checksum: 0x%02x, expected 0x%02x\n",
-                                        data, elo->csum);
-                               break;
-                       }
-                       if (elo->data[1] != elo->expected_packet) {
-                               if (elo->data[1] != ELO10_TOUCH_PACKET)
-                                       pr_debug("elo: unexpected packet: 0x%02x\n",
-                                                elo->data[1]);
-                               break;
-                       }
-                       if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) {
-                               input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
-                               input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
-                               if (elo->data[2] & ELO10_PRESSURE)
-                                       input_report_abs(dev, ABS_PRESSURE,
-                                                       (elo->data[8] << 8) | elo->data[7]);
-                               input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH);
-                               input_sync(dev);
-                       } else if (elo->data[1] == ELO10_ACK_PACKET) {
-                               if (elo->data[2] == '0')
-                                       elo->expected_packet = ELO10_TOUCH_PACKET;
-                               complete(&elo->cmd_done);
-                       } else {
-                               memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN);
-                               elo->expected_packet = ELO10_ACK_PACKET;
-                       }
+               }
+               break;
+
+       case 9:
+               elo->idx = 0;
+               if (data != elo->csum) {
+                       dev_dbg(&elo->serio->dev,
+                               "bad checksum: 0x%02x, expected 0x%02x\n",
+                                data, elo->csum);
+                       break;
+               }
+               if (elo->data[1] != elo->expected_packet) {
+                       if (elo->data[1] != ELO10_TOUCH_PACKET)
+                               dev_dbg(&elo->serio->dev,
+                                       "unexpected packet: 0x%02x\n",
+                                        elo->data[1]);
                        break;
+               }
+               if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) {
+                       input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
+                       input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
+                       if (elo->data[2] & ELO10_PRESSURE)
+                               input_report_abs(dev, ABS_PRESSURE,
+                                               (elo->data[8] << 8) | elo->data[7]);
+                       input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH);
+                       input_sync(dev);
+               } else if (elo->data[1] == ELO10_ACK_PACKET) {
+                       if (elo->data[2] == '0')
+                               elo->expected_packet = ELO10_TOUCH_PACKET;
+                       complete(&elo->cmd_done);
+               } else {
+                       memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN);
+                       elo->expected_packet = ELO10_ACK_PACKET;
+               }
+               break;
        }
        elo->csum += data;
 }
@@ -123,42 +127,53 @@ static void elo_process_data_6(struct elo *elo, unsigned char data)
 
        switch (elo->idx++) {
 
-               case 0: if ((data & 0xc0) != 0xc0) elo->idx = 0; break;
-               case 1: if ((data & 0xc0) != 0x80) elo->idx = 0; break;
-               case 2: if ((data & 0xc0) != 0x40) elo->idx = 0; break;
-
-               case 3:
-                       if (data & 0xc0) {
-                               elo->idx = 0;
-                               break;
-                       }
+       case 0:
+               if ((data & 0xc0) != 0xc0)
+                       elo->idx = 0;
+               break;
 
-                       input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f));
-                       input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f));
+       case 1:
+               if ((data & 0xc0) != 0x80)
+                       elo->idx = 0;
+               break;
 
-                       if (elo->id == 2) {
-                               input_report_key(dev, BTN_TOUCH, 1);
-                               input_sync(dev);
-                               elo->idx = 0;
-                       }
+       case 2:
+               if ((data & 0xc0) != 0x40)
+                       elo->idx = 0;
+               break;
 
+       case 3:
+               if (data & 0xc0) {
+                       elo->idx = 0;
                        break;
+               }
 
-               case 4:
-                       if (data) {
-                               input_sync(dev);
-                               elo->idx = 0;
-                       }
-                       break;
+               input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f));
+               input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f));
 
-               case 5:
-                       if ((data & 0xf0) == 0) {
-                               input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
-                               input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
-                       }
+               if (elo->id == 2) {
+                       input_report_key(dev, BTN_TOUCH, 1);
                        input_sync(dev);
                        elo->idx = 0;
-                       break;
+               }
+
+               break;
+
+       case 4:
+               if (data) {
+                       input_sync(dev);
+                       elo->idx = 0;
+               }
+               break;
+
+       case 5:
+               if ((data & 0xf0) == 0) {
+                       input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
+                       input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
+               }
+               input_sync(dev);
+               elo->idx = 0;
+               break;
        }
 }
 
@@ -170,17 +185,17 @@ static void elo_process_data_3(struct elo *elo, unsigned char data)
 
        switch (elo->idx++) {
 
-               case 0:
-                       if ((data & 0x7f) != 0x01)
-                               elo->idx = 0;
-                       break;
-               case 2:
-                       input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
-                       input_report_abs(dev, ABS_X, elo->data[1]);
-                       input_report_abs(dev, ABS_Y, elo->data[2]);
-                       input_sync(dev);
+       case 0:
+               if ((data & 0x7f) != 0x01)
                        elo->idx = 0;
-                       break;
+               break;
+       case 2:
+               input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80));
+               input_report_abs(dev, ABS_X, elo->data[1]);
+               input_report_abs(dev, ABS_Y, elo->data[2]);
+               input_sync(dev);
+               elo->idx = 0;
+               break;
        }
 }
 
@@ -189,19 +204,19 @@ static irqreturn_t elo_interrupt(struct serio *serio,
 {
        struct elo *elo = serio_get_drvdata(serio);
 
-       switch(elo->id) {
-               case 0:
-                       elo_process_data_10(elo, data);
-                       break;
-
-               case 1:
-               case 2:
-                       elo_process_data_6(elo, data);
-                       break;
-
-               case 3:
-                       elo_process_data_3(elo, data);
-                       break;
+       switch (elo->id) {
+       case 0:
+               elo_process_data_10(elo, data);
+               break;
+
+       case 1:
+       case 2:
+               elo_process_data_6(elo, data);
+               break;
+
+       case 3:
+               elo_process_data_3(elo, data);
+               break;
        }
 
        return IRQ_HANDLED;
@@ -261,10 +276,10 @@ static int elo_setup_10(struct elo *elo)
        if (packet[3] & ELO10_PRESSURE)
                input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
 
-       printk(KERN_INFO "elo: %sTouch touchscreen, fw: %02x.%02x, "
-               "features: 0x%02x, controller: 0x%02x\n",
-               elo_types[(packet[1] -'0') & 0x03],
-               packet[5], packet[4], packet[3], packet[7]);
+       dev_info(&elo->serio->dev,
+                "%sTouch touchscreen, fw: %02x.%02x, features: 0x%02x, controller: 0x%02x\n",
+                elo_types[(packet[1] -'0') & 0x03],
+                packet[5], packet[4], packet[3], packet[7]);
 
        return 0;
 }
@@ -330,24 +345,24 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
 
        switch (elo->id) {
 
-               case 0: /* 10-byte protocol */
-                       if (elo_setup_10(elo))
-                               goto fail3;
+       case 0: /* 10-byte protocol */
+               if (elo_setup_10(elo))
+                       goto fail3;
 
-                       break;
+               break;
 
-               case 1: /* 6-byte protocol */
-                       input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
+       case 1: /* 6-byte protocol */
+               input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
 
-               case 2: /* 4-byte protocol */
-                       input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
-                       input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
-                       break;
+       case 2: /* 4-byte protocol */
+               input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
+               input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
+               break;
 
-               case 3: /* 3-byte protocol */
-                       input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
-                       input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
-                       break;
+       case 3: /* 3-byte protocol */
+               input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
+               input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
+               break;
        }
 
        err = input_register_device(elo->dev);
index 6cdcf2a6e0365b2dd78a78bb25ae03ebcb9ee757..b6b8b1c7eceaf99b6eec1d613f3511c4a4a65550 100644 (file)
@@ -153,6 +153,9 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
                if (pressure)
                        p = MODR;
 
+               dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
+                       x, y, p);
+
                /* are samples valid */
                if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X ||
                    (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y ||
index 6386b441ef855f337d6ff71a4d45ebce443625ee..3755a47d053caea796fd4650c18889e0f7ea4fa4 100644 (file)
@@ -128,27 +128,29 @@ static void touch_timer_fire(unsigned long data)
 
        down = get_down(data0, data1);
 
-       if (ts.count == (1 << ts.shift)) {
-               ts.xp >>= ts.shift;
-               ts.yp >>= ts.shift;
+       if (down) {
+               if (ts.count == (1 << ts.shift)) {
+                       ts.xp >>= ts.shift;
+                       ts.yp >>= ts.shift;
 
-               dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
-                       __func__, ts.xp, ts.yp, ts.count);
+                       dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
+                               __func__, ts.xp, ts.yp, ts.count);
 
-               input_report_abs(ts.input, ABS_X, ts.xp);
-               input_report_abs(ts.input, ABS_Y, ts.yp);
+                       input_report_abs(ts.input, ABS_X, ts.xp);
+                       input_report_abs(ts.input, ABS_Y, ts.yp);
 
-               input_report_key(ts.input, BTN_TOUCH, 1);
-               input_sync(ts.input);
+                       input_report_key(ts.input, BTN_TOUCH, 1);
+                       input_sync(ts.input);
 
-               ts.xp = 0;
-               ts.yp = 0;
-               ts.count = 0;
-       }
+                       ts.xp = 0;
+                       ts.yp = 0;
+                       ts.count = 0;
+               }
 
-       if (down) {
                s3c_adc_start(ts.client, 0, 1 << ts.shift);
        } else {
+               ts.xp = 0;
+               ts.yp = 0;
                ts.count = 0;
 
                input_report_key(ts.input, BTN_TOUCH, 0);
@@ -401,6 +403,7 @@ static int s3c2410ts_resume(struct device *dev)
        struct s3c2410_ts_mach_info *info = pdev->dev.platform_data;
 
        clk_enable(ts.clock);
+       enable_irq(ts.irq_tc);
 
        /* Initialise registers */
        if ((info->delay & 0xffff) > 0)
index 7ef0d1420d3c917f48d4dd41013d4d4a6f7665f5..be23780e8a3e3b81be9df7b7cd0f8aab86d87e61 100644 (file)
@@ -358,7 +358,7 @@ static int __devexit tsc2007_remove(struct i2c_client *client)
        return 0;
 }
 
-static struct i2c_device_id tsc2007_idtable[] = {
+static const struct i2c_device_id tsc2007_idtable[] = {
        { "tsc2007", 0 },
        { }
 };
index 5256123a52285c35ed352d980ec7ad4641f941ee..99330bbdbac761c7f4d940f6b475861eec0bcf91 100644 (file)
@@ -15,6 +15,7 @@
  *  - GoTop Super_Q2/GogoPen/PenPower tablets
  *  - JASTEC USB touch controller/DigiTech DTR-02U
  *  - Zytronic capacitive touchscreen
+ *  - NEXIO/iNexio
  *
  * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
  * Copyright (C) by Todd E. Johnson (mtouchusb.c)
@@ -95,6 +96,7 @@ struct usbtouch_device_info {
 
        int  (*read_data)   (struct usbtouch_usb *usbtouch, unsigned char *pkt);
        int  (*init)        (struct usbtouch_usb *usbtouch);
+       void (*exit)        (struct usbtouch_usb *usbtouch);
 };
 
 /* a usbtouch device */
@@ -104,11 +106,12 @@ struct usbtouch_usb {
        unsigned char *buffer;
        int buf_len;
        struct urb *irq;
-       struct usb_device *udev;
+       struct usb_interface *interface;
        struct input_dev *input;
        struct usbtouch_device_info *type;
        char name[128];
        char phys[64];
+       void *priv;
 
        int x, y;
        int touch, press;
@@ -133,6 +136,7 @@ enum {
        DEVTYPE_E2I,
        DEVTYPE_ZYTRONIC,
        DEVTYPE_TC5UH,
+       DEVTYPE_NEXIO,
 };
 
 #define USB_DEVICE_HID_CLASS(vend, prod) \
@@ -144,7 +148,7 @@ enum {
        .bInterfaceClass = USB_INTERFACE_CLASS_HID, \
        .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE
 
-static struct usb_device_id usbtouch_devices[] = {
+static const struct usb_device_id usbtouch_devices[] = {
 #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
        /* ignore the HID capable devices, handled by usbhid */
        {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE},
@@ -222,6 +226,14 @@ static struct usb_device_id usbtouch_devices[] = {
        {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH},
 #endif
 
+#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
+       /* data interface only */
+       {USB_DEVICE_AND_INTERFACE_INFO(0x10f0, 0x2002, 0x0a, 0x00, 0x00),
+               .driver_info = DEVTYPE_NEXIO},
+       {USB_DEVICE_AND_INTERFACE_INFO(0x1870, 0x0001, 0x0a, 0x00, 0x00),
+               .driver_info = DEVTYPE_NEXIO},
+#endif
+
        {}
 };
 
@@ -234,8 +246,9 @@ static struct usb_device_id usbtouch_devices[] = {
 static int e2i_init(struct usbtouch_usb *usbtouch)
 {
        int ret;
+       struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
 
-       ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
+       ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
                              0x01, 0x02, 0x0000, 0x0081,
                              NULL, 0, USB_CTRL_SET_TIMEOUT);
 
@@ -344,8 +357,9 @@ static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 static int mtouch_init(struct usbtouch_usb *usbtouch)
 {
        int ret, i;
+       struct usb_device *udev = interface_to_usbdev(usbtouch->interface);
 
-       ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
+       ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
                              MTOUCHUSB_RESET,
                              USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                              1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
@@ -356,7 +370,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch)
        msleep(150);
 
        for (i = 0; i < 3; i++) {
-               ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0),
+               ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
                                      MTOUCHUSB_ASYNC_REPORT,
                                      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                                      1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT);
@@ -489,7 +503,7 @@ static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 
 static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
 {
-       struct usb_device *dev = usbtouch->udev;
+       struct usb_device *dev = interface_to_usbdev(usbtouch->interface);
        int ret = -ENOMEM;
        unsigned char *buf;
 
@@ -689,6 +703,229 @@ static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 }
 #endif
 
+/*****************************************************************************
+ * NEXIO Part
+ */
+#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
+
+#define NEXIO_TIMEOUT  5000
+#define NEXIO_BUFSIZE  1024
+#define NEXIO_THRESHOLD        50
+
+struct nexio_priv {
+       struct urb *ack;
+       unsigned char *ack_buf;
+};
+
+struct nexio_touch_packet {
+       u8      flags;          /* 0xe1 = touch, 0xe1 = release */
+       __be16  data_len;       /* total bytes of touch data */
+       __be16  x_len;          /* bytes for X axis */
+       __be16  y_len;          /* bytes for Y axis */
+       u8      data[];
+} __attribute__ ((packed));
+
+static unsigned char nexio_ack_pkt[2] = { 0xaa, 0x02 };
+static unsigned char nexio_init_pkt[4] = { 0x82, 0x04, 0x0a, 0x0f };
+
+static void nexio_ack_complete(struct urb *urb)
+{
+}
+
+static int nexio_init(struct usbtouch_usb *usbtouch)
+{
+       struct usb_device *dev = interface_to_usbdev(usbtouch->interface);
+       struct usb_host_interface *interface = usbtouch->interface->cur_altsetting;
+       struct nexio_priv *priv;
+       int ret = -ENOMEM;
+       int actual_len, i;
+       unsigned char *buf;
+       char *firmware_ver = NULL, *device_name = NULL;
+       int input_ep = 0, output_ep = 0;
+
+       /* find first input and output endpoint */
+       for (i = 0; i < interface->desc.bNumEndpoints; i++) {
+               if (!input_ep &&
+                   usb_endpoint_dir_in(&interface->endpoint[i].desc))
+                       input_ep = interface->endpoint[i].desc.bEndpointAddress;
+               if (!output_ep &&
+                   usb_endpoint_dir_out(&interface->endpoint[i].desc))
+                       output_ep = interface->endpoint[i].desc.bEndpointAddress;
+       }
+       if (!input_ep || !output_ep)
+               return -ENXIO;
+
+       buf = kmalloc(NEXIO_BUFSIZE, GFP_KERNEL);
+       if (!buf)
+               goto out_buf;
+
+       /* two empty reads */
+       for (i = 0; i < 2; i++) {
+               ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
+                                  buf, NEXIO_BUFSIZE, &actual_len,
+                                  NEXIO_TIMEOUT);
+               if (ret < 0)
+                       goto out_buf;
+       }
+
+       /* send init command */
+       memcpy(buf, nexio_init_pkt, sizeof(nexio_init_pkt));
+       ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, output_ep),
+                          buf, sizeof(nexio_init_pkt), &actual_len,
+                          NEXIO_TIMEOUT);
+       if (ret < 0)
+               goto out_buf;
+
+       /* read replies */
+       for (i = 0; i < 3; i++) {
+               memset(buf, 0, NEXIO_BUFSIZE);
+               ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep),
+                                  buf, NEXIO_BUFSIZE, &actual_len,
+                                  NEXIO_TIMEOUT);
+               if (ret < 0 || actual_len < 1 || buf[1] != actual_len)
+                       continue;
+               switch (buf[0]) {
+               case 0x83:      /* firmware version */
+                       if (!firmware_ver)
+                               firmware_ver = kstrdup(&buf[2], GFP_KERNEL);
+                       break;
+               case 0x84:      /* device name */
+                       if (!device_name)
+                               device_name = kstrdup(&buf[2], GFP_KERNEL);
+                       break;
+               }
+       }
+
+       printk(KERN_INFO "Nexio device: %s, firmware version: %s\n",
+              device_name, firmware_ver);
+
+       kfree(firmware_ver);
+       kfree(device_name);
+
+       /* prepare ACK URB */
+       ret = -ENOMEM;
+
+       usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL);
+       if (!usbtouch->priv)
+               goto out_buf;
+
+       priv = usbtouch->priv;
+
+       priv->ack_buf = kmalloc(sizeof(nexio_ack_pkt), GFP_KERNEL);
+       if (!priv->ack_buf)
+               goto err_priv;
+
+       memcpy(priv->ack_buf, nexio_ack_pkt, sizeof(nexio_ack_pkt));
+
+       priv->ack = usb_alloc_urb(0, GFP_KERNEL);
+       if (!priv->ack) {
+               dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__);
+               goto err_ack_buf;
+       }
+
+       usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep),
+                         priv->ack_buf, sizeof(nexio_ack_pkt),
+                         nexio_ack_complete, usbtouch);
+       ret = 0;
+       goto out_buf;
+
+err_ack_buf:
+       kfree(priv->ack_buf);
+err_priv:
+       kfree(priv);
+out_buf:
+       kfree(buf);
+       return ret;
+}
+
+static void nexio_exit(struct usbtouch_usb *usbtouch)
+{
+       struct nexio_priv *priv = usbtouch->priv;
+
+       usb_kill_urb(priv->ack);
+       usb_free_urb(priv->ack);
+       kfree(priv->ack_buf);
+       kfree(priv);
+}
+
+static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
+{
+       int x, y, begin_x, begin_y, end_x, end_y, w, h, ret;
+       struct nexio_touch_packet *packet = (void *) pkt;
+       struct nexio_priv *priv = usbtouch->priv;
+
+       /* got touch data? */
+       if ((pkt[0] & 0xe0) != 0xe0)
+               return 0;
+
+       /* send ACK */
+       ret = usb_submit_urb(priv->ack, GFP_ATOMIC);
+
+       if (!usbtouch->type->max_xc) {
+               usbtouch->type->max_xc = 2 * be16_to_cpu(packet->x_len);
+               input_set_abs_params(usbtouch->input, ABS_X, 0,
+                                    2 * be16_to_cpu(packet->x_len), 0, 0);
+               usbtouch->type->max_yc = 2 * be16_to_cpu(packet->y_len);
+               input_set_abs_params(usbtouch->input, ABS_Y, 0,
+                                    2 * be16_to_cpu(packet->y_len), 0, 0);
+       }
+       /*
+        * The device reports state of IR sensors on X and Y axes.
+        * Each byte represents "darkness" percentage (0-100) of one element.
+        * 17" touchscreen reports only 64 x 52 bytes so the resolution is low.
+        * This also means that there's a limited multi-touch capability but
+        * it's disabled (and untested) here as there's no X driver for that.
+        */
+       begin_x = end_x = begin_y = end_y = -1;
+       for (x = 0; x < be16_to_cpu(packet->x_len); x++) {
+               if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) {
+                       begin_x = x;
+                       continue;
+               }
+               if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) {
+                       end_x = x - 1;
+                       for (y = be16_to_cpu(packet->x_len);
+                            y < be16_to_cpu(packet->data_len); y++) {
+                               if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) {
+                                       begin_y = y - be16_to_cpu(packet->x_len);
+                                       continue;
+                               }
+                               if (end_y == -1 &&
+                                   begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) {
+                                       end_y = y - 1 - be16_to_cpu(packet->x_len);
+                                       w = end_x - begin_x;
+                                       h = end_y - begin_y;
+#if 0
+                                       /* multi-touch */
+                                       input_report_abs(usbtouch->input,
+                                                   ABS_MT_TOUCH_MAJOR, max(w,h));
+                                       input_report_abs(usbtouch->input,
+                                                   ABS_MT_TOUCH_MINOR, min(x,h));
+                                       input_report_abs(usbtouch->input,
+                                                   ABS_MT_POSITION_X, 2*begin_x+w);
+                                       input_report_abs(usbtouch->input,
+                                                   ABS_MT_POSITION_Y, 2*begin_y+h);
+                                       input_report_abs(usbtouch->input,
+                                                   ABS_MT_ORIENTATION, w > h);
+                                       input_mt_sync(usbtouch->input);
+#endif
+                                       /* single touch */
+                                       usbtouch->x = 2 * begin_x + w;
+                                       usbtouch->y = 2 * begin_y + h;
+                                       usbtouch->touch = packet->flags & 0x01;
+                                       begin_y = end_y = -1;
+                                       return 1;
+                               }
+                       }
+                       begin_x = end_x = -1;
+               }
+
+       }
+       return 0;
+}
+#endif
+
+
 /*****************************************************************************
  * the different device descriptors
  */
@@ -873,6 +1110,16 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
                .read_data      = tc5uh_read_data,
        },
 #endif
+
+#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
+       [DEVTYPE_NEXIO] = {
+               .rept_size      = 128,
+               .irq_always     = true,
+               .read_data      = nexio_read_data,
+               .init           = nexio_init,
+               .exit           = nexio_exit,
+       },
+#endif
 };
 
 
@@ -998,6 +1245,7 @@ static void usbtouch_irq(struct urb *urb)
        case -ECONNRESET:
        case -ENOENT:
        case -ESHUTDOWN:
+       case -EPIPE:
                /* this urb is terminated, clean up */
                dbg("%s - urb shutting down with status: %d",
                    __func__, urb->status);
@@ -1021,7 +1269,7 @@ static int usbtouch_open(struct input_dev *input)
 {
        struct usbtouch_usb *usbtouch = input_get_drvdata(input);
 
-       usbtouch->irq->dev = usbtouch->udev;
+       usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface);
 
        if (!usbtouch->type->irq_always) {
                if (usb_submit_urb(usbtouch->irq, GFP_KERNEL))
@@ -1048,13 +1296,23 @@ static void usbtouch_free_buffers(struct usb_device *udev,
        kfree(usbtouch->buffer);
 }
 
+static struct usb_endpoint_descriptor *
+usbtouch_get_input_endpoint(struct usb_host_interface *interface)
+{
+       int i;
+
+       for (i = 0; i < interface->desc.bNumEndpoints; i++)
+               if (usb_endpoint_dir_in(&interface->endpoint[i].desc))
+                       return &interface->endpoint[i].desc;
+
+       return NULL;
+}
 
 static int usbtouch_probe(struct usb_interface *intf,
                          const struct usb_device_id *id)
 {
        struct usbtouch_usb *usbtouch;
        struct input_dev *input_dev;
-       struct usb_host_interface *interface;
        struct usb_endpoint_descriptor *endpoint;
        struct usb_device *udev = interface_to_usbdev(intf);
        struct usbtouch_device_info *type;
@@ -1064,8 +1322,9 @@ static int usbtouch_probe(struct usb_interface *intf,
        if (id->driver_info == DEVTYPE_IGNORE)
                return -ENODEV;
 
-       interface = intf->cur_altsetting;
-       endpoint = &interface->endpoint[0].desc;
+       endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting);
+       if (!endpoint)
+               return -ENXIO;
 
        usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
        input_dev = input_allocate_device();
@@ -1094,7 +1353,7 @@ static int usbtouch_probe(struct usb_interface *intf,
                goto out_free_buffers;
        }
 
-       usbtouch->udev = udev;
+       usbtouch->interface = intf;
        usbtouch->input = input_dev;
 
        if (udev->manufacturer)
@@ -1133,12 +1392,18 @@ static int usbtouch_probe(struct usb_interface *intf,
                input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press,
                                     type->max_press, 0, 0);
 
-       usb_fill_int_urb(usbtouch->irq, usbtouch->udev,
-                        usb_rcvintpipe(usbtouch->udev, endpoint->bEndpointAddress),
+       if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
+               usb_fill_int_urb(usbtouch->irq, udev,
+                        usb_rcvintpipe(udev, endpoint->bEndpointAddress),
                         usbtouch->data, type->rept_size,
                         usbtouch_irq, usbtouch, endpoint->bInterval);
+       else
+               usb_fill_bulk_urb(usbtouch->irq, udev,
+                        usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
+                        usbtouch->data, type->rept_size,
+                        usbtouch_irq, usbtouch);
 
-       usbtouch->irq->dev = usbtouch->udev;
+       usbtouch->irq->dev = udev;
        usbtouch->irq->transfer_dma = usbtouch->data_dma;
        usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
@@ -1147,23 +1412,37 @@ static int usbtouch_probe(struct usb_interface *intf,
                err = type->init(usbtouch);
                if (err) {
                        dbg("%s - type->init() failed, err: %d", __func__, err);
-                       goto out_free_buffers;
+                       goto out_free_urb;
                }
        }
 
        err = input_register_device(usbtouch->input);
        if (err) {
                dbg("%s - input_register_device failed, err: %d", __func__, err);
-               goto out_free_buffers;
+               goto out_do_exit;
        }
 
        usb_set_intfdata(intf, usbtouch);
 
-       if (usbtouch->type->irq_always)
-               usb_submit_urb(usbtouch->irq, GFP_KERNEL);
+       if (usbtouch->type->irq_always) {
+               err = usb_submit_urb(usbtouch->irq, GFP_KERNEL);
+               if (err) {
+                       err("%s - usb_submit_urb failed with result: %d",
+                           __func__, err);
+                       goto out_unregister_input;
+               }
+       }
 
        return 0;
 
+out_unregister_input:
+       input_unregister_device(input_dev);
+       input_dev = NULL;
+out_do_exit:
+       if (type->exit)
+               type->exit(usbtouch);
+out_free_urb:
+       usb_free_urb(usbtouch->irq);
 out_free_buffers:
        usbtouch_free_buffers(udev, usbtouch);
 out_free:
@@ -1186,6 +1465,8 @@ static void usbtouch_disconnect(struct usb_interface *intf)
        /* this will stop IO via close */
        input_unregister_device(usbtouch->input);
        usb_free_urb(usbtouch->irq);
+       if (usbtouch->type->exit)
+               usbtouch->type->exit(usbtouch);
        usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch);
        kfree(usbtouch);
 }
index eca54dbdf4937386c179d928b22e90a739bbc54c..0488498676436938a7336fcb7eb1b8fa34bbc6fe 100644 (file)
@@ -118,6 +118,9 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
                if (pressure)
                        p = MODR;
 
+               dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n",
+                       x, y, p);
+
                /* are samples valid */
                if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X ||
                    (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y ||
index c721c0a23eb831d20672e16120b3278e8901f428..d30436fee4760f02486e952e9468af375432161c 100644 (file)
@@ -321,7 +321,7 @@ InitWait:
        }
 }
 
-static struct xenbus_device_id xenkbd_ids[] = {
+static const struct xenbus_device_id xenkbd_ids[] = {
        { "vkbd" },
        { "" }
 };
index 3d906833948d23862d468938e9b4d0ffb0233675..fd85bde283a034b7e4612fd7582e3c81d856dfd7 100644 (file)
@@ -171,8 +171,8 @@ config INPUT_ADBHID
          If unsure, say Y.
 
 config MAC_EMUMOUSEBTN
-       bool "Support for mouse button 2+3 emulation"
-       select INPUT
+       tristate "Support for mouse button 2+3 emulation"
+       depends on SYSCTL && INPUT
        help
          This provides generic support for emulating the 2nd and 3rd mouse
          button with keypresses.  If you say Y here, the emulation is still
@@ -184,6 +184,9 @@ config MAC_EMUMOUSEBTN
 
          If you have an Apple machine with a 1-button mouse, say Y here.
 
+         To compile this driver as a module, choose M here: the
+         module will be called mac_hid.
+
 config THERM_WINDTUNNEL
        tristate "Support for thermal management on Windtunnel G4s"
        depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64
index 7b4ef5bb556b9607c78c9d812f2dba8e888de6b4..e943d2a29253d53b60d35c08cfe89e83902508ac 100644 (file)
 #include <linux/sysctl.h>
 #include <linux/input.h>
 #include <linux/module.h>
-#include <linux/kbd_kern.h>
 
+MODULE_LICENSE("GPL");
 
-static struct input_dev *emumousebtn;
-static int emumousebtn_input_register(void);
 static int mouse_emulate_buttons;
 static int mouse_button2_keycode = KEY_RIGHTCTRL;      /* right control key */
 static int mouse_button3_keycode = KEY_RIGHTALT;       /* right option key */
-static int mouse_last_keycode;
 
-#if defined(CONFIG_SYSCTL)
+static struct input_dev *mac_hid_emumouse_dev;
+
+static int mac_hid_create_emumouse(void)
+{
+       static struct lock_class_key mac_hid_emumouse_dev_event_class;
+       static struct lock_class_key mac_hid_emumouse_dev_mutex_class;
+       int err;
+
+       mac_hid_emumouse_dev = input_allocate_device();
+       if (!mac_hid_emumouse_dev)
+               return -ENOMEM;
+
+       lockdep_set_class(&mac_hid_emumouse_dev->event_lock,
+                         &mac_hid_emumouse_dev_event_class);
+       lockdep_set_class(&mac_hid_emumouse_dev->mutex,
+                         &mac_hid_emumouse_dev_mutex_class);
+
+       mac_hid_emumouse_dev->name = "Macintosh mouse button emulation";
+       mac_hid_emumouse_dev->id.bustype = BUS_ADB;
+       mac_hid_emumouse_dev->id.vendor = 0x0001;
+       mac_hid_emumouse_dev->id.product = 0x0001;
+       mac_hid_emumouse_dev->id.version = 0x0100;
+
+       mac_hid_emumouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
+       mac_hid_emumouse_dev->keybit[BIT_WORD(BTN_MOUSE)] =
+               BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
+       mac_hid_emumouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
+
+       err = input_register_device(mac_hid_emumouse_dev);
+       if (err) {
+               input_free_device(mac_hid_emumouse_dev);
+               mac_hid_emumouse_dev = NULL;
+               return err;
+       }
+
+       return 0;
+}
+
+static void mac_hid_destroy_emumouse(void)
+{
+       input_unregister_device(mac_hid_emumouse_dev);
+       mac_hid_emumouse_dev = NULL;
+}
+
+static bool mac_hid_emumouse_filter(struct input_handle *handle,
+                                   unsigned int type, unsigned int code,
+                                   int value)
+{
+       unsigned int btn;
+
+       if (type != EV_KEY)
+               return false;
+
+       if (code == mouse_button2_keycode)
+               btn = BTN_MIDDLE;
+       else if (code == mouse_button3_keycode)
+               btn = BTN_RIGHT;
+       else
+               return false;
+
+       input_report_key(mac_hid_emumouse_dev, btn, value);
+       input_sync(mac_hid_emumouse_dev);
+
+       return true;
+}
+
+static int mac_hid_emumouse_connect(struct input_handler *handler,
+                                   struct input_dev *dev,
+                                   const struct input_device_id *id)
+{
+       struct input_handle *handle;
+       int error;
+
+       /* Don't bind to ourselves */
+       if (dev == mac_hid_emumouse_dev)
+               return -ENODEV;
+
+       handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
+       if (!handle)
+               return -ENOMEM;
+
+       handle->dev = dev;
+       handle->handler = handler;
+       handle->name = "mac-button-emul";
+
+       error = input_register_handle(handle);
+       if (error) {
+               printk(KERN_ERR
+                       "mac_hid: Failed to register button emulation handle, "
+                       "error %d\n", error);
+               goto err_free;
+       }
+
+       error = input_open_device(handle);
+       if (error) {
+               printk(KERN_ERR
+                       "mac_hid: Failed to open input device, error %d\n",
+                       error);
+               goto err_unregister;
+       }
+
+       return 0;
+
+ err_unregister:
+       input_unregister_handle(handle);
+ err_free:
+       kfree(handle);
+       return error;
+}
+
+static void mac_hid_emumouse_disconnect(struct input_handle *handle)
+{
+       input_close_device(handle);
+       input_unregister_handle(handle);
+       kfree(handle);
+}
+
+static const struct input_device_id mac_hid_emumouse_ids[] = {
+       {
+               .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
+               .evbit = { BIT_MASK(EV_KEY) },
+       },
+       { },
+};
+
+MODULE_DEVICE_TABLE(input, mac_hid_emumouse_ids);
+
+static struct input_handler mac_hid_emumouse_handler = {
+       .filter         = mac_hid_emumouse_filter,
+       .connect        = mac_hid_emumouse_connect,
+       .disconnect     = mac_hid_emumouse_disconnect,
+       .name           = "mac-button-emul",
+       .id_table       = mac_hid_emumouse_ids,
+};
+
+static int mac_hid_start_emulation(void)
+{
+       int err;
+
+       err = mac_hid_create_emumouse();
+       if (err)
+               return err;
+
+       err = input_register_handler(&mac_hid_emumouse_handler);
+       if (err) {
+               mac_hid_destroy_emumouse();
+               return err;
+       }
+
+       return 0;
+}
+
+static void mac_hid_stop_emulation(void)
+{
+       input_unregister_handler(&mac_hid_emumouse_handler);
+       mac_hid_destroy_emumouse();
+}
+
+static int mac_hid_toggle_emumouse(ctl_table *table, int write,
+                                  void __user *buffer, size_t *lenp,
+                                  loff_t *ppos)
+{
+       int *valp = table->data;
+       int old_val = *valp;
+       int rc;
+
+       rc = proc_dointvec(table, write, buffer, lenp, ppos);
+
+       if (rc == 0 && write && *valp != old_val) {
+               if (*valp == 1)
+                       rc = mac_hid_start_emulation();
+               else if (*valp == 0)
+                       mac_hid_stop_emulation();
+               else
+                       rc = -EINVAL;
+       }
+
+       /* Restore the old value in case of error */
+       if (rc)
+               *valp = old_val;
+
+       return rc;
+}
+
 /* file(s) in /proc/sys/dev/mac_hid */
 static ctl_table mac_hid_files[] = {
        {
@@ -31,7 +211,7 @@ static ctl_table mac_hid_files[] = {
                .data           = &mouse_emulate_buttons,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = mac_hid_toggle_emumouse,
        },
        {
                .procname       = "mouse_button2_keycode",
@@ -74,75 +254,21 @@ static ctl_table mac_hid_root_dir[] = {
 
 static struct ctl_table_header *mac_hid_sysctl_header;
 
-#endif /* endif CONFIG_SYSCTL */
-
-int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
-{
-       switch (caller) {
-       case 1:
-               /* Called from keyboard.c */
-               if (mouse_emulate_buttons
-                   && (keycode == mouse_button2_keycode
-                       || keycode == mouse_button3_keycode)) {
-                       if (mouse_emulate_buttons == 1) {
-                               input_report_key(emumousebtn,
-                                                keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT,
-                                                down);
-                               input_sync(emumousebtn);
-                               return 1;
-                       }
-                       mouse_last_keycode = down ? keycode : 0;
-               }
-               break;
-       }
-       return 0;
-}
-
-static struct lock_class_key emumousebtn_event_class;
-static struct lock_class_key emumousebtn_mutex_class;
-
-static int emumousebtn_input_register(void)
+static int __init mac_hid_init(void)
 {
-       int ret;
-
-       emumousebtn = input_allocate_device();
-       if (!emumousebtn)
+       mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir);
+       if (!mac_hid_sysctl_header)
                return -ENOMEM;
 
-       lockdep_set_class(&emumousebtn->event_lock, &emumousebtn_event_class);
-       lockdep_set_class(&emumousebtn->mutex, &emumousebtn_mutex_class);
-
-       emumousebtn->name = "Macintosh mouse button emulation";
-       emumousebtn->id.bustype = BUS_ADB;
-       emumousebtn->id.vendor = 0x0001;
-       emumousebtn->id.product = 0x0001;
-       emumousebtn->id.version = 0x0100;
-
-       emumousebtn->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
-       emumousebtn->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
-               BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
-       emumousebtn->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
-
-       ret = input_register_device(emumousebtn);
-       if (ret)
-               input_free_device(emumousebtn);
-
-       return ret;
+       return 0;
 }
+module_init(mac_hid_init);
 
-static int __init mac_hid_init(void)
+static void __exit mac_hid_exit(void)
 {
-       int err;
-
-       err = emumousebtn_input_register();
-       if (err)
-               return err;
-
-#if defined(CONFIG_SYSCTL)
-       mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir);
-#endif /* CONFIG_SYSCTL */
+       unregister_sysctl_table(mac_hid_sysctl_header);
 
-       return 0;
+       if (mouse_emulate_buttons)
+               mac_hid_stop_emulation();
 }
-
-device_initcall(mac_hid_init);
+module_exit(mac_hid_exit);
index c0c73913833df3f401499ac2ec6f867ce388404f..2e7a3bf13824945ac18ff54187146585e03d31f6 100644 (file)
@@ -354,7 +354,7 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = {
 static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
 {
        struct pci_dev * pci_dev;
-       acpi_integer    addr;
+       u64     addr;
 
        pci_dev = to_pci_dev(dev);
        /* Please ref to ACPI spec for the syntax of _ADR */
index a350418e87ea18cf2f5812df7191cbed2d535e82..944068611919394eaa42c6337e96b2e1e02b9fee 100644 (file)
@@ -57,7 +57,7 @@ static struct acpi_driver toshiba_bt_rfkill_driver = {
 static int toshiba_bluetooth_enable(acpi_handle handle)
 {
        acpi_status res1, res2;
-       acpi_integer result;
+       u64 result;
 
        /*
         * Query ACPI to verify RFKill switch is set to 'on'.
@@ -95,7 +95,7 @@ static int toshiba_bt_resume(struct acpi_device *device)
 static int toshiba_bt_rfkill_add(struct acpi_device *device)
 {
        acpi_status status;
-       acpi_integer bt_present;
+       u64 bt_present;
        int result = -ENODEV;
 
        /*
index b104302fea0a1e9dbc4a91f82290a185ad244e00..09e9918c69c145820f92e19fc2fc76947c7321bc 100644 (file)
@@ -796,7 +796,7 @@ static __init acpi_status parse_wdg(acpi_handle handle)
  */
 static acpi_status
 acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
-                     u32 bits, acpi_integer * value,
+                     u32 bits, u64 *value,
                      void *handler_context, void *region_context)
 {
        int result = 0, i = 0;
@@ -813,7 +813,7 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
 
        if (function == ACPI_READ) {
                result = ec_read(address, &temp);
-               (*value) |= ((acpi_integer)temp) << i;
+               (*value) |= ((u64)temp) << i;
        } else {
                temp = 0xff & ((*value) >> i);
                result = ec_write(address, temp);
index 473d584b1d315cf962d42a92c68cf7ebbd74d8ee..5b2e5e80ecb07bb211ec3e13a607ef37dbd8323c 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index c1343a9265fad6291b28ba34a5c4bb897a25b56e..9cf736ea4691b6c0ac206789f30f73f3ab6dd3ac 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index d814da4b5365dbcd0ccb5cc978b775c8ad27ab6c..d7726685797e76649bcaf5a9aa03010f33b99e4c 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 472b7bf0c5d4ebe9161d7f4d099169fe615f00b8..a091cabca4b1266f1c3cbdaac7d44f2a4c81be4c 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 54508ccea023f563c840639915c22c981e7cfe76..7bf83ddf82e03278c27d54cc9f20dd5360fbe31d 100644 (file)
@@ -252,8 +252,8 @@ struct acpi_device_wakeup_state {
 
 struct acpi_device_wakeup {
        acpi_handle gpe_device;
-       acpi_integer gpe_number;
-       acpi_integer sleep_state;
+       u64 gpe_number;
+       u64 sleep_state;
        struct acpi_handle_list resources;
        struct acpi_device_wakeup_state state;
        struct acpi_device_wakeup_flags flags;
@@ -383,7 +383,7 @@ struct acpi_pci_root {
 };
 
 /* helper */
-acpi_handle acpi_get_child(acpi_handle, acpi_integer);
+acpi_handle acpi_get_child(acpi_handle, u64);
 int acpi_is_root_bridge(acpi_handle);
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
index eb0e7189075f374d7f4370fb40d9fcf28e0c6510..b396854b83b06c9ec60b7b34a444eb75f95c0c9c 100644 (file)
@@ -8,7 +8,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -196,7 +196,7 @@ acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
 
 void acpi_os_wait_events_complete(void *context);
 
-void acpi_os_sleep(acpi_integer milliseconds);
+void acpi_os_sleep(u64 milliseconds);
 
 void acpi_os_stall(u32 microseconds);
 
@@ -227,7 +227,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
 
 acpi_status
 acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
-                               u32 reg, acpi_integer value, u32 width);
+                               u32 reg, u64 value, u32 width);
 
 /*
  * Interim function needed for PCI IRQ routing
index 3988f93b9c66fcdfe542d57e4e3da08624458a29..4447a0461bae44050c73e8d017cb63e06455d266 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20091214
+#define ACPI_CA_VERSION                 0x20100121
 
 #include "actypes.h"
 #include "actbl.h"
index 9ffe00feada62ef7b91aa357849182bc7b66060a..e5526354ba5eab0142eb58159fa862e18d11cd13 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -397,7 +397,7 @@ struct acpi_resource {
 struct acpi_pci_routing_table {
        u32 length;
        u32 pin;
-       acpi_integer address;   /* here for 64-bit alignment */
+       u64 address;            /* here for 64-bit alignment */
        u32 source_index;
        char source[4];         /* pad to 64 bits so sizeof() works in all cases */
 };
index 1b658795260447b775eea26d2ac81e4730dfe16f..ad2001683ba7385d50c875eda327c4ac41894c48 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 0b9b430b092bea5e5b96fe478905e57bb890a48c..c637b75b9f3f542a61cfd2d6b3ddef1485691e5b 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 6f3dce9991e1ec18a75d0cafe74e272c8d12992a..5b02e307bff388a8c4b07f85d44f60a2ca4174bf 100644 (file)
@@ -1,3 +1,46 @@
+/******************************************************************************
+ *
+ * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2010, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
 #ifndef __ACTBL2_H__
 #define __ACTBL2_H__
 
index 73af408633719733fe1c405b0cc895df3bb2e819..3f08e64962f872838ccc14ee635426fe9517f46d 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -385,19 +385,6 @@ union uint64_overlay {
        struct uint64_struct part;
 };
 
-struct uint32_struct {
-       u32 lo;
-       u32 hi;
-};
-
-/*
- * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
- * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
- * type only, not other integers used in the implementation of the ACPI CA
- * subsystem.
- */
-typedef unsigned long long acpi_integer;
-#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
 #define ACPI_INTEGER_BIT_SIZE           64
 #define ACPI_MAX_DECIMAL_DIGITS         20     /* 2^64 = 18,446,744,073,709,551,616 */
 
@@ -421,6 +408,19 @@ typedef unsigned long long acpi_integer;
 #define ACPI_WAIT_FOREVER               0xFFFF /* u16, as per ACPI spec */
 #define ACPI_DO_NOT_WAIT                0
 
+/*
+ * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits.
+ * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this
+ * pertains to the ACPI integer type only, not to other integers used in the
+ * implementation of the ACPICA subsystem.
+ *
+ * 01/2010: This type is obsolete and has been removed from the entire ACPICA
+ * code base. It remains here for compatibility with device drivers that use
+ * the type. However, it will be removed in the future.
+ */
+typedef u64 acpi_integer;
+#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
+
 /*******************************************************************************
  *
  * Commonly used macros
@@ -793,7 +793,7 @@ union acpi_object {
        acpi_object_type type;  /* See definition of acpi_ns_type for values */
        struct {
                acpi_object_type type;  /* ACPI_TYPE_INTEGER */
-               acpi_integer value;     /* The actual number */
+               u64 value;      /* The actual number */
        } integer;
 
        struct {
@@ -937,7 +937,7 @@ typedef
 acpi_status(*acpi_adr_space_handler) (u32 function,
                                      acpi_physical_address address,
                                      u32 bit_width,
-                                     acpi_integer * value,
+                                     u64 *value,
                                      void *handler_context,
                                      void *region_context);
 
@@ -997,7 +997,7 @@ struct acpi_device_info {
        u8 highest_dstates[4];  /* _sx_d values: 0xFF indicates not valid */
        u8 lowest_dstates[5];   /* _sx_w values: 0xFF indicates not valid */
        u32 current_status;     /* _STA value */
-       acpi_integer address;   /* _ADR value */
+       u64 address;    /* _ADR value */
        struct acpica_device_id hardware_id;    /* _HID value */
        struct acpica_device_id unique_id;      /* _UID value */
        struct acpica_device_id_list compatible_id_list;        /* _CID list <must be last> */
index e62f10d9a7d844e680a265d1f45b547fb00bacfc..c05aeba9e8f0e42a3441a66c75b02b0a973a046d 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -311,8 +311,8 @@ typedef char *va_list;
 #define ACPI_MEMCMP(s1,s2,n)    acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
 #define ACPI_MEMCPY(d,s,n)      (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,v,n)      (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
-#define ACPI_TOUPPER            acpi_ut_to_upper
-#define ACPI_TOLOWER            acpi_ut_to_lower
+#define ACPI_TOUPPER(c)         acpi_ut_to_upper ((int) (c))
+#define ACPI_TOLOWER(c)         acpi_ut_to_lower ((int) (c))
 
 #endif                         /* ACPI_USE_SYSTEM_CLIBRARY */
 
index 6aadbf84ae71c014acf2d1a091756a0a83bd8e73..0cd53e3cd1a37789bb54edf99ec843df82c3b025 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2008, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 09469971472fb5587207d5f1517342e479c5abb2..e5039a2856f852b4a17d0729dd652422ed47c428 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2009, Intel Corp.
+ * Copyright (C) 2000 - 2010, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 0ea5ef4eb6a94aaaa593003d0138ce1381f13e89..29831768c0e6ef3ac76b564b5bcf82b8f842c7d5 100644 (file)
@@ -92,11 +92,11 @@ struct acpi_processor_power {
 /* Performance Management */
 
 struct acpi_psd_package {
-       acpi_integer num_entries;
-       acpi_integer revision;
-       acpi_integer domain;
-       acpi_integer coord_type;
-       acpi_integer num_processors;
+       u64 num_entries;
+       u64 revision;
+       u64 domain;
+       u64 coord_type;
+       u64 num_processors;
 } __attribute__ ((packed));
 
 struct acpi_pct_register {
@@ -110,12 +110,12 @@ struct acpi_pct_register {
 } __attribute__ ((packed));
 
 struct acpi_processor_px {
-       acpi_integer core_frequency;    /* megahertz */
-       acpi_integer power;     /* milliWatts */
-       acpi_integer transition_latency;        /* microseconds */
-       acpi_integer bus_master_latency;        /* microseconds */
-       acpi_integer control;   /* control value */
-       acpi_integer status;    /* success indicator */
+       u64 core_frequency;     /* megahertz */
+       u64 power;      /* milliWatts */
+       u64 transition_latency; /* microseconds */
+       u64 bus_master_latency; /* microseconds */
+       u64 control;    /* control value */
+       u64 status;     /* success indicator */
 };
 
 struct acpi_processor_performance {
@@ -133,11 +133,11 @@ struct acpi_processor_performance {
 /* Throttling Control */
 
 struct acpi_tsd_package {
-       acpi_integer num_entries;
-       acpi_integer revision;
-       acpi_integer domain;
-       acpi_integer coord_type;
-       acpi_integer num_processors;
+       u64 num_entries;
+       u64 revision;
+       u64 domain;
+       u64 coord_type;
+       u64 num_processors;
 } __attribute__ ((packed));
 
 struct acpi_ptc_register {
@@ -151,11 +151,11 @@ struct acpi_ptc_register {
 } __attribute__ ((packed));
 
 struct acpi_processor_tx_tss {
-       acpi_integer freqpercentage;    /* */
-       acpi_integer power;     /* milliWatts */
-       acpi_integer transition_latency;        /* microseconds */
-       acpi_integer control;   /* control value */
-       acpi_integer status;    /* success indicator */
+       u64 freqpercentage;     /* */
+       u64 power;      /* milliWatts */
+       u64 transition_latency; /* microseconds */
+       u64 control;    /* control value */
+       u64 status;     /* success indicator */
 };
 struct acpi_processor_tx {
        u16 power;
index 1bc08541c2b9cff63e3ae58267244321034edb5b..48e68da097f6f50000b80e8dd10a82581233179b 100644 (file)
@@ -46,7 +46,6 @@ struct gameport {
        struct mutex drv_mutex;         /* protects serio->drv so attributes can pin driver */
 
        struct device dev;
-       unsigned int registered;        /* port has been fully registered with driver core */
 
        struct list_head node;
 };
index 1289fa7623ca22d7d79188bc39cf5b5b35c180b1..cd0b3f30f48ed1bc8294ac759bf7965b3efce851 100644 (file)
@@ -10,6 +10,7 @@ struct gpio_keys_button {
        int type;               /* input event type (EV_KEY, EV_SW) */
        int wakeup;             /* configure the button as a wake-up source */
        int debounce_interval;  /* debounce ticks interval in msecs */
+       bool can_disable;
 };
 
 struct gpio_keys_platform_data {
index f44ee9114401777eb5f0628a03fa074084a23ca9..dc24effb6d0e71816d33d6501304aca44c879a86 100644 (file)
@@ -378,7 +378,7 @@ struct input_absinfo {
 #define KEY_WIMAX              246
 #define KEY_RFKILL             247     /* Key that controls all radios */
 
-/* Range 248 - 255 is reserved for special needs of AT keyboard driver */
+/* Code 255 is reserved for special needs of AT keyboard driver */
 
 #define BTN_MISC               0x100
 #define BTN_0                  0x100
@@ -597,6 +597,7 @@ struct input_absinfo {
 #define KEY_NUMERIC_POUND      0x20b
 
 #define KEY_CAMERA_FOCUS       0x210
+#define KEY_WPS_BUTTON         0x211   /* WiFi Protected Setup key */
 
 #define BTN_TRIGGER_HAPPY              0x2c0
 #define BTN_TRIGGER_HAPPY1             0x2c0
@@ -1242,6 +1243,10 @@ struct input_handle;
  * @event: event handler. This method is being called by input core with
  *     interrupts disabled and dev->event_lock spinlock held and so
  *     it may not sleep
+ * @filter: similar to @event; separates normal event handlers from
+ *     "filters".
+ * @match: called after comparing device's id with handler's id_table
+ *     to perform fine-grained matching between device and handler
  * @connect: called when attaching a handler to an input device
  * @disconnect: disconnects a handler from input device
  * @start: starts handler for given handle. This function is called by
@@ -1253,8 +1258,6 @@ struct input_handle;
  * @name: name of the handler, to be shown in /proc/bus/input/handlers
  * @id_table: pointer to a table of input_device_ids this driver can
  *     handle
- * @blacklist: pointer to a table of input_device_ids this driver should
- *     ignore even if they match @id_table
  * @h_list: list of input handles associated with the handler
  * @node: for placing the driver onto input_handler_list
  *
@@ -1263,6 +1266,11 @@ struct input_handle;
  * same time. All of them will get their copy of input event generated by
  * the device.
  *
+ * The very same structure is used to implement input filters. Input core
+ * allows filters to run first and will not pass event to regular handlers
+ * if any of the filters indicate that the event should be filtered (by
+ * returning %true from their filter() method).
+ *
  * Note that input core serializes calls to connect() and disconnect()
  * methods.
  */
@@ -1271,6 +1279,8 @@ struct input_handler {
        void *private;
 
        void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
+       bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
+       bool (*match)(struct input_handler *handler, struct input_dev *dev);
        int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
        void (*disconnect)(struct input_handle *handle);
        void (*start)(struct input_handle *handle);
@@ -1280,7 +1290,6 @@ struct input_handler {
        const char *name;
 
        const struct input_device_id *id_table;
-       const struct input_device_id *blacklist;
 
        struct list_head        h_list;
        struct list_head        node;
index c211b5cf08e673890f91ef6a3f18ff371a40d5f6..649dc7f12925d0ac7a9152e7e9f7e79b269b3ec6 100644 (file)
@@ -1,14 +1,15 @@
 #ifndef __SH_KEYSC_H__
 #define __SH_KEYSC_H__
 
-#define SH_KEYSC_MAXKEYS 30
+#define SH_KEYSC_MAXKEYS 49
 
 struct sh_keysc_info {
-       enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
+       enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3,
+              SH_KEYSC_MODE_4, SH_KEYSC_MODE_5, SH_KEYSC_MODE_6 } mode;
        int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
        int delay;
        int kycr2_delay;
-       int keycodes[SH_KEYSC_MAXKEYS];
+       int keycodes[SH_KEYSC_MAXKEYS]; /* KEYIN * KEYOUT */
 };
 
 #endif /* __SH_KEYSC_H__ */
index 8bdb16bfe5fb698eb2d8e0a0fe8c6785434e53d0..506ad20c18f8736b355530cc01fa91ca149fe322 100644 (file)
@@ -161,7 +161,4 @@ static inline void con_schedule_flip(struct tty_struct *t)
        schedule_delayed_work(&t->buf.work, 0);
 }
 
-/* mac_hid.c */
-extern int mac_hid_mouse_emulate_buttons(int, unsigned int, int);
-
 #endif
index 813d26c247ece48b709a14a427f655a2c04442fc..64b473066b9aa49760d67c2d45eb695cbf0d812e 100644 (file)
@@ -30,7 +30,6 @@ struct serio {
        char phys[32];
 
        bool manual_bind;
-       bool registered;        /* port has been fully registered with driver core */
 
        struct serio_device_id id;