Skip to content

Commit 04fba78

Browse files
kreijackJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Goffredo Baroncelli <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f4e1eb9 commit 04fba78

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

drivers/hid/hid-core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,13 +1061,13 @@ static u32 s32ton(__s32 value, unsigned n)
10611061
* Search linux-kernel and linux-usb-devel archives for "hid-core extract".
10621062
*/
10631063

1064-
static __u32 extract(const struct hid_device *hid, __u8 *report,
1064+
__u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
10651065
unsigned offset, unsigned n)
10661066
{
10671067
u64 x;
10681068

10691069
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",
10711071
n, current->comm);
10721072

10731073
report += offset >> 3; /* adjust byte index */
@@ -1076,6 +1076,7 @@ static __u32 extract(const struct hid_device *hid, __u8 *report,
10761076
x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */
10771077
return (u32) x;
10781078
}
1079+
EXPORT_SYMBOL_GPL(hid_field_extract);
10791080

10801081
/*
10811082
* "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,
12211222
for (n = 0; n < count; n++) {
12221223

12231224
value[n] = min < 0 ?
1224-
snto32(extract(hid, data, offset + n * size, size),
1225-
size) :
1226-
extract(hid, data, offset + n * size, size);
1225+
snto32(hid_field_extract(hid, data, offset + n * size,
1226+
size), size) :
1227+
hid_field_extract(hid, data, offset + n * size, size);
12271228

12281229
/* Ignore report if ErrorRollOver */
12291230
if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&

include/linux/hid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,8 @@ void hid_disconnect(struct hid_device *hid);
815815
const struct hid_device_id *hid_match_id(struct hid_device *hdev,
816816
const struct hid_device_id *id);
817817
s32 hid_snto32(__u32 value, unsigned n);
818+
__u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
819+
unsigned offset, unsigned n);
818820

819821
/**
820822
* hid_device_io_start - enable HID input during probe, remove

0 commit comments

Comments
 (0)