[PATCH] parameter: fix parameter name to reflect usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Everywhere the max parameter is used, it's assumed it has the value of
the highest index into the names array + 1. As counting begins from
zero, rename it to num_names in the prototypes for clarity.

This is already the name used internally in struct param_d.

No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/param.h | 16 ++++++++--------
 lib/parameter.c |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/param.h b/include/param.h
index 5d4f7f3db52f..1ccb6a26eb78 100644
--- a/include/param.h
+++ b/include/param.h
@@ -68,7 +68,7 @@ struct param_d *dev_add_param_enum(struct device *dev, const char *name,
 				   int (*set)(struct param_d *p, void *priv),
 				   int (*get)(struct param_d *p, void *priv),
 				   int *value, const char * const *names,
-				   int max, void *priv);
+				   int num_names, void *priv);
 
 struct param_d *dev_add_param_tristate(struct device *dev, const char *name,
 				       int (*set)(struct param_d *p, void *priv),
@@ -83,7 +83,7 @@ struct param_d *dev_add_param_bitmask(struct device *dev, const char *name,
 				      int (*set)(struct param_d *p, void *priv),
 				      int (*get)(struct param_d *p, void *priv),
 				      unsigned long *value,
-				      const char * const *names, int max,
+				      const char * const *names, int num_names,
 				      void *priv);
 
 struct param_d *dev_add_param_ip(struct device *dev, const char *name,
@@ -164,7 +164,7 @@ static inline struct param_d *dev_add_param_enum(struct device *dev,
 						 int (*get)(struct param_d *p, void *priv),
 						 int *value,
 						 const char * const *names,
-						 int max, void *priv)
+						 int num_names, void *priv)
 
 {
 	return NULL;
@@ -176,7 +176,7 @@ static inline struct param_d *dev_add_param_bitmask(struct device *dev,
 						    int (*get)(struct param_d *p, void *priv),
 						    unsigned long *value,
 						    const char * const *names,
-						    int max, void *priv)
+						    int num_names, void *priv)
 {
 	return NULL;
 }
@@ -350,20 +350,20 @@ static inline struct param_d *dev_add_param_enum_ro(struct device *dev,
 						    const char *name,
 						    int *value,
 						    const char * const *names,
-						    int max)
+						    int num_names)
 {
 	return dev_add_param_enum(dev, name, param_set_readonly, NULL,
-				  value, names, max, NULL);
+				  value, names, num_names, NULL);
 }
 
 static inline struct param_d *dev_add_param_bitmask_ro(struct device *dev,
 						       const char *name,
 						       unsigned long *value,
 						       const char * const *names,
-						       int max)
+						       int num_names)
 {
 	return dev_add_param_bitmask(dev, name, param_set_readonly, NULL,
-				     value, names, max, NULL);
+				     value, names, num_names, NULL);
 }
 
 /*
diff --git a/lib/parameter.c b/lib/parameter.c
index c587d10eabcc..bf9e83152b77 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -718,7 +718,7 @@ struct param_d *dev_add_param_bitmask(struct device *dev, const char *name,
 				      int (*set)(struct param_d *p, void *priv),
 				      int (*get)(struct param_d *p, void *priv),
 				      unsigned long *value,
-				      const char * const *names, int max,
+				      const char * const *names, int num_names,
 				      void *priv)
 {
 	struct param_bitmask *pb;
@@ -731,7 +731,7 @@ struct param_d *dev_add_param_bitmask(struct device *dev, const char *name,
 	pb->set = set;
 	pb->get = get;
 	pb->names = names;
-	pb->num_names = max;
+	pb->num_names = num_names;
 	p = &pb->param;
 	p->driver_priv = priv;
 	p->type = PARAM_TYPE_BITMASK;
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux