mirror of
https://github.com/szehl/ath9k-hmac.git
synced 2025-02-12 13:25:22 +00:00
30 lines
787 B
C
30 lines
787 B
C
/*
|
|
* Copyright (c) 2013 Hauke Mehrtens <hauke@hauke-m.de>
|
|
*
|
|
* Backport functionality introduced in Linux 3.12.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/hid.h>
|
|
#include <linux/bug.h>
|
|
|
|
/*
|
|
* Allocator for buffer that is going to be passed to hid_output_report()
|
|
*/
|
|
u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
|
|
{
|
|
/*
|
|
* 7 extra bytes are necessary to achieve proper functionality
|
|
* of implement() working on 8 byte chunks
|
|
*/
|
|
|
|
int len = ((report->size - 1) >> 3) + 1 + (report->id > 0) + 7;
|
|
|
|
return kmalloc(len, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(hid_alloc_report_buf);
|