From 7bf542b2ba5411e4cf8c693b97a68fc9da2343ea Mon Sep 17 00:00:00 2001 From: wusongjie Date: Tue, 1 Aug 2023 08:41:08 +0800 Subject: [PATCH] Drivers:OFW:replace new rt_str* to string.h Now, we only use STD string if possible. Signed-off-by: GuEe-GUI --- components/drivers/ofw/base.c | 7 ++++--- components/drivers/ofw/fdt.c | 9 +++++---- components/drivers/ofw/irq.c | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/drivers/ofw/base.c b/components/drivers/ofw/base.c index 63f6d2702e14..6f8f20e806ab 100644 --- a/components/drivers/ofw/base.c +++ b/components/drivers/ofw/base.c @@ -10,6 +10,7 @@ #include +#include #include #include #include @@ -249,7 +250,7 @@ rt_bool_t rt_ofw_node_tag_equ(const struct rt_ofw_node *np, const char *tag) if (np && tag) { const char *node_name = rt_fdt_node_name(np->full_name); - rt_size_t tag_len = rt_strchrnul(node_name, '@') - node_name; + rt_size_t tag_len = strchrnul(node_name, '@') - node_name; ret = (rt_strlen(tag) == tag_len && !rt_strncmp(node_name, tag, tag_len)); } @@ -569,7 +570,7 @@ struct rt_ofw_node *rt_ofw_find_node_by_ids_r(struct rt_ofw_node *from, const st struct rt_ofw_node *rt_ofw_find_node_by_path(const char *path) { - struct rt_ofw_node *np, *parent, *tmp; + struct rt_ofw_node *np = RT_NULL, *parent, *tmp = RT_NULL; if (path) { @@ -584,7 +585,7 @@ struct rt_ofw_node *rt_ofw_find_node_by_path(const char *path) while (*path) { - const char *next = rt_strchrnul(path, '/'); + const char *next = strchrnul(path, '/'); rt_size_t len = next - path; tmp = RT_NULL; diff --git a/components/drivers/ofw/fdt.c b/components/drivers/ofw/fdt.c index 1d3388e79d5f..d64feec9cd27 100755 --- a/components/drivers/ofw/fdt.c +++ b/components/drivers/ofw/fdt.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -40,7 +41,7 @@ static rt_size_t _root_addr_cells; const char *rt_fdt_node_name(const char *full_name) { - const char *node_name = rt_strrchr(full_name, '/'); + const char *node_name = strrchr(full_name, '/'); return node_name ? node_name + 1 : full_name; } @@ -701,7 +702,7 @@ rt_err_t rt_fdt_scan_chosen_stdout(void) if (stdout_path && len) { - const char *path_split = rt_strchrnul(stdout_path, ':'); + const char *path_split = strchrnul(stdout_path, ':'); if (*path_split != '\0') { @@ -780,13 +781,13 @@ rt_err_t rt_fdt_scan_chosen_stdout(void) if (*options) { - type_len = rt_strchrnul(options, ',') - options; + type_len = strchrnul(options, ',') - options; } } if (options && *options && *options != ' ') { - options_len = rt_strchrnul(options, ' ') - options; + options_len = strchrnul(options, ' ') - options; } /* console > stdout-path */ diff --git a/components/drivers/ofw/irq.c b/components/drivers/ofw/irq.c index 69ac3b3d5e17..9aa815c224d4 100755 --- a/components/drivers/ofw/irq.c +++ b/components/drivers/ofw/irq.c @@ -10,6 +10,7 @@ #include +#include #include #include #include @@ -130,7 +131,7 @@ static rt_err_t ofw_parse_irq_map(struct rt_ofw_node *np, struct rt_ofw_cell_arg * <0x1800 0 0 4 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; // INTD * }; * - * In fact, basically no SoC will be use multi ic to implemented INTx. + * In fact, amost no SoC will be use multi ic to implemented INTx. * before call ofw_parse_irq_map(np, &args): * * args.data = addr;