Re: [PATCH v2 06/35] brcmfmac: firmware: Support passing in multiple board_types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022/01/07 15:17, Arend Van Spriel wrote:
> On January 7, 2022 5:02:13 AM Hector Martin <marcan@xxxxxxxxx> wrote:
> 
>> On 2022/01/06 21:16, Arend van Spriel wrote:
>>> On 1/4/2022 8:26 AM, Hector Martin wrote:
>>>> In order to make use of the multiple alt_path functionality, change
>>>> board_type to an array. Bus drivers can pass in a NULL-terminated list
>>>> of board type strings to try for the firmware fetch.
>>>
>>> Reviewed-by: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
>>>> Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>>>> Signed-off-by: Hector Martin <marcan@xxxxxxxxx>
>>>> ---
>>>> .../broadcom/brcm80211/brcmfmac/firmware.c    | 35 ++++++++++++-------
>>>> .../broadcom/brcm80211/brcmfmac/firmware.h    |  2 +-
>>>> .../broadcom/brcm80211/brcmfmac/pcie.c        |  4 ++-
>>>> .../broadcom/brcm80211/brcmfmac/sdio.c        |  2 +-
>>>> 4 files changed, 27 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c 
>>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
>>>> index 7570dbf22cdd..054ea3ed133e 100644
>>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
>>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
>>>> @@ -594,28 +594,39 @@ static int brcmf_fw_complete_request(const struct 
>>>> firmware *fw,
>>>> return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret;
>>>> }
>>>>
>>>> -static int brcm_alt_fw_paths(const char *path, const char *board_type,
>>>> +static int brcm_alt_fw_paths(const char *path, struct brcmf_fw *fwctx,
>>>>   const char *alt_paths[BRCMF_FW_MAX_ALT_PATHS])
>>>> {
>>>> + const char **board_types = fwctx->req->board_types;
>>>> + unsigned int i;
>>>> char alt_path[BRCMF_FW_NAME_LEN];
>>>> const char *suffix;
>>>
>>> [...]
>>>
>>>> + for (i = 0; i < BRCMF_FW_MAX_ALT_PATHS; i++) {
>>>> + if (!board_types[i])
>>>> +    break;
>>>>
>>>> - strlcat(alt_path, ".", BRCMF_FW_NAME_LEN);
>>>> - strlcat(alt_path, board_type, BRCMF_FW_NAME_LEN);
>>>> - strlcat(alt_path, suffix, BRCMF_FW_NAME_LEN);
>>>> + /* strip extension at the end */
>>>> + strscpy(alt_path, path, BRCMF_FW_NAME_LEN);
>>>> + alt_path[suffix - path] = 0;
>>>>
>>>> - alt_paths[0] = kstrdup(alt_path, GFP_KERNEL);
>>>> + strlcat(alt_path, ".", BRCMF_FW_NAME_LEN);
>>>> + strlcat(alt_path, board_types[i], BRCMF_FW_NAME_LEN);
>>>> + strlcat(alt_path, suffix, BRCMF_FW_NAME_LEN);
>>>> +
>>>> + alt_paths[i] = kstrdup(alt_path, GFP_KERNEL);
>>>> + brcmf_dbg(TRACE, "FW alt path: %s\n", alt_paths[i]);
>>>
>>> Could use alt_path in the debug print thus avoiding additional array
>>> access (working hard to find those nits to pick ;-) ).
>>
>> So you're saying my code is so good you have to resort to nits on this
>> level to make it clear you read it, right? ;-)
> 
> Don't read too much into this :-p Actually never liked the alt_path 
> approach, but didn't come up with a better solution.

Yeah, it's not the prettiest approach. I redid this part of the patchset
for v3 though, as I mentioned to Dmitry. Now I just iterate over
board_types, which ends up being a lot cleaner as far as the changes
required.

-- 
Hector Martin (marcan@xxxxxxxxx)
Public Key: https://mrcn.st/pub



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux