Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Goffredo Baroncelli and committed by
Jiri Kosina
04fba786 f4e1eb96

+8 -5
+6 -5
drivers/hid/hid-core.c
··· 1061 1061 * Search linux-kernel and linux-usb-devel archives for "hid-core extract". 1062 1062 */ 1063 1063 1064 - static __u32 extract(const struct hid_device *hid, __u8 *report, 1064 + __u32 hid_field_extract(const struct hid_device *hid, __u8 *report, 1065 1065 unsigned offset, unsigned n) 1066 1066 { 1067 1067 u64 x; 1068 1068 1069 1069 if (n > 32) 1070 - hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n", 1070 + hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", 1071 1071 n, current->comm); 1072 1072 1073 1073 report += offset >> 3; /* adjust byte index */ ··· 1076 1076 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ 1077 1077 return (u32) x; 1078 1078 } 1079 + EXPORT_SYMBOL_GPL(hid_field_extract); 1079 1080 1080 1081 /* 1081 1082 * "implement" : set bits in a little endian bit stream. ··· 1222 1221 for (n = 0; n < count; n++) { 1223 1222 1224 1223 value[n] = min < 0 ? 1225 - snto32(extract(hid, data, offset + n * size, size), 1226 - size) : 1227 - extract(hid, data, offset + n * size, size); 1224 + snto32(hid_field_extract(hid, data, offset + n * size, 1225 + size), size) : 1226 + hid_field_extract(hid, data, offset + n * size, size); 1228 1227 1229 1228 /* Ignore report if ErrorRollOver */ 1230 1229 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
+2
include/linux/hid.h
··· 815 815 const struct hid_device_id *hid_match_id(struct hid_device *hdev, 816 816 const struct hid_device_id *id); 817 817 s32 hid_snto32(__u32 value, unsigned n); 818 + __u32 hid_field_extract(const struct hid_device *hid, __u8 *report, 819 + unsigned offset, unsigned n); 818 820 819 821 /** 820 822 * hid_device_io_start - enable HID input during probe, remove