* [PATCH 1/2] Bluetooth: btbcm: Use strreplace()
@ 2024-02-17 7:30 Christophe JAILLET
2024-02-17 7:30 ` [PATCH 2/2] Bluetooth: btbcm: Use devm_kstrdup() Christophe JAILLET
2024-02-20 19:10 ` [PATCH 1/2] Bluetooth: btbcm: Use strreplace() patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-02-17 7:30 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-bluetooth
Use strreplace() instead of hand-writing it.
It is less verbose.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/bluetooth/btbcm.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 0a5445ac5e1b..01d2343b4978 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -11,6 +11,7 @@
#include <linux/firmware.h>
#include <linux/dmi.h>
#include <linux/of.h>
+#include <linux/string.h>
#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
@@ -544,7 +545,6 @@ static const char *btbcm_get_board_name(struct device *dev)
char *board_type;
const char *tmp;
int len;
- int i;
root = of_find_node_by_path("/");
if (!root)
@@ -557,10 +557,7 @@ static const char *btbcm_get_board_name(struct device *dev)
len = strlen(tmp) + 1;
board_type = devm_kzalloc(dev, len, GFP_KERNEL);
strscpy(board_type, tmp, len);
- for (i = 0; i < len; i++) {
- if (board_type[i] == '/')
- board_type[i] = '-';
- }
+ strreplace(board_type, '/', '-');
of_node_put(root);
return board_type;
--
2.43.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] Bluetooth: btbcm: Use devm_kstrdup()
2024-02-17 7:30 [PATCH 1/2] Bluetooth: btbcm: Use strreplace() Christophe JAILLET
@ 2024-02-17 7:30 ` Christophe JAILLET
2024-02-20 19:10 ` [PATCH 1/2] Bluetooth: btbcm: Use strreplace() patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-02-17 7:30 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-bluetooth
Use devm_kstrdup() instead of hand-writing it.
It is less verbose.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/bluetooth/btbcm.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 01d2343b4978..f9a7c790d7e2 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -544,7 +544,6 @@ static const char *btbcm_get_board_name(struct device *dev)
struct device_node *root;
char *board_type;
const char *tmp;
- int len;
root = of_find_node_by_path("/");
if (!root)
@@ -554,9 +553,7 @@ static const char *btbcm_get_board_name(struct device *dev)
return NULL;
/* get rid of any '/' in the compatible string */
- len = strlen(tmp) + 1;
- board_type = devm_kzalloc(dev, len, GFP_KERNEL);
- strscpy(board_type, tmp, len);
+ board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
strreplace(board_type, '/', '-');
of_node_put(root);
--
2.43.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] Bluetooth: btbcm: Use strreplace()
2024-02-17 7:30 [PATCH 1/2] Bluetooth: btbcm: Use strreplace() Christophe JAILLET
2024-02-17 7:30 ` [PATCH 2/2] Bluetooth: btbcm: Use devm_kstrdup() Christophe JAILLET
@ 2024-02-20 19:10 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-02-20 19:10 UTC (permalink / raw)
To: Christophe JAILLET
Cc: marcel, luiz.dentz, linux-kernel, kernel-janitors, linux-bluetooth
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Sat, 17 Feb 2024 08:30:41 +0100 you wrote:
> Use strreplace() instead of hand-writing it.
> It is less verbose.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/bluetooth/btbcm.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Here is the summary with links:
- [1/2] Bluetooth: btbcm: Use strreplace()
https://git.kernel.org/bluetooth/bluetooth-next/c/76912dcbabc6
- [2/2] Bluetooth: btbcm: Use devm_kstrdup()
https://git.kernel.org/bluetooth/bluetooth-next/c/d095e06a1569
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-20 19:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-17 7:30 [PATCH 1/2] Bluetooth: btbcm: Use strreplace() Christophe JAILLET
2024-02-17 7:30 ` [PATCH 2/2] Bluetooth: btbcm: Use devm_kstrdup() Christophe JAILLET
2024-02-20 19:10 ` [PATCH 1/2] Bluetooth: btbcm: Use strreplace() patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®