Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / input / serio / libps2.c
index 79c97f9..b9f5d99 100644 (file)
@@ -177,6 +177,11 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
                return -1;
        }
 
+       if (send && !param) {
+               WARN_ON(1);
+               return -1;
+       }
+
        mutex_lock(&ps2dev->cmd_mutex);
 
        serio_pause_rx(ps2dev->serio);
@@ -275,6 +280,8 @@ int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int comman
        return 0;
 }
 
+static struct lock_class_key ps2_mutex_key;
+
 /*
  * ps2_init() initializes ps2dev structure
  */
@@ -282,6 +289,8 @@ int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int comman
 void ps2_init(struct ps2dev *ps2dev, struct serio *serio)
 {
        mutex_init(&ps2dev->cmd_mutex);
+       lockdep_set_class_and_subclass(&ps2dev->cmd_mutex, &ps2_mutex_key,
+                                      serio->depth);
        init_waitqueue_head(&ps2dev->wait);
        ps2dev->serio = serio;
 }