diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-11-02 19:56:29 -0700 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-11-05 11:48:38 -0800 |
commit | 711a4b2a329a7f22b3e8338bdc94550b958fe07c (patch) | |
tree | fcc2ee7caafe08565c58495087670477cd359742 | |
parent | 0844f3249d38664fcbb015644702c3c82f2b5349 (diff) |
HID: Make input_configured return int
The magicmouse driver needs to setup the input mapping after reports are
parsed, but before device is registered, which actually can fail. So we
have change input_configured to return an integer.
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
-rw-r--r-- | drivers/hid/hid-input.c | 10 | ||||
-rw-r--r-- | drivers/hid/hid-multitouch.c | 6 | ||||
-rw-r--r-- | include/linux/hid.h | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index d917c0d53685..c21b9e50be3c 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -1229,8 +1229,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force) * UGCI) cram a lot of unrelated inputs into the * same interface. */ hidinput->report = report; - if (drv->input_configured) - drv->input_configured(hid, hidinput); + if (drv->input_configured && + drv->input_configured(hid, hidinput)) + goto out_cleanup; if (input_register_device(hidinput->input)) goto out_cleanup; hidinput = NULL; @@ -1239,8 +1240,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force) } if (hidinput) { - if (drv->input_configured) - drv->input_configured(hid, hidinput); + if (drv->input_configured && + drv->input_configured(hid, hidinput)) + goto out_cleanup; if (input_register_device(hidinput->input)) goto out_cleanup; } diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index a1bfe7b2d743..f3be566ae710 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -670,7 +670,7 @@ static void mt_post_parse(struct mt_device *td) } } -static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi) +static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) { struct mt_device *td = hid_get_drvdata(hdev); @@ -679,7 +679,7 @@ static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi) /* Only initialize slots for MT input devices */ if (!test_bit(ABS_MT_POSITION_X, input->absbit)) - return; + return 0; if (!td->maxcontacts) td->maxcontacts = MT_DEFAULT_MAXCONTACT; @@ -697,6 +697,8 @@ static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi) input_mt_init_slots(input, td->maxcontacts, td->mt_flags); td->mt_flags = 0; + + return 0; } static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) diff --git a/include/linux/hid.h b/include/linux/hid.h index c076041a069e..9bff086eefde 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -634,8 +634,8 @@ struct hid_driver { int (*input_mapped)(struct hid_device *hdev, struct hid_input *hidinput, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max); - void (*input_configured)(struct hid_device *hdev, - struct hid_input *hidinput); + int (*input_configured)(struct hid_device *hdev, + struct hid_input *hidinput); void (*feature_mapping)(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage); |