VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   35 Branches   59 Tags
author: Al Viro <viro@zeniv.linux.org.uk> 2019-09-07 07:23:15 -0400 committer: Al Viro <viro@zeniv.linux.org.uk> 2020-02-07 14:48:37 -0500 commit: d7167b149943e38ad610191ecbb0800c78bbced9 parent: 96cafb9ccb153f6a82ff2c9bde68916d9d65501e
Commit Summary:
fs_parse: fold fs_parameter_desc/fs_parameter_spec
Diffstat:
1 file changed, 25 insertions, 27 deletions
diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index 3ed1e49d8267..5f8c06a1fb93 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -47,15 +47,14 @@ int lookup_constant(const struct constant_table *tbl, const char *name, int not_
 EXPORT_SYMBOL(lookup_constant);
 
 static const struct fs_parameter_spec *fs_lookup_key(
-	const struct fs_parameter_description *desc,
+	const struct fs_parameter_spec *desc,
 	const char *name)
 {
 	const struct fs_parameter_spec *p;
-
-	if (!desc->specs)
+	if (!desc)
 		return NULL;
 
-	for (p = desc->specs; p->name; p++)
+	for (p = desc; p->name; p++)
 		if (strcmp(p->name, name) == 0)
 			return p;
 
@@ -81,7 +80,7 @@ static const struct fs_parameter_spec *fs_lookup_key(
  * the parameter wasn't recognised and unknowns aren't okay.
  */
 int __fs_parse(struct p_log *log,
-	     const struct fs_parameter_description *desc,
+	     const struct fs_parameter_spec *desc,
 	     struct fs_parameter *param,
 	     struct fs_parse_result *result)
 {
@@ -355,39 +354,37 @@ bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size,
  * @desc: The parameter description to validate.
  */
 bool fs_validate_description(const char *name,
-	const struct fs_parameter_description *desc)
+	const struct fs_parameter_spec *desc)
 {
 	const struct fs_parameter_spec *param, *p2;
 	bool good = true;
 
 	pr_notice("*** VALIDATE %s ***\n", name);
 
-	if (desc->specs) {
-		for (param = desc->specs; param->name; param++) {
-			enum fs_parameter_type t = param->type;
+	for (param = desc; param->name; param++) {
+		enum fs_parameter_type t = param->type;
 
-			/* Check that the type is in range */
-			if (t == __fs_param_wasnt_defined ||
-			    t >= nr__fs_parameter_type) {
-				pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n",
-				       name, param->name, t);
+		/* Check that the type is in range */
+		if (t == __fs_param_wasnt_defined ||
+		    t >= nr__fs_parameter_type) {
+			pr_err("VALIDATE %s: PARAM[%s] Bad type %u\n",
+			       name, param->name, t);
+			good = false;
+		} else if (t == fs_param_is_enum) {
+			const struct constant_table *e = param->data;
+			if (!e || !e->name) {
+				pr_err("VALIDATE %s: PARAM[%s] enum with no values\n",
+				       name, param->name);
 				good = false;
-			} else if (t == fs_param_is_enum) {
-				const struct constant_table *e = param->data;
-				if (!e || !e->name) {
-					pr_err("VALIDATE %s: PARAM[%s] enum with no values\n",
-					       name, param->name);
-					good = false;
-				}
 			}
+		}
 
-			/* Check for duplicate parameter names */
-			for (p2 = desc->specs; p2 < param; p2++) {
-				if (strcmp(param->name, p2->name) == 0) {
-					pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n",
-					       name, param->name);
-					good = false;
-				}
+		/* Check for duplicate parameter names */
+		for (p2 = desc; p2 < param; p2++) {
+			if (strcmp(param->name, p2->name) == 0) {
+				pr_err("VALIDATE %s: PARAM[%s]: Duplicate\n",
+				       name, param->name);
+				good = false;
 			}
 		}
 	}