aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMathieu Magnaudet <mathieu.magnaudet@gmail.com>2014-11-27 10:02:36 -0500
committerJiri Kosina <jkosina@suse.cz>2014-12-01 15:34:17 -0500
commitdabb05c6670e6e4415d7b56cd5864a5dbd90207f (patch)
treeca80d7c8cf44f32bb0c870855ae87452c8a004c3 /include/linux
parentda10bc252476a8d1d1bdf7b94502ad2cbd7f30b1 (diff)
HID: make hid_report_len as a static inline function in hid.h
In several hid drivers it is necessary to calculate the length of an hid_report. This patch exports the existing static function hid_report_len of hid-core.c as an inline function in hid.h Signed-off-by: Mathieu Magnaudet <mathieu.magnaudet@enac.fr> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hid.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf941cd..2366fda010c8 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1063,6 +1063,17 @@ static inline void hid_hw_wait(struct hid_device *hdev)
1063 hdev->ll_driver->wait(hdev); 1063 hdev->ll_driver->wait(hdev);
1064} 1064}
1065 1065
1066/**
1067 * hid_report_len - calculate the report length
1068 *
1069 * @report: the report we want to know the length
1070 */
1071static inline int hid_report_len(struct hid_report *report)
1072{
1073 /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
1074 return ((report->size - 1) >> 3) + 1 + (report->id > 0);
1075}
1076
1066int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 1077int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1067 int interrupt); 1078 int interrupt);
1068 1079