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

Configure Feed

Select the types of activity you want to include in your feed.

at v5.4-rc2 49 lines 1.1 kB view raw
1// SPDX-License-Identifier: ISC 2/* 3 * Copyright (C) 2019 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> 4 */ 5 6#include "mt76.h" 7 8struct sk_buff * 9mt76_mcu_msg_alloc(const void *data, int head_len, 10 int data_len, int tail_len) 11{ 12 struct sk_buff *skb; 13 14 skb = alloc_skb(head_len + data_len + tail_len, 15 GFP_KERNEL); 16 if (!skb) 17 return NULL; 18 19 skb_reserve(skb, head_len); 20 if (data && data_len) 21 skb_put_data(skb, data, data_len); 22 23 return skb; 24} 25EXPORT_SYMBOL_GPL(mt76_mcu_msg_alloc); 26 27/* mmio */ 28struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev, 29 unsigned long expires) 30{ 31 unsigned long timeout; 32 33 if (!time_is_after_jiffies(expires)) 34 return NULL; 35 36 timeout = expires - jiffies; 37 wait_event_timeout(dev->mmio.mcu.wait, 38 !skb_queue_empty(&dev->mmio.mcu.res_q), 39 timeout); 40 return skb_dequeue(&dev->mmio.mcu.res_q); 41} 42EXPORT_SYMBOL_GPL(mt76_mcu_get_response); 43 44void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb) 45{ 46 skb_queue_tail(&dev->mmio.mcu.res_q, skb); 47 wake_up(&dev->mmio.mcu.wait); 48} 49EXPORT_SYMBOL_GPL(mt76_mcu_rx_event);