Message ID | 20210412103215.1276531-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | devicetree: dt_sysinfo: make read-only function args and variables const | expand |
On 2021-04-12 4:32 a.m., Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Make read-only function arguments and variables const. Also clean > up some source formatting to match fwts coding style. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/devicetree/dt_sysinfo/dt_sysinfo.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c > index 8ee4a912..51caa807 100644 > --- a/src/devicetree/dt_sysinfo/dt_sysinfo.c > +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c > @@ -51,10 +51,10 @@ static struct reference_platform { > FWTS_ARRAY_SIZE(garrison_models)}, > }; > > - > -static int dt_sysinfo_get_version(fwts_framework *fw, > - int node, > - char *firmware) > +static int dt_sysinfo_get_version( > + fwts_framework *fw, > + const int node, > + const char *firmware) > { > int version_len; > > @@ -145,7 +145,7 @@ static int dt_sysinfo_check_version(fwts_framework *fw) > static int dt_sysinfo_check_root_property( > fwts_framework *fw, > const char *name, > - bool print_flag) > + const bool print_flag) > { > int node, len; > const char *buf; > @@ -194,11 +194,12 @@ static int dt_sysinfo_check_system_id(fwts_framework *fw) > return dt_sysinfo_check_root_property(fw, "system-id", true); > } > > -static bool dt_fdt_stringlist_contains_last(const char *strlist, > - int listlen, > +static bool dt_fdt_stringlist_contains_last( > + const char *strlist, > + const int listlen, > const char *str) > { > - int len = strlen(str); > + const int len = strlen(str); > const char *p; > > /* checking for either str only or last in string */ > @@ -217,7 +218,7 @@ static bool dt_fdt_stringlist_contains_last(const char *strlist, > > static bool machine_matches_reference_model(fwts_framework *fw, > const char *compatible, > - int compat_len, > + const int compat_len, > const char *model) > { > bool compatible_is_reference = false, model_is_reference = false; > Acked-by: Alex Hung <alex.hung@canonical.com>
On 4/12/21 6:32 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Make read-only function arguments and variables const. Also clean > up some source formatting to match fwts coding style. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/devicetree/dt_sysinfo/dt_sysinfo.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c > index 8ee4a912..51caa807 100644 > --- a/src/devicetree/dt_sysinfo/dt_sysinfo.c > +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c > @@ -51,10 +51,10 @@ static struct reference_platform { > FWTS_ARRAY_SIZE(garrison_models)}, > }; > > - > -static int dt_sysinfo_get_version(fwts_framework *fw, > - int node, > - char *firmware) > +static int dt_sysinfo_get_version( > + fwts_framework *fw, > + const int node, > + const char *firmware) > { > int version_len; > > @@ -145,7 +145,7 @@ static int dt_sysinfo_check_version(fwts_framework *fw) > static int dt_sysinfo_check_root_property( > fwts_framework *fw, > const char *name, > - bool print_flag) > + const bool print_flag) > { > int node, len; > const char *buf; > @@ -194,11 +194,12 @@ static int dt_sysinfo_check_system_id(fwts_framework *fw) > return dt_sysinfo_check_root_property(fw, "system-id", true); > } > > -static bool dt_fdt_stringlist_contains_last(const char *strlist, > - int listlen, > +static bool dt_fdt_stringlist_contains_last( > + const char *strlist, > + const int listlen, > const char *str) > { > - int len = strlen(str); > + const int len = strlen(str); > const char *p; > > /* checking for either str only or last in string */ > @@ -217,7 +218,7 @@ static bool dt_fdt_stringlist_contains_last(const char *strlist, > > static bool machine_matches_reference_model(fwts_framework *fw, > const char *compatible, > - int compat_len, > + const int compat_len, > const char *model) > { > bool compatible_is_reference = false, model_is_reference = false; > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c index 8ee4a912..51caa807 100644 --- a/src/devicetree/dt_sysinfo/dt_sysinfo.c +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c @@ -51,10 +51,10 @@ static struct reference_platform { FWTS_ARRAY_SIZE(garrison_models)}, }; - -static int dt_sysinfo_get_version(fwts_framework *fw, - int node, - char *firmware) +static int dt_sysinfo_get_version( + fwts_framework *fw, + const int node, + const char *firmware) { int version_len; @@ -145,7 +145,7 @@ static int dt_sysinfo_check_version(fwts_framework *fw) static int dt_sysinfo_check_root_property( fwts_framework *fw, const char *name, - bool print_flag) + const bool print_flag) { int node, len; const char *buf; @@ -194,11 +194,12 @@ static int dt_sysinfo_check_system_id(fwts_framework *fw) return dt_sysinfo_check_root_property(fw, "system-id", true); } -static bool dt_fdt_stringlist_contains_last(const char *strlist, - int listlen, +static bool dt_fdt_stringlist_contains_last( + const char *strlist, + const int listlen, const char *str) { - int len = strlen(str); + const int len = strlen(str); const char *p; /* checking for either str only or last in string */ @@ -217,7 +218,7 @@ static bool dt_fdt_stringlist_contains_last(const char *strlist, static bool machine_matches_reference_model(fwts_framework *fw, const char *compatible, - int compat_len, + const int compat_len, const char *model) { bool compatible_is_reference = false, model_is_reference = false;