Message ID | 79b9c9d9f86b4c573f0d3f2dac0a6fc9e6024058.1708154999.git.christophe.jaillet@wanadoo.fr |
---|---|
State | Accepted |
Commit | 76912dcbabc64f2a8b405edc9ea7cc00e14bd63d |
Headers | show |
Series | [1/2] Bluetooth: btbcm: Use strreplace() | expand |
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!
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;
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(-)