mirror of https://gitee.com/openkylin/linux.git
mt76: split __mt76u_mcu_send_msg and mt76u_mcu_send_msg routines
Split __mt76u_mcu_send_msg and mt76u_mcu_send_msg in order to be reused by mt76x0 driver in usb mcu layer unification between mt76x0 and mt76x2u drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
5090efa4a2
commit
4c89ff2c74
|
@ -623,6 +623,8 @@ int mt76u_mcu_fw_send_data(struct mt76_dev *dev, const void *data,
|
|||
int data_len, u32 max_payload, u32 offset);
|
||||
void mt76u_mcu_complete_urb(struct urb *urb);
|
||||
struct sk_buff *mt76u_mcu_msg_alloc(const void *data, int len);
|
||||
int __mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp);
|
||||
int mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp);
|
||||
void mt76u_mcu_fw_reset(struct mt76_dev *dev);
|
||||
|
|
|
@ -86,8 +86,8 @@ static int mt76u_mcu_wait_resp(struct mt76_dev *dev, u8 seq)
|
|||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
int mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp)
|
||||
int __mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp)
|
||||
{
|
||||
struct usb_interface *intf = to_usb_interface(dev->dev);
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
|
@ -100,8 +100,6 @@ int mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
|||
if (test_bit(MT76_REMOVED, &dev->state))
|
||||
return 0;
|
||||
|
||||
mutex_lock(&usb->mcu.mutex);
|
||||
|
||||
pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]);
|
||||
if (wait_resp) {
|
||||
seq = ++usb->mcu.msg_seq & 0xf;
|
||||
|
@ -114,22 +112,33 @@ int mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
|||
MT_MCU_MSG_TYPE_CMD;
|
||||
ret = mt76u_skb_dma_info(skb, CPU_TX_PORT, info);
|
||||
if (ret)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
ret = usb_bulk_msg(udev, pipe, skb->data, skb->len, &sent, 500);
|
||||
if (ret)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
if (wait_resp)
|
||||
ret = mt76u_mcu_wait_resp(dev, seq);
|
||||
|
||||
out:
|
||||
mutex_unlock(&usb->mcu.mutex);
|
||||
|
||||
consume_skb(skb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__mt76u_mcu_send_msg);
|
||||
|
||||
int mt76u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp)
|
||||
{
|
||||
struct mt76_usb *usb = &dev->usb;
|
||||
int err;
|
||||
|
||||
mutex_lock(&usb->mcu.mutex);
|
||||
err = __mt76u_mcu_send_msg(dev, skb, cmd, wait_resp);
|
||||
mutex_unlock(&usb->mcu.mutex);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76u_mcu_send_msg);
|
||||
|
||||
void mt76u_mcu_fw_reset(struct mt76_dev *dev)
|
||||
|
|
Loading…
Reference in New Issue