diff options
author | Simon Wood <simon@mungewell.org> | 2013-11-06 14:30:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-04 13:57:20 -0500 |
commit | 43f0ba99fcd871a936df8c25b438759708884df8 (patch) | |
tree | 80de7c3e87af6968015b26b30394da174ab36a9d /drivers/hid | |
parent | b806304bde504aff3b74f9a75e579b7170b5d65a (diff) |
HID:hid-lg4ff: Initialize device properties before we touch autocentering.
commit 114a55cf9dd1576e7ac56189832cd4d7dc56c218 upstream.
Re-arrange code slightly to ensure that device properties are configured
before calling auto-center command.
Reported-by: Michal MalĂ˝ <madcatxster@prifuk.cz>
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-lg4ff.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index 49f6cc0f9919..351805362290 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c | |||
@@ -574,17 +574,6 @@ int lg4ff_init(struct hid_device *hid) | |||
574 | if (error) | 574 | if (error) |
575 | return error; | 575 | return error; |
576 | 576 | ||
577 | /* Check if autocentering is available and | ||
578 | * set the centering force to zero by default */ | ||
579 | if (test_bit(FF_AUTOCENTER, dev->ffbit)) { | ||
580 | if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* Formula Force EX expects different autocentering command */ | ||
581 | dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex; | ||
582 | else | ||
583 | dev->ff->set_autocenter = hid_lg4ff_set_autocenter_default; | ||
584 | |||
585 | dev->ff->set_autocenter(dev, 0); | ||
586 | } | ||
587 | |||
588 | /* Get private driver data */ | 577 | /* Get private driver data */ |
589 | drv_data = hid_get_drvdata(hid); | 578 | drv_data = hid_get_drvdata(hid); |
590 | if (!drv_data) { | 579 | if (!drv_data) { |
@@ -605,6 +594,17 @@ int lg4ff_init(struct hid_device *hid) | |||
605 | entry->max_range = lg4ff_devices[i].max_range; | 594 | entry->max_range = lg4ff_devices[i].max_range; |
606 | entry->set_range = lg4ff_devices[i].set_range; | 595 | entry->set_range = lg4ff_devices[i].set_range; |
607 | 596 | ||
597 | /* Check if autocentering is available and | ||
598 | * set the centering force to zero by default */ | ||
599 | if (test_bit(FF_AUTOCENTER, dev->ffbit)) { | ||
600 | if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* Formula Force EX expects different autocentering command */ | ||
601 | dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex; | ||
602 | else | ||
603 | dev->ff->set_autocenter = hid_lg4ff_set_autocenter_default; | ||
604 | |||
605 | dev->ff->set_autocenter(dev, 0); | ||
606 | } | ||
607 | |||
608 | /* Create sysfs interface */ | 608 | /* Create sysfs interface */ |
609 | error = device_create_file(&hid->dev, &dev_attr_range); | 609 | error = device_create_file(&hid->dev, &dev_attr_range); |
610 | if (error) | 610 | if (error) |