[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ddde705-f3fa-ff78-4d43-7a02d6efaaa6@gmail.com>
Date: Tue, 4 Jan 2022 11:26:57 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Hector Martin <marcan@...can.st>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Arend van Spriel <aspriel@...il.com>,
Franky Lin <franky.lin@...adcom.com>,
Hante Meuleman <hante.meuleman@...adcom.com>,
Chi-hsien Lin <chi-hsien.lin@...ineon.com>,
Wright Feng <wright.feng@...ineon.com>
Cc: Sven Peter <sven@...npeter.dev>,
Alyssa Rosenzweig <alyssa@...enzweig.io>,
Mark Kettenis <kettenis@...nbsd.org>,
Rafał Miłecki <zajec5@...il.com>,
Pieter-Paul Giesberts <pieter-paul.giesberts@...adcom.com>,
Linus Walleij <linus.walleij@...aro.org>,
Hans de Goede <hdegoede@...hat.com>,
"John W. Linville" <linville@...driver.com>,
"brian m. carlson" <sandals@...stytoothpaste.net>,
Andy Shevchenko <andy.shevchenko@...il.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, brcm80211-dev-list.pdl@...adcom.com,
SHA-cyfmac-dev-list@...ineon.com
Subject: Re: [PATCH v2 04/35] brcmfmac: firmware: Support having multiple alt
paths
04.01.2022 10:26, Hector Martin пишет:
> Apple platforms have firmware and config files identified with multiple
> dimensions. We want to be able to find the most specific firmware
> available for any given platform, progressively trying more general
> firmwares.
>
> First, add support for having multiple alternate firmware paths.
>
> Acked-by: Linus Walleij <linus.walleij@...aro.org>
> Signed-off-by: Hector Martin <marcan@...can.st>
> ---
> .../broadcom/brcm80211/brcmfmac/firmware.c | 75 ++++++++++++++-----
> .../broadcom/brcm80211/brcmfmac/firmware.h | 2 +
> 2 files changed, 59 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> index 0497b721136a..7570dbf22cdd 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> @@ -427,6 +427,8 @@ void brcmf_fw_nvram_free(void *nvram)
> struct brcmf_fw {
> struct device *dev;
> struct brcmf_fw_request *req;
> + const char *alt_paths[BRCMF_FW_MAX_ALT_PATHS];
> + int alt_index;
unsigned int
> u32 curpos;
> void (*done)(struct device *dev, int err, struct brcmf_fw_request *req);
> };
> @@ -592,14 +594,18 @@ static int brcmf_fw_complete_request(const struct firmware *fw,
> return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret;
> }
>
> -static char *brcm_alt_fw_path(const char *path, const char *board_type)
> +static int brcm_alt_fw_paths(const char *path, const char *board_type,
> + const char *alt_paths[BRCMF_FW_MAX_ALT_PATHS])> {
> char alt_path[BRCMF_FW_NAME_LEN];
> const char *suffix;
>
> + memset(alt_paths, 0, array_size(sizeof(*alt_paths),
> + BRCMF_FW_MAX_ALT_PATHS));
You don't need to use array_size() since size of a fixed array is
already known.
memset(alt_paths, 0, sizeof(alt_paths));
...
> +static void
> +brcm_free_alt_fw_paths(const char *alt_paths[BRCMF_FW_MAX_ALT_PATHS])
> +{
> + unsigned int i;
> +
> + for (i = 0; alt_paths[i]; i++)
What if array is fully populated and there is no null in the end? Please
don't do this, use BRCMF_FW_MAX_ALT_PATHS or ARRAY_SIZE().
> + kfree(alt_paths[i]);
> }
>
> static int brcmf_fw_request_firmware(const struct firmware **fw,
> @@ -617,19 +634,25 @@ static int brcmf_fw_request_firmware(const struct firmware **fw,
> {
> struct brcmf_fw_item *cur = &fwctx->req->items[fwctx->curpos];
> int ret;
> + unsigned int i;
Keep reverse Xmas tree coding style.
...
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
> @@ -11,6 +11,8 @@
>
> #define BRCMF_FW_DEFAULT_PATH "brcm/"
>
> +#define BRCMF_FW_MAX_ALT_PATHS 8
Two tabs are needed here.
Powered by blists - more mailing lists