diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2014-02-05 16:33:16 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-02-17 08:05:55 -0500 |
commit | b69d6536794c93dda362ab79c9f559382e3465be (patch) | |
tree | 1de569075c2c5d77b88c54f98213affad9e8500f /include/linux/hid.h | |
parent | 0a7f364e812285246cd617a51194a3f8bd0e8daa (diff) |
HID: add inliners for ll_driver transport-layer callbacks
Those callbacks are not mandatory, so it's better to add inliners
to use them safely.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/hid.h')
-rw-r--r-- | include/linux/hid.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index 003cc8e89831..dddcad07c2d9 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -680,6 +680,8 @@ struct hid_driver { | |||
680 | * shouldn't allocate anything to not leak memory | 680 | * shouldn't allocate anything to not leak memory |
681 | * @request: send report request to device (e.g. feature report) | 681 | * @request: send report request to device (e.g. feature report) |
682 | * @wait: wait for buffered io to complete (send/recv reports) | 682 | * @wait: wait for buffered io to complete (send/recv reports) |
683 | * @raw_request: send raw report request to device (e.g. feature report) | ||
684 | * @output_report: send output report to device | ||
683 | * @idle: send idle request to device | 685 | * @idle: send idle request to device |
684 | */ | 686 | */ |
685 | struct hid_ll_driver { | 687 | struct hid_ll_driver { |
@@ -974,6 +976,49 @@ static inline void hid_hw_request(struct hid_device *hdev, | |||
974 | } | 976 | } |
975 | 977 | ||
976 | /** | 978 | /** |
979 | * hid_hw_raw_request - send report request to device | ||
980 | * | ||
981 | * @hdev: hid device | ||
982 | * @reportnum: report ID | ||
983 | * @buf: in/out data to transfer | ||
984 | * @len: length of buf | ||
985 | * @rtype: HID report type | ||
986 | * @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT | ||
987 | * | ||
988 | * @return: count of data transfered, negative if error | ||
989 | * | ||
990 | * Same behavior as hid_hw_request, but with raw buffers instead. | ||
991 | */ | ||
992 | static inline int hid_hw_raw_request(struct hid_device *hdev, | ||
993 | unsigned char reportnum, __u8 *buf, | ||
994 | size_t len, unsigned char rtype, int reqtype) | ||
995 | { | ||
996 | if (hdev->ll_driver->raw_request) | ||
997 | return hdev->ll_driver->raw_request(hdev, reportnum, buf, len, | ||
998 | rtype, reqtype); | ||
999 | |||
1000 | return -ENOSYS; | ||
1001 | } | ||
1002 | |||
1003 | /** | ||
1004 | * hid_hw_output_report - send output report to device | ||
1005 | * | ||
1006 | * @hdev: hid device | ||
1007 | * @buf: raw data to transfer | ||
1008 | * @len: length of buf | ||
1009 | * | ||
1010 | * @return: count of data transfered, negative if error | ||
1011 | */ | ||
1012 | static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, | ||
1013 | size_t len) | ||
1014 | { | ||
1015 | if (hdev->ll_driver->output_report) | ||
1016 | return hdev->ll_driver->output_report(hdev, buf, len); | ||
1017 | |||
1018 | return -ENOSYS; | ||
1019 | } | ||
1020 | |||
1021 | /** | ||
977 | * hid_hw_idle - send idle request to device | 1022 | * hid_hw_idle - send idle request to device |
978 | * | 1023 | * |
979 | * @hdev: hid device | 1024 | * @hdev: hid device |