]> zub.fei.tuke.sk Git - walkera0701-joystick/commitdiff
reorganized to match version in "Dmitry Torokhov's input tree" master stable1.0-rc4
authorPeter Popovec <popovec@fei.tuke.sk>
Mon, 1 Dec 2008 12:31:20 +0000 (13:31 +0100)
committerPeter Popovec <popovec@fei.tuke.sk>
Mon, 1 Dec 2008 12:31:20 +0000 (13:31 +0100)
Documentation/input/walkera0701.txt [moved from walkera0701.txt with 76% similarity]
Kconfig.diff [deleted file]
Makefile [deleted file]
Makefile.diff [deleted file]
drivers/input/joystick/Kconfig [new file with mode: 0644]
drivers/input/joystick/Makefile [new file with mode: 0644]
drivers/input/joystick/walkera0701.c [moved from walkera0701.c with 87% similarity]

similarity index 76%
rename from walkera0701.txt
rename to Documentation/input/walkera0701.txt
index da8a8705394e295913e36a351b48505db4be39a0..8f4289efc5c44965138d8184674f86421e07712a 100644 (file)
@@ -1,4 +1,3 @@
-Copyright (c) 2008 Peter Popovec <popovec@fei.tuke.sk>
 
 Walkera WK-0701 transmitter is supplied with a ready to fly Walkera
 helicopters such as HM36, HM37, HM60. The walkera0701 module enables to use
@@ -7,8 +6,8 @@ this transmitter as joystick
 Devel homepage and download:
 http://zub.fei.tuke.sk/walkera-wk0701/
 
-or use git:
-git-clone http://zub.fei.tuke.sk/GIT/walkera0701-joystick 
+or use cogito:
+cg-clone http://zub.fei.tuke.sk/GIT/walkera0701-joystick
 
 
 Connecting to PC:
@@ -16,23 +15,23 @@ Connecting to PC:
 At back side of transmitter S-video connector can be found. Modulation
 pulses from processor to HF part can be found at pin 2 of this connector,
 pin 3 is GND. Between pin 3 and CPU 5k6 resistor can be found. To get
-modulation pulses to PC, signal pulses must be amplified. 
+modulation pulses to PC, signal pulses must be amplified.
 
 Cable: (walkera TX to parport)
 
 Walkera WK-0701 TX S-VIDEO connector:
- (back side of TX) 
+ (back side of TX)
      __   __              S-video:                                  canon25
     /  |_|  \             pin 2 (signal)              NPN           parport
    / O 4 3 O \            pin 3 (GND)        LED        ________________  10 ACK
   ( O 2   1 O )                                         | C
    \   ___   /      2 ________________________|\|_____|/
-    | [___] |                                 |/|   B |\ 
+    | [___] |                                 |/|   B |\
      -------        3 __________________________________|________________ 25 GND
                                                           E
 
 
-I use green LED and BC109 NPN transistor. 
+I use green LED and BC109 NPN transistor.
 
 Software:
 
@@ -47,26 +46,9 @@ be changed by TX "joystick", check output from /proc/interrupts. Value for
 
 Technical details:
 
-Walkera TX sends 8 channels, for MODE 2 TX: 
+Driver use interrupt from parport ACK input bit to measure pulse length
+using hrtimers.
 
-right joystick:
-       vertical = channel 1
-       horizontal = channel 2
-left joystick:
-       vertical = channel 3
-       horizontal = channel 4
-
-GEAR switch is sent over channel 5. Left joystick vertical is sent over
-channel 6 by internal TX mixer. GYRO sensitivity is sent over channel 7
-(check DIP 12 on back side of TX for manual adjustment of this channel).
-Channel 8 cannot be directly controlled by TX, default value is 314 in this
-channel.
-
-
-
-Driver uses interrupt from parport ACK input bit to measure pulse length
-using hrtimers.  
 Frame format:
 Based on walkera WK-0701 PCM Format description by Shaul Eizikovich.
 (downloaded from http://www.smartpropoplus.com/Docs/Walkera_Wk-0701_PCM.pdf)
@@ -74,19 +56,19 @@ Based on walkera WK-0701 PCM Format description by Shaul Eizikovich.
 Signal pulses:
                    (ANALOG)
     SYNC      BIN   OCT
-  +---------+      +------+   
+  +---------+      +------+
   |         |      |      |
 --+         +------+      +---
 
-Frame: 
- SYNC , BIN1, OCT1, BIN2, OCT2 ... BIN24, OCT24, BIN25, next frame SYNC .. 
+Frame:
+ SYNC , BIN1, OCT1, BIN2, OCT2 ... BIN24, OCT24, BIN25, next frame SYNC ..
 
 pulse length:
    Binary values:              Analog octal values:
 
    288 uS Binary 0             318 uS       000
    438 uS Binary 1             398 uS       001
-                               478 uS       010
+                               478 uS       010
                                558 uS       011
                                638 uS       100
   1306 uS SYNC                 718 uS       101
@@ -96,12 +78,12 @@ pulse length:
 24 bin+oct values + 1 bin value = 24*4+1 bits  = 97 bits
 
 (Warning, pulses on ACK ar inverted by transistor, irq is rised up on sync
-to bin change or octal value to bin change). 
+to bin change or octal value to bin change).
 
 Binary data representations:
 
 One binary and octal value can be grouped to nibble. 24 nibbles + one binary
-values can be sampled between sync pulses. 
+values can be sampled between sync pulses.
 
 Values for first four channels (analog joystick values) can be found in
 first 10 nibbles. Analog value is represented by one sign bit and 9 bit
diff --git a/Kconfig.diff b/Kconfig.diff
deleted file mode 100644 (file)
index d575714..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- linux-2.6.27.1.orig/drivers/input/joystick/Kconfig 2008-10-16 01:02:53.000000000 +0200
-+++ linux-2.6.27.1/drivers/input/joystick/Kconfig      2008-10-17 10:11:30.000000000 +0200
-@@ -294,4 +294,16 @@
-         This option enables support for the LED which surrounds the Big X on
-         XBox 360 controller.
-+config JOYSTICK_WALKERA0701
-+      tristate "Walkera WK-0701 RC transmitter"
-+      depends on HIGH_RES_TIMERS && PARPORT
-+      help
-+        Say Y or M here if you have a Walkera WK-0701 transmitter which is
-+        supplied with a ready to fly Walkera helicopters such as HM36,
-+        HM37, HM60 and want to use it via parport as a joystick. More
-+        information is available: <file:Documentation/input/walkera0701.txt>
-+
-+        To compile this driver as a module, choose M here: the
-+        module will be called walkera0701.
-+
- endif
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index aaf4f67..0000000
--- a/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-
-walkera0701.ko:        modules
-
-modules:  walkera0701.c
-       rm -f *.o
-       rm -f *.ko
-       make -C /usr/src/linux-`uname -r` SUBDIRS=`pwd` modules
-       strip --strip-unneeded walkera0701.ko
-       
-obj-m += walkera0701.o 
-
-clean:
-       rm -f *.ko
-       rm -f *.o
-       rm -f *.mod.c
-       rm -f *~
-       rm -f .*.cmd
-       rm -rf .tmp_versions
-       rm -f modules.order
-       rm -f Module.symvers
-
-indent:        
-       indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs  walkera0701.c
-
-rmmod:
-       rmmod -f walkera0701
-
-insmod:        walkera0701.ko
-       insmod walkera0701.ko
-       
-kernel-patch:
-       cp walkera0701.c /usr/src/linux-`uname -r`/drivers/input/joystick/
-       cp walkera0701.txt /usr/src/linux-`uname -r`/Documentation/input/
-       patch /usr/src/linux-`uname -r`/drivers/input/joystick/Kconfig Kconfig.diff
-       patch /usr/src/linux-`uname -r`/drivers/input/joystick/Makefile Makefile.diff
diff --git a/Makefile.diff b/Makefile.diff
deleted file mode 100644 (file)
index b33aca8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- linux-2.6.27.1.orig/drivers/input/joystick/Makefile        2008-10-16 01:02:53.000000000 +0200
-+++ linux-2.6.27.1/drivers/input/joystick/Makefile     2008-10-17 10:04:23.000000000 +0200
-@@ -29,4 +29,5 @@
- obj-$(CONFIG_JOYSTICK_WARRIOR)                += warrior.o
- obj-$(CONFIG_JOYSTICK_XPAD)           += xpad.o
- obj-$(CONFIG_JOYSTICK_ZHENHUA)                += zhenhua.o
-+obj-$(CONFIG_JOYSTICK_WALKERA0701)    += walkera0701.o
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
new file mode 100644 (file)
index 0000000..268dd3f
--- /dev/null
@@ -0,0 +1,309 @@
+#
+# Joystick driver configuration
+#
+menuconfig INPUT_JOYSTICK
+       bool "Joysticks/Gamepads"
+       help
+         If you have a joystick, 6dof controller, gamepad, steering wheel,
+         weapon control system or something like that you can say Y here
+         and the list of supported devices will be displayed. This option
+         doesn't affect the kernel.
+
+         Please read the file <file:Documentation/input/joystick.txt> which
+         contains more information.
+
+if INPUT_JOYSTICK
+
+config JOYSTICK_ANALOG
+       tristate "Classic PC analog joysticks and gamepads"
+       select GAMEPORT
+       ---help---
+         Say Y here if you have a joystick that connects to the PC
+         gameport. In addition to the usual PC analog joystick, this driver
+         supports many extensions, including joysticks with throttle control,
+         with rudders, additional hats and buttons compatible with CH
+         Flightstick Pro, ThrustMaster FCS, 6 and 8 button gamepads, or
+         Saitek Cyborg joysticks.
+
+         Please read the file <file:Documentation/input/joystick.txt> which
+         contains more information.
+
+         To compile this driver as a module, choose M here: the
+         module will be called analog.
+
+config JOYSTICK_A3D
+       tristate "Assassin 3D and MadCatz Panther devices"
+       select GAMEPORT
+       help
+         Say Y here if you have an FPGaming or MadCatz controller using the
+         A3D protocol over the PC gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called a3d.
+
+config JOYSTICK_ADI
+       tristate "Logitech ADI digital joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have a Logitech controller using the ADI
+         protocol over the PC gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called adi.
+
+config JOYSTICK_COBRA
+       tristate "Creative Labs Blaster Cobra gamepad"
+       select GAMEPORT
+       help
+         Say Y here if you have a Creative Labs Blaster Cobra gamepad.
+
+         To compile this driver as a module, choose M here: the
+         module will be called cobra.
+
+config JOYSTICK_GF2K
+       tristate "Genius Flight2000 Digital joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have a Genius Flight2000 or MaxFighter digitally
+         communicating joystick or gamepad.
+
+         To compile this driver as a module, choose M here: the
+         module will be called gf2k.
+
+config JOYSTICK_GRIP
+       tristate "Gravis GrIP joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have a Gravis controller using the GrIP protocol
+         over the PC gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called grip.
+
+config JOYSTICK_GRIP_MP
+       tristate "Gravis GrIP MultiPort"
+       select GAMEPORT
+       help
+         Say Y here if you have the original Gravis GrIP MultiPort, a hub
+         that connects to the gameport and you connect gamepads to it.
+
+         To compile this driver as a module, choose M here: the
+         module will be called grip_mp.
+
+config JOYSTICK_GUILLEMOT
+       tristate "Guillemot joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have a Guillemot joystick using a digital
+         protocol over the PC gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called guillemot.
+
+config JOYSTICK_INTERACT
+       tristate "InterAct digital joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have an InterAct gameport or joystick
+         communicating digitally over the gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called interact.
+
+config JOYSTICK_SIDEWINDER
+       tristate "Microsoft SideWinder digital joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have a Microsoft controller using the Digital
+         Overdrive protocol over PC gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called sidewinder.
+
+config JOYSTICK_TMDC
+       tristate "ThrustMaster DirectConnect joysticks and gamepads"
+       select GAMEPORT
+       help
+         Say Y here if you have a ThrustMaster controller using the
+         DirectConnect (BSP) protocol over the PC gameport.
+
+         To compile this driver as a module, choose M here: the
+         module will be called tmdc.
+
+source "drivers/input/joystick/iforce/Kconfig"
+
+config JOYSTICK_WARRIOR
+       tristate "Logitech WingMan Warrior joystick"
+       select SERIO
+       help
+         Say Y here if you have a Logitech WingMan Warrior joystick connected
+         to your computer's serial port.
+
+         To compile this driver as a module, choose M here: the
+         module will be called warrior.
+
+config JOYSTICK_MAGELLAN
+       tristate "LogiCad3d Magellan/SpaceMouse 6dof controllers"
+       select SERIO
+       help
+         Say Y here if you have a Magellan or Space Mouse 6DOF controller
+         connected to your computer's serial port.
+
+         To compile this driver as a module, choose M here: the
+         module will be called magellan.
+
+config JOYSTICK_SPACEORB
+       tristate "SpaceTec SpaceOrb/Avenger 6dof controllers"
+       select SERIO
+       help
+         Say Y here if you have a SpaceOrb 360 or SpaceBall Avenger 6DOF
+         controller connected to your computer's serial port.
+
+         To compile this driver as a module, choose M here: the
+         module will be called spaceorb.
+
+config JOYSTICK_SPACEBALL
+       tristate "SpaceTec SpaceBall 6dof controllers"
+       select SERIO
+       help
+         Say Y here if you have a SpaceTec SpaceBall 2003/3003/4000 FLX
+         controller connected to your computer's serial port. For the
+         SpaceBall 4000 USB model, use the USB HID driver.
+
+         To compile this driver as a module, choose M here: the
+         module will be called spaceball.
+
+config JOYSTICK_STINGER
+       tristate "Gravis Stinger gamepad"
+       select SERIO
+       help
+         Say Y here if you have a Gravis Stinger connected to one of your
+         serial ports.
+
+         To compile this driver as a module, choose M here: the
+         module will be called stinger.
+
+config JOYSTICK_TWIDJOY
+       tristate "Twiddler as a joystick"
+       select SERIO
+       help
+         Say Y here if you have a Handykey Twiddler connected to your
+         computer's serial port and want to use it as a joystick.
+
+         To compile this driver as a module, choose M here: the
+         module will be called twidjoy.
+
+config JOYSTICK_ZHENHUA
+       tristate "5-byte Zhenhua RC transmitter"
+       select SERIO
+       help
+         Say Y here if you have a Zhen Hua PPM-4CH transmitter which is
+         supplied with a ready to fly micro electric indoor helicopters
+         such as EasyCopter, Lama, MiniCopter, DragonFly or Jabo and want
+         to use it via serial cable as a joystick.
+
+         To compile this driver as a module, choose M here: the
+         module will be called zhenhua.
+
+config JOYSTICK_DB9
+       tristate "Multisystem, Sega Genesis, Saturn joysticks and gamepads"
+       depends on PARPORT
+       help
+         Say Y here if you have a Sega Master System gamepad, Sega Genesis
+         gamepad, Sega Saturn gamepad, or a Multisystem -- Atari, Amiga,
+         Commodore, Amstrad CPC joystick connected to your parallel port.
+         For more information on how to use the driver please read
+         <file:Documentation/input/joystick-parport.txt>.
+
+         To compile this driver as a module, choose M here: the
+         module will be called db9.
+
+config JOYSTICK_GAMECON
+       tristate "Multisystem, NES, SNES, N64, PSX joysticks and gamepads"
+       depends on PARPORT
+       ---help---
+         Say Y here if you have a Nintendo Entertainment System gamepad,
+         Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad,
+         Sony PlayStation gamepad or a Multisystem -- Atari, Amiga,
+         Commodore, Amstrad CPC joystick connected to your parallel port.
+         For more information on how to use the driver please read
+         <file:Documentation/input/joystick-parport.txt>.
+
+         To compile this driver as a module, choose M here: the
+         module will be called gamecon.
+
+config JOYSTICK_TURBOGRAFX
+       tristate "Multisystem joysticks via TurboGraFX device"
+       depends on PARPORT
+       help
+         Say Y here if you have the TurboGraFX interface by Steffen Schwenke,
+         and want to use it with Multisystem -- Atari, Amiga, Commodore,
+         Amstrad CPC joystick. For more information on how to use the driver
+         please read <file:Documentation/input/joystick-parport.txt>.
+
+         To compile this driver as a module, choose M here: the
+         module will be called turbografx.
+
+config JOYSTICK_AMIGA
+       tristate "Amiga joysticks"
+       depends on AMIGA
+       help
+         Say Y here if you have an Amiga with a digital joystick connected
+         to it.
+
+         To compile this driver as a module, choose M here: the
+         module will be called amijoy.
+
+config JOYSTICK_JOYDUMP
+       tristate "Gameport data dumper"
+       select GAMEPORT
+       help
+         Say Y here if you want to dump data from your joystick into the system
+         log for debugging purposes. Say N if you are making a production
+         configuration or aren't sure.
+
+         To compile this driver as a module, choose M here: the
+         module will be called joydump.
+
+config JOYSTICK_XPAD
+       tristate "X-Box gamepad support"
+       depends on USB_ARCH_HAS_HCD
+       select USB
+       help
+         Say Y here if you want to use the X-Box pad with your computer.
+         Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
+         and/or "Event interface support" (CONFIG_INPUT_EVDEV) as well.
+
+         For information about how to connect the X-Box pad to USB, see
+         <file:Documentation/input/xpad.txt>.
+
+         To compile this driver as a module, choose M here: the
+         module will be called xpad.
+
+config JOYSTICK_XPAD_FF
+       bool "X-Box gamepad rumble support"
+       depends on JOYSTICK_XPAD && INPUT
+       select INPUT_FF_MEMLESS
+       ---help---
+         Say Y here if you want to take advantage of xbox 360 rumble features.
+
+config JOYSTICK_XPAD_LEDS
+       bool "LED Support for Xbox360 controller 'BigX' LED"
+       depends on JOYSTICK_XPAD && (LEDS_CLASS=y || LEDS_CLASS=JOYSTICK_XPAD)
+       ---help---
+         This option enables support for the LED which surrounds the Big X on
+         XBox 360 controller.
+
+config JOYSTICK_WALKERA0701
+       tristate "Walkera WK-0701 RC transmitter"
+       depends on HIGH_RES_TIMERS && PARPORT
+       help
+         Say Y or M here if you have a Walkera WK-0701 transmitter which is
+         supplied with a ready to fly Walkera helicopters such as HM36,
+         HM37, HM60 and want to use it via parport as a joystick. More
+         information is available: <file:Documentation/input/walkera0701.txt>
+
+         To compile this driver as a module, choose M here: the
+         module will be called walkera0701.
+
+endif
diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile
new file mode 100644 (file)
index 0000000..7230362
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Makefile for the input core drivers.
+#
+
+# Each configuration option enables a list of files.
+
+obj-$(CONFIG_JOYSTICK_A3D)             += a3d.o
+obj-$(CONFIG_JOYSTICK_ADI)             += adi.o
+obj-$(CONFIG_JOYSTICK_AMIGA)           += amijoy.o
+obj-$(CONFIG_JOYSTICK_ANALOG)          += analog.o
+obj-$(CONFIG_JOYSTICK_COBRA)           += cobra.o
+obj-$(CONFIG_JOYSTICK_DB9)             += db9.o
+obj-$(CONFIG_JOYSTICK_GAMECON)         += gamecon.o
+obj-$(CONFIG_JOYSTICK_GF2K)            += gf2k.o
+obj-$(CONFIG_JOYSTICK_GRIP)            += grip.o
+obj-$(CONFIG_JOYSTICK_GRIP_MP)         += grip_mp.o
+obj-$(CONFIG_JOYSTICK_GUILLEMOT)       += guillemot.o
+obj-$(CONFIG_JOYSTICK_IFORCE)          += iforce/
+obj-$(CONFIG_JOYSTICK_INTERACT)                += interact.o
+obj-$(CONFIG_JOYSTICK_JOYDUMP)         += joydump.o
+obj-$(CONFIG_JOYSTICK_MAGELLAN)                += magellan.o
+obj-$(CONFIG_JOYSTICK_SIDEWINDER)      += sidewinder.o
+obj-$(CONFIG_JOYSTICK_SPACEBALL)       += spaceball.o
+obj-$(CONFIG_JOYSTICK_SPACEORB)                += spaceorb.o
+obj-$(CONFIG_JOYSTICK_STINGER)         += stinger.o
+obj-$(CONFIG_JOYSTICK_TMDC)            += tmdc.o
+obj-$(CONFIG_JOYSTICK_TURBOGRAFX)      += turbografx.o
+obj-$(CONFIG_JOYSTICK_TWIDJOY)         += twidjoy.o
+obj-$(CONFIG_JOYSTICK_WARRIOR)         += warrior.o
+obj-$(CONFIG_JOYSTICK_XPAD)            += xpad.o
+obj-$(CONFIG_JOYSTICK_ZHENHUA)         += zhenhua.o
+obj-$(CONFIG_JOYSTICK_WALKERA0701)     += walkera0701.o
+
similarity index 87%
rename from walkera0701.c
rename to drivers/input/joystick/walkera0701.c
index 009b63d2970118dcffe3806ed9f7a7c64b5adc0b..4dfa1eed4b7c6a0c81d50d8b18bcb11f3d4d99ac 100644 (file)
@@ -12,8 +12,7 @@
  * the Free Software Foundation.
 */
 
-
-#define WK0701_DEBUG
+/* #define WK0701_DEBUG */
 
 #define RESERVE 20000
 #define SYNC_PULSE 1306000
 #include <linux/input.h>
 #include <linux/hrtimer.h>
 
-#define DRIVER_DESC     "Walkera WK-0701 TX as joystick"
-
 MODULE_AUTHOR("Peter Popovec <popovec@fei.tuke.sk>");
-MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_DESCRIPTION("Walkera WK-0701 TX as joystick");
 MODULE_LICENSE("GPL");
 
 static unsigned int walkera0701_pp_no;
 module_param_named(port, walkera0701_pp_no, int, 0);
 MODULE_PARM_DESC(port,
-                "Parallel port adapter for walkera WK-0701 TX (default is 0)");
+                "Parallel port adapter for Walkera WK-0701 TX (default is 0)");
 
-/* 
-for now, only one device is supported, if somebody need more devices, code
-can be expanded, one struct walkera_dev per device must be allocated and
-set up by walkera0701_connect (release of device by walkera0701_disconnect)
-*/
+/*
+ * For now, only one device is supported, if somebody need more devices, code
+ * can be expanded, one struct walkera_dev per device must be allocated and
+ * set up by walkera0701_connect (release of device by walkera0701_disconnect)
+ */
 
 struct walkera_dev {
        unsigned char buf[25];
@@ -64,8 +61,7 @@ struct walkera_dev {
        struct pardevice *pardevice;
 };
 
-struct walkera_dev w0701_data;
-static struct walkera_dev *w_dev = &w0701_data;
+static struct walkera_dev w_dev;
 
 static inline void walkera0701_parse_frame(struct walkera_dev *w)
 {
@@ -128,7 +124,7 @@ static inline void walkera0701_parse_frame(struct walkera_dev *w)
 
 static inline int read_ack(struct pardevice *p)
 {
-       return (parport_read_status(p->port) & 0x40);
+       return parport_read_status(p->port) & 0x40;
 }
 
 /* falling edge, prepare to BIN value calculation */
@@ -140,11 +136,13 @@ static void walkera0701_irq_handler(void *handler_data)
        w->irq_time = ktime_to_ns(ktime_get());
        pulse_time = w->irq_time - w->irq_lasttime;
        w->irq_lasttime = w->irq_time;
+
        /* cancel timer, if in handler or active do resync */
        if (unlikely(0 != hrtimer_try_to_cancel(&w->timer))) {
                w->counter = NO_SYNC;
                return;
        }
+
        if (w->counter < NO_SYNC) {
                if (w->ack) {
                        pulse_time -= BIN1_PULSE;
@@ -167,33 +165,36 @@ static void walkera0701_irq_handler(void *handler_data)
                        } else
                                w->counter = NO_SYNC;
                }
-       } else {
-               if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < (RESERVE + BIN1_PULSE - BIN0_PULSE))    /* frame sync .. */
-                       w->counter = 0;
-       }
+       } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) <
+                               RESERVE + BIN1_PULSE - BIN0_PULSE)      /* frame sync .. */
+               w->counter = 0;
+
        hrtimer_start(&w->timer, ktime_set(0, BIN_SAMPLE), HRTIMER_MODE_REL);
-       return;
 }
 
 static enum hrtimer_restart timer_handler(struct hrtimer
                                          *handle)
 {
        struct walkera_dev *w;
+
        w = container_of(handle, struct walkera_dev, timer);
        w->ack = read_ack(w->pardevice);
+
        return HRTIMER_NORESTART;
 }
 
 static int walkera0701_open(struct input_dev *dev)
 {
        struct walkera_dev *w = input_get_drvdata(dev);
+
        parport_enable_irq(w->parport);
-       return (0);
+       return 0;
 }
 
 static void walkera0701_close(struct input_dev *dev)
 {
        struct walkera_dev *w = input_get_drvdata(dev);
+
        parport_disable_irq(w->parport);
 }
 
@@ -204,21 +205,25 @@ static int walkera0701_connect(struct walkera_dev *w, int parport)
        w->parport = parport_find_number(parport);
        if (w->parport == NULL)
                return -ENODEV;
+
        if (w->parport->irq == -1) {
                printk(KERN_ERR "walkera0701: parport without interrupt\n");
                goto init_err;
        }
+
        err = -EBUSY;
-       w->pardevice =
-           parport_register_device(w->parport, "walkera0701",
+       w->pardevice = parport_register_device(w->parport, "walkera0701",
                                    NULL, NULL, walkera0701_irq_handler,
                                    PARPORT_DEV_EXCL, w);
        if (!w->pardevice)
                goto init_err;
+
        if (parport_negotiate(w->pardevice->port, IEEE1284_MODE_COMPAT))
                goto init_err1;
+
        if (parport_claim(w->pardevice))
                goto init_err1;
+
        w->input_dev = input_allocate_device();
        if (!w->input_dev)
                goto init_err2;
@@ -244,21 +249,26 @@ static int walkera0701_connect(struct walkera_dev *w, int parport)
        input_set_abs_params(w->input_dev, ABS_THROTTLE, -512, 512, 0, 0);
        input_set_abs_params(w->input_dev, ABS_RUDDER, -512, 512, 0, 0);
        input_set_abs_params(w->input_dev, ABS_MISC, -512, 512, 0, 0);
+
        err = input_register_device(w->input_dev);
-       if (!err) {
-               hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-               w->timer.function = timer_handler;
-               return 0;
-       }
+       if (err)
+               goto init_err3;
+
+       hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+       w->timer.function = timer_handler;
+       return 0;
+
+ init_err3:
        input_free_device(w->input_dev);
     init_err2:
+ init_err2:
        parport_release(w->pardevice);
     init_err1:
+ init_err1:
        parport_unregister_device(w->pardevice);
     init_err:
+ init_err:
        parport_put_port(w->parport);
        return err;
 }
+
 static void walkera0701_disconnect(struct walkera_dev *w)
 {
        hrtimer_cancel(&w->timer);
@@ -270,12 +280,12 @@ static void walkera0701_disconnect(struct walkera_dev *w)
 
 static int __init walkera0701_init(void)
 {
-       return (walkera0701_connect(w_dev, walkera0701_pp_no));
+       return walkera0701_connect(&w_dev, walkera0701_pp_no);
 }
 
 static void __exit walkera0701_exit(void)
 {
-       walkera0701_disconnect(w_dev);
+       walkera0701_disconnect(&w_dev);
 }
 
 module_init(walkera0701_init);