mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
Use usb_bulk_msg for reading MCU command responses. This simplify code
a lot.
Together with 97a3005759c ("mt76usb: allow mt76u_bulk_msg be used
for reads") it also fix possible problems with rx data buffers
not being aligned and contained within single page. After doing
page_frag_alloc(1024) consecutive page_frag_alloc(PAGE_SIZE) will
alloc PAGE_SIZE buffer at PAGE_SIZE - 1024 offset.
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/*
|
|
* Copyright (C) 2018 Lorenzo Bianconi <[email protected]>
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#include "mt76.h"
|
|
|
|
int mt76u_mcu_init_rx(struct mt76_dev *dev)
|
|
{
|
|
struct mt76_usb *usb = &dev->usb;
|
|
|
|
usb->mcu.data = kmalloc(MCU_RESP_URB_SIZE, GFP_KERNEL);
|
|
return usb->mcu.data ? 0 : -ENOMEM;
|
|
}
|
|
EXPORT_SYMBOL_GPL(mt76u_mcu_init_rx);
|
|
|
|
void mt76u_mcu_deinit(struct mt76_dev *dev)
|
|
{
|
|
struct mt76_usb *usb = &dev->usb;
|
|
|
|
kfree(usb->mcu.data);
|
|
}
|
|
EXPORT_SYMBOL_GPL(mt76u_mcu_deinit);
|