From: Kalle Valo <kvalo@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Shayne Chen <shayne.chen@mediatek.com>,
Felix Fietkau <nbd@nbd.name>,
linux-wireless <linux-wireless@vger.kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Evelyn Tsai <evelyn.tsai@mediatek.com>,
Bo Jiao <Bo.Jiao@mediatek.com>,
linux-mediatek <linux-mediatek@lists.infradead.org>,
Peter Chiu <chui-hao.chiu@mediatek.com>
Subject: Re: [PATCH 03/12] wifi: mt76: mt7996: add dsp firmware download
Date: Wed, 07 Jun 2023 17:16:02 +0300 [thread overview]
Message-ID: <878rcvgxy5.fsf@kernel.org> (raw)
In-Reply-To: <ZHotQTUHbWOt/ibt@lore-desk> (Lorenzo Bianconi's message of "Fri, 2 Jun 2023 19:56:17 +0200")
(I moved Lorenzo's comment to better see the macro)
Lorenzo Bianconi <lorenzo@kernel.org> writes:
>> From: Peter Chiu <chui-hao.chiu@mediatek.com>
>>
>> Add DSP firmware for phy-related control. The firmware is transparent to
>> driver, but it's necessary for the firmware download process.
>>
>> Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
>> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
>> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
[...]
>> +#define LOAD_RAM(_type) \
>> + do { \
>> + ret = request_firmware(&fw, MT7996_FIRMWARE_##_type, dev->mt76.dev);\
>> + if (ret) \
>> + return ret; \
>> + \
>> + if (!fw || !fw->data || fw->size < sizeof(*hdr)) { \
>> + dev_err(dev->mt76.dev, "Invalid firmware\n"); \
>> + release_firmware(fw); \
>> + return -EINVAL; \
>> + } \
>> + \
>> + hdr = (const struct mt7996_fw_trailer *) \
>> + (fw->data + fw->size - sizeof(*hdr)); \
>> + \
>> + dev_info(dev->mt76.dev, \
>> + "%s Firmware Version: %.10s, Build Time: %.15s\n", \
>> + #_type, hdr->fw_ver, hdr->build_date); \
>> + \
>> + ret = mt7996_mcu_send_ram_firmware(dev, hdr, fw->data, \
>> + MT7996_RAM_TYPE_##_type); \
>> + if (ret) { \
>> + dev_err(dev->mt76.dev, "Failed to start %s firmware\n", #_type);\
>> + release_firmware(fw); \
>> + return ret; \
>> + } \
>> + \
>> + release_firmware(fw); \
>> + } while (0)
>> +
>> + LOAD_RAM(WM);
>> + LOAD_RAM(DSP);
>> + LOAD_RAM(WA);
>> +#undef LOAD_RAM
>
> I think it would be better to used a regular function instead of a macro, the
> code would be much easier to read.
Yeah, a function is preferred. I think Andrew Morton says: prefer C over
CPP
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2023-06-07 14:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 15:20 [PATCH 01/12] wifi: mt76: mt7996: move radio ctrl commands to proper functions Shayne Chen
2023-06-02 15:20 ` [PATCH 02/12] wifi: mt76: connac: add a setting bit for dsp firmware Shayne Chen
2023-06-02 17:55 ` Lorenzo Bianconi
2023-06-02 15:20 ` [PATCH 03/12] wifi: mt76: mt7996: add dsp firmware download Shayne Chen
2023-06-02 17:56 ` Lorenzo Bianconi
2023-06-07 14:16 ` Kalle Valo [this message]
2023-06-02 15:21 ` [PATCH 04/12] wifi: mt76: mt7996: fix bss wlan_idx when sending bss_info command Shayne Chen
2023-06-02 15:21 ` [PATCH 05/12] wifi: mt76: mt7996: init he and eht cap for AP_VLAN Shayne Chen
2023-06-02 15:21 ` [PATCH 06/12] wifi: mt76: mt7996: enable VHT extended NSS BW feature Shayne Chen
2023-06-02 15:21 ` [PATCH 07/12] wifi: mt76: connac: add a new bss_info tag for setting ifs time Shayne Chen
2023-06-02 17:57 ` Lorenzo Bianconi
2023-06-02 15:21 ` [PATCH 08/12] wifi: mt76: mt7996: set ifs time by mcu command Shayne Chen
2023-06-02 18:12 ` Lorenzo Bianconi
2023-06-02 15:21 ` [PATCH 09/12] wifi: mt76: mt7996: use correct phy for background radar event Shayne Chen
2023-06-02 15:21 ` [PATCH 10/12] wifi: mt76: mt7996: fix WA event ring size Shayne Chen
2023-06-02 15:21 ` [PATCH 11/12] wifi: mt76: mt7996: add muru support Shayne Chen
2023-06-02 15:21 ` [PATCH 12/12] wifi: mt76: mt7996: increase tx token size Shayne Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878rcvgxy5.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=Bo.Jiao@mediatek.com \
--cc=chui-hao.chiu@mediatek.com \
--cc=evelyn.tsai@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=shayne.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).