All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: use strreplace() in brcmf_of_probe()
@ 2022-06-16  7:54 Dan Carpenter
  2022-06-16 13:08 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-06-16  7:54 UTC (permalink / raw)
  To: Arend van Spriel, Johannes Berg
  Cc: Franky Lin, Hante Meuleman, Kalle Valo, Len Baker, Shawn Guo,
	Hector Martin, linux-wireless, brcm80211-dev-list.pdl,
	Linus Walleij, kernel-janitors

The for loop in brcmf_of_probe() would ideally end with something like
"i <= strlen(board_type)" instead of "i < board_type[i]".  But
fortunately, the two are equivalent.

Anyway, it's simpler to use strreplace() instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
---
I sent something like this last year but I did something wrong and it
never made it patchwork.  This is basically a new patch.

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index 083ac58f466d..811bd55f0d62 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -72,7 +72,6 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 	/* Set board-type to the first string of the machine compatible prop */
 	root = of_find_node_by_path("/");
 	if (root) {
-		int i;
 		char *board_type;
 		const char *tmp;
 
@@ -84,10 +83,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 			of_node_put(root);
 			return;
 		}
-		for (i = 0; i < board_type[i]; i++) {
-			if (board_type[i] == '/')
-				board_type[i] = '-';
-		}
+		strreplace(board_type, '/', '-');
 		settings->board_type = board_type;
 
 		of_node_put(root);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: use strreplace() in brcmf_of_probe()
  2022-06-16  7:54 [PATCH] brcmfmac: use strreplace() in brcmf_of_probe() Dan Carpenter
@ 2022-06-16 13:08 ` Linus Walleij
  2022-06-17 15:14 ` Arend van Spriel
  2022-07-28  9:55 ` wifi: " Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-06-16 13:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Arend van Spriel, Johannes Berg, Franky Lin, Hante Meuleman,
	Kalle Valo, Len Baker, Shawn Guo, Hector Martin, linux-wireless,
	brcm80211-dev-list.pdl, kernel-janitors

On Thu, Jun 16, 2022 at 9:54 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The for loop in brcmf_of_probe() would ideally end with something like
> "i <= strlen(board_type)" instead of "i < board_type[i]".  But
> fortunately, the two are equivalent.
>
> Anyway, it's simpler to use strreplace() instead.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Johannes Berg <johannes@sipsolutions.net>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: use strreplace() in brcmf_of_probe()
  2022-06-16  7:54 [PATCH] brcmfmac: use strreplace() in brcmf_of_probe() Dan Carpenter
  2022-06-16 13:08 ` Linus Walleij
@ 2022-06-17 15:14 ` Arend van Spriel
  2022-07-28  9:55 ` wifi: " Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2022-06-17 15:14 UTC (permalink / raw)
  To: Dan Carpenter, Arend van Spriel, Johannes Berg
  Cc: Franky Lin, Hante Meuleman, Kalle Valo, Len Baker, Shawn Guo,
	Hector Martin, linux-wireless, brcm80211-dev-list.pdl,
	Linus Walleij, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

On 6/16/2022 9:54 AM, Dan Carpenter wrote:
> The for loop in brcmf_of_probe() would ideally end with something like
> "i <= strlen(board_type)" instead of "i < board_type[i]".  But
> fortunately, the two are equivalent.
> 
> Anyway, it's simpler to use strreplace() instead.

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> I sent something like this last year but I did something wrong and it
> never made it patchwork.  This is basically a new patch.
> 
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wifi: brcmfmac: use strreplace() in brcmf_of_probe()
  2022-06-16  7:54 [PATCH] brcmfmac: use strreplace() in brcmf_of_probe() Dan Carpenter
  2022-06-16 13:08 ` Linus Walleij
  2022-06-17 15:14 ` Arend van Spriel
@ 2022-07-28  9:55 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2022-07-28  9:55 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Arend van Spriel, Johannes Berg, Franky Lin, Hante Meuleman,
	Len Baker, Shawn Guo, Hector Martin, linux-wireless,
	brcm80211-dev-list.pdl, Linus Walleij, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The for loop in brcmf_of_probe() would ideally end with something like
> "i <= strlen(board_type)" instead of "i < board_type[i]".  But
> fortunately, the two are equivalent.
> 
> Anyway, it's simpler to use strreplace() instead.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Johannes Berg <johannes@sipsolutions.net>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

Patch applied to wireless-next.git, thanks.

bef11f1edc40 wifi: brcmfmac: use strreplace() in brcmf_of_probe()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/YqrhsKcjEA7B2pC4@kili/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-28  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16  7:54 [PATCH] brcmfmac: use strreplace() in brcmf_of_probe() Dan Carpenter
2022-06-16 13:08 ` Linus Walleij
2022-06-17 15:14 ` Arend van Spriel
2022-07-28  9:55 ` wifi: " Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.