Commit 114a55cf authored by Simon Wood's avatar Simon Wood Committed by Jiri Kosina

HID:hid-lg4ff: Initialize device properties before we touch autocentering.

Re-arrange code slightly to ensure that device properties are configured
before calling auto-center command.
Reported-by: default avatarMichal Malý <madcatxster@prifuk.cz>
Signed-off-by: default avatarSimon Wood <simon@mungewell.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 56930e7a
...@@ -589,17 +589,6 @@ int lg4ff_init(struct hid_device *hid) ...@@ -589,17 +589,6 @@ int lg4ff_init(struct hid_device *hid)
if (error) if (error)
return error; return error;
/* Check if autocentering is available and
* set the centering force to zero by default */
if (test_bit(FF_AUTOCENTER, dev->ffbit)) {
if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* Formula Force EX expects different autocentering command */
dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex;
else
dev->ff->set_autocenter = hid_lg4ff_set_autocenter_default;
dev->ff->set_autocenter(dev, 0);
}
/* Get private driver data */ /* Get private driver data */
drv_data = hid_get_drvdata(hid); drv_data = hid_get_drvdata(hid);
if (!drv_data) { if (!drv_data) {
...@@ -620,6 +609,17 @@ int lg4ff_init(struct hid_device *hid) ...@@ -620,6 +609,17 @@ int lg4ff_init(struct hid_device *hid)
entry->max_range = lg4ff_devices[i].max_range; entry->max_range = lg4ff_devices[i].max_range;
entry->set_range = lg4ff_devices[i].set_range; entry->set_range = lg4ff_devices[i].set_range;
/* Check if autocentering is available and
* set the centering force to zero by default */
if (test_bit(FF_AUTOCENTER, dev->ffbit)) {
if (rev_maj == FFEX_REV_MAJ && rev_min == FFEX_REV_MIN) /* Formula Force EX expects different autocentering command */
dev->ff->set_autocenter = hid_lg4ff_set_autocenter_ffex;
else
dev->ff->set_autocenter = hid_lg4ff_set_autocenter_default;
dev->ff->set_autocenter(dev, 0);
}
/* Create sysfs interface */ /* Create sysfs interface */
error = device_create_file(&hid->dev, &dev_attr_range); error = device_create_file(&hid->dev, &dev_attr_range);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment