diff options
author | Goffredo Baroncelli <kreijack@inwind.it> | 2015-05-30 11:00:26 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-06-01 14:33:35 +0200 |
commit | 04fba7864ffcceae8a5f78d88ae1fd8d682a5123 (patch) | |
tree | bd8d85426a6e9cc0a8f67165b0ffa4d1325731bf | |
parent | f4e1eb966256b15335054fac7b304f14e4965b5d (diff) | |
download | op-kernel-dev-04fba7864ffcceae8a5f78d88ae1fd8d682a5123.zip op-kernel-dev-04fba7864ffcceae8a5f78d88ae1fd8d682a5123.tar.gz |
HID: Export hid_field_extract()
Rename the function extract() to hid_field_extract(), make it external linkage
to allow the use from other modules.
Suggested-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-core.c | 11 | ||||
-rw-r--r-- | include/linux/hid.h | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 722a925..fe33f9e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1061,13 +1061,13 @@ static u32 s32ton(__s32 value, unsigned n) * Search linux-kernel and linux-usb-devel archives for "hid-core extract". */ -static __u32 extract(const struct hid_device *hid, __u8 *report, +__u32 hid_field_extract(const struct hid_device *hid, __u8 *report, unsigned offset, unsigned n) { u64 x; if (n > 32) - hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n", + hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", n, current->comm); report += offset >> 3; /* adjust byte index */ @@ -1076,6 +1076,7 @@ static __u32 extract(const struct hid_device *hid, __u8 *report, x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ return (u32) x; } +EXPORT_SYMBOL_GPL(hid_field_extract); /* * "implement" : set bits in a little endian bit stream. @@ -1221,9 +1222,9 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, for (n = 0; n < count; n++) { value[n] = min < 0 ? - snto32(extract(hid, data, offset + n * size, size), - size) : - extract(hid, data, offset + n * size, size); + snto32(hid_field_extract(hid, data, offset + n * size, + size), size) : + hid_field_extract(hid, data, offset + n * size, size); /* Ignore report if ErrorRollOver */ if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && diff --git a/include/linux/hid.h b/include/linux/hid.h index 176b436..f17980d 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -815,6 +815,8 @@ void hid_disconnect(struct hid_device *hid); const struct hid_device_id *hid_match_id(struct hid_device *hdev, const struct hid_device_id *id); s32 hid_snto32(__u32 value, unsigned n); +__u32 hid_field_extract(const struct hid_device *hid, __u8 *report, + unsigned offset, unsigned n); /** * hid_device_io_start - enable HID input during probe, remove |