vserver 1.9.5.x5
[linux-2.6.git] / drivers / input / joystick / spaceorb.c
index 593dcac..19f27c7 100644 (file)
@@ -2,7 +2,7 @@
  * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
- * 
+ *
  *  Based on the work of:
  *     David Thompson
  */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
 #include <linux/input.h>
 #include <linux/serio.h>
 
+#define DRIVER_DESC    "SpaceTec SpaceOrb 360 and Avenger 6dof controller driver"
+
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
-MODULE_DESCRIPTION("SpaceTec SpaceOrb 360 and Avenger 6dof controller driver");
+MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
 /*
@@ -67,7 +69,7 @@ struct spaceorb {
 static unsigned char spaceorb_xor[] = "SpaceWare";
 
 static unsigned char *spaceorb_errors[] = { "EEPROM storing 0 failed", "Receive queue overflow", "Transmit queue timeout",
-               "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; 
+               "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" };
 
 /*
  * spaceorb_process_packet() decodes packets the driver receives from the
@@ -99,7 +101,7 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb, struct pt_regs *r
 
                case 'D':                               /* Ball + button data */
                        if (spaceorb->idx != 12) return;
-                       for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i]; 
+                       for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i];
                        axes[0] = ( data[2]      << 3) | (data[ 3] >> 4);
                        axes[1] = ((data[3] & 0x0f) << 6) | (data[ 4] >> 1);
                        axes[2] = ((data[4] & 0x01) << 9) | (data[ 5] << 2) | (data[4] >> 5);
@@ -162,7 +164,7 @@ static void spaceorb_disconnect(struct serio *serio)
  * it as an input device.
  */
 
-static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
+static void spaceorb_connect(struct serio *serio, struct serio_driver *drv)
 {
        struct spaceorb *spaceorb;
        int i, t;
@@ -174,7 +176,7 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
                return;
        memset(spaceorb, 0, sizeof(struct spaceorb));
 
-       spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);     
+       spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 
        for (i = 0; i < 6; i++)
                set_bit(spaceorb_buttons[i], spaceorb->dev.keybit);
@@ -198,10 +200,11 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
        spaceorb->dev.id.vendor = SERIO_SPACEORB;
        spaceorb->dev.id.product = 0x0001;
        spaceorb->dev.id.version = 0x0100;
-       
+       spaceorb->dev.dev = &serio->dev;
+
        serio->private = spaceorb;
 
-       if (serio_open(serio, dev)) {
+       if (serio_open(serio, drv)) {
                kfree(spaceorb);
                return;
        }
@@ -213,10 +216,14 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
  * The serio device structure.
  */
 
-static struct serio_dev spaceorb_dev = {
-       .interrupt =    spaceorb_interrupt,
-       .connect =      spaceorb_connect,
-       .disconnect =   spaceorb_disconnect,
+static struct serio_driver spaceorb_drv = {
+       .driver         = {
+               .name   = "spaceorb",
+       },
+       .description    = DRIVER_DESC,
+       .interrupt      = spaceorb_interrupt,
+       .connect        = spaceorb_connect,
+       .disconnect     = spaceorb_disconnect,
 };
 
 /*
@@ -225,13 +232,13 @@ static struct serio_dev spaceorb_dev = {
 
 int __init spaceorb_init(void)
 {
-       serio_register_device(&spaceorb_dev);
+       serio_register_driver(&spaceorb_drv);
        return 0;
 }
 
 void __exit spaceorb_exit(void)
 {
-       serio_unregister_device(&spaceorb_dev);
+       serio_unregister_driver(&spaceorb_drv);
 }
 
 module_init(spaceorb_init);