]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/input/hid-lgff.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/hwmon-2.6
[linux-2.6-omap-h63xx.git] / drivers / usb / input / hid-lgff.c
index 0c4c77aa31eac7731a0ec21f5313978016dfbc03..f07d44357ff12fbb01eb18271d0832acbbabe672 100644 (file)
@@ -154,10 +154,9 @@ int hid_lgff_init(struct hid_device* hid)
                return -1;
        }
 
-       private = kmalloc(sizeof(struct lgff_device), GFP_KERNEL);
+       private = kzalloc(sizeof(struct lgff_device), GFP_KERNEL);
        if (!private)
                return -1;
-       memset(private, 0, sizeof(struct lgff_device));
        hid->ff_private = private;
 
        /* Input init */
@@ -228,13 +227,12 @@ static struct hid_report* hid_lgff_duplicate_report(struct hid_report* report)
        }
        *ret->field[0] = *report->field[0];
 
-       ret->field[0]->value = kmalloc(sizeof(s32[8]), GFP_KERNEL);
+       ret->field[0]->value = kzalloc(sizeof(s32[8]), GFP_KERNEL);
        if (!ret->field[0]->value) {
                kfree(ret->field[0]);
                kfree(ret);
                return NULL;
        }
-       memset(ret->field[0]->value, 0, sizeof(s32[8]));
 
        return ret;
 }
@@ -255,22 +253,19 @@ static void hid_lgff_input_init(struct hid_device* hid)
        u16 idVendor = le16_to_cpu(hid->dev->descriptor.idVendor);
        u16 idProduct = le16_to_cpu(hid->dev->descriptor.idProduct);
        struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
+       struct input_dev *input_dev = hidinput->input;
 
        while (dev->idVendor && (idVendor != dev->idVendor || idProduct != dev->idProduct))
                dev++;
 
-       ff = dev->ff;
+       for (ff = dev->ff; *ff >= 0; ff++)
+               set_bit(*ff, input_dev->ffbit);
 
-       while (*ff >= 0) {
-               set_bit(*ff, hidinput->input.ffbit);
-               ++ff;
-       }
-
-       hidinput->input.upload_effect = hid_lgff_upload_effect;
-       hidinput->input.flush = hid_lgff_flush;
+       input_dev->upload_effect = hid_lgff_upload_effect;
+       input_dev->flush = hid_lgff_flush;
 
-       set_bit(EV_FF, hidinput->input.evbit);
-       hidinput->input.ff_effects_max = LGFF_EFFECTS;
+       set_bit(EV_FF, input_dev->evbit);
+       input_dev->ff_effects_max = LGFF_EFFECTS;
 }
 
 static void hid_lgff_exit(struct hid_device* hid)