mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: remove mcu_msg_alloc
We almost always use patter like this:
skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
return mt76_mcu_send_msg(dev, skb, CMD_FUN_SET_OP, wait_resp);
This is not needed, we can allocate skb in mcu_send_msg routine.
Signed-off-by: Stanislaw Gruszka <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
a78802c63b
commit
94ad030758
+12
-14
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "mt76x02_mcu.h"
|
||||
|
||||
struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len)
|
||||
static struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
@@ -32,7 +32,6 @@ struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len)
|
||||
|
||||
return skb;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_alloc);
|
||||
|
||||
static struct sk_buff *
|
||||
mt76x02_mcu_get_response(struct mt76x02_dev *dev, unsigned long expires)
|
||||
@@ -80,16 +79,18 @@ mt76x02_tx_queue_mcu(struct mt76x02_dev *dev, enum mt76_txq_id qid,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mt76x02_mcu_msg_send(struct mt76_dev *mdev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp)
|
||||
int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
|
||||
int len, bool wait_resp)
|
||||
{
|
||||
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
|
||||
unsigned long expires = jiffies + HZ;
|
||||
struct sk_buff *skb;
|
||||
int ret;
|
||||
u8 seq;
|
||||
|
||||
skb = mt76x02_mcu_msg_alloc(data, len);
|
||||
if (!skb)
|
||||
return -EINVAL;
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_lock(&mdev->mmio.mcu.mutex);
|
||||
|
||||
@@ -135,7 +136,6 @@ int mt76x02_mcu_function_select(struct mt76x02_dev *dev,
|
||||
enum mcu_function func,
|
||||
u32 val, bool wait_resp)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct {
|
||||
__le32 id;
|
||||
__le32 value;
|
||||
@@ -144,15 +144,14 @@ int mt76x02_mcu_function_select(struct mt76x02_dev *dev,
|
||||
.value = cpu_to_le32(val),
|
||||
};
|
||||
|
||||
skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
|
||||
return mt76_mcu_send_msg(dev, skb, CMD_FUN_SET_OP, wait_resp);
|
||||
return mt76_mcu_send_msg(dev, CMD_FUN_SET_OP, &msg, sizeof(msg),
|
||||
wait_resp);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02_mcu_function_select);
|
||||
|
||||
int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on,
|
||||
bool wait_resp)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct {
|
||||
__le32 mode;
|
||||
__le32 level;
|
||||
@@ -161,15 +160,14 @@ int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on,
|
||||
.level = cpu_to_le32(0),
|
||||
};
|
||||
|
||||
skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
|
||||
return mt76_mcu_send_msg(dev, skb, CMD_POWER_SAVING_OP, wait_resp);
|
||||
return mt76_mcu_send_msg(dev, CMD_POWER_SAVING_OP, &msg, sizeof(msg),
|
||||
wait_resp);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02_mcu_set_radio_state);
|
||||
|
||||
int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type,
|
||||
u32 param, bool wait)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct {
|
||||
__le32 id;
|
||||
__le32 value;
|
||||
@@ -182,8 +180,8 @@ int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type,
|
||||
if (wait)
|
||||
mt76_rmw(dev, MT_MCU_COM_REG0, BIT(31), 0);
|
||||
|
||||
skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
|
||||
ret = mt76_mcu_send_msg(dev, skb, CMD_CALIBRATION_OP, true);
|
||||
ret = mt76_mcu_send_msg(dev, CMD_CALIBRATION_OP, &msg, sizeof(msg),
|
||||
true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user