[PATCH v3 8/8] mt76: mt7915: set muru platform type
Ryder Lee
ryder.lee at mediatek.com
Wed Sep 8 11:55:26 PDT 2021
On Wed, 2021-09-08 at 17:41 +0800, Shayne Chen wrote:
> Set muru platform type by mcu cmd to notify fw to init corresponding
> algorithm.
>
> Suggested-by: Money Wang <money.wang at mediatek.com>
> Reviewed-by: Ryder Lee <ryder.lee at mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen at mediatek.com>
> ---
> v3: - fix endianess
> - rework muru ctrl function
> ---
> drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 17
> +++++++++++++++++
> drivers/net/wireless/mediatek/mt76/mt7915/mcu.h | 5 +++++
> .../net/wireless/mediatek/mt76/mt7915/mt7915.h | 1 +
> .../wireless/mediatek/mt76/mt7915/testmode.c | 16 +++++--------
> ---
> .../wireless/mediatek/mt76/mt7915/testmode.h | 4 ----
> 5 files changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 229ba3c469d1..afafc47264cd 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -2949,6 +2949,21 @@ static int mt7915_mcu_set_mwds(struct
> mt7915_dev *dev, bool enabled)
> sizeof(req), false);
> }
>
> +int mt7915_mcu_set_muru_ctrl(struct mt7915_dev *dev, u32 cmd, u8
> *val)
> +{
> + struct {
> + __le32 cmd;
> + u8 val[4];
> + } __packed req = {
> + .cmd = cpu_to_le32(cmd),
> + };
> +
> + memcpy(req.val, val, sizeof(req.val));
Will this lead to undefined behavior if memcpy size larger than source?
what about passing u32 and using put_unaligned_le32?
Ryder
More information about the Linux-mediatek
mailing list