Skip to contentSkip to conversation

common/kallsyms.c: Fix sparse warning

PATCH In review Alexander Shiyan 2 participants 10 messages Feb 16, 2014 – Feb 17, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 common/kallsyms.c: Fix sparse warning

CHECK common/kallsyms.c
common/kallsyms.c:170:12: warning: symbol 'kallsyms_lookup' was not declared. Should it be static?

---
 common/kallsyms.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
common/kallsyms.c +4 -4
index 94dfcdc..121b77c 100644
@@ -167,10 +167,10 @@ static unsigned long get_symbol_pos(unsigned long addr,
  *   It resides in a module.
  * - We also guarantee that modname will be valid until rescheduled.
  */
-const char *kallsyms_lookup(unsigned long addr,
-			    unsigned long *symbolsize,
-			    unsigned long *offset,
-			    char **modname, char *namebuf)
+static const char *kallsyms_lookup(unsigned long addr,
+				   unsigned long *symbolsize,
+				   unsigned long *offset,
+				   char **modname, char *namebuf)
 {
 	namebuf[KSYM_NAME_LEN - 1] = 0;
 	namebuf[0] = 0;
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/8 drivers/clk/clk-fixed.c: Fix sparse warning

drivers/clk/clk-fixed.c:35:16: warning: symbol 'clk_fixed_ops' was not declared. Should it be static?

---
 drivers/clk/clk-fixed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-fixed.c +1 -1
index 3a38865..8164005 100644
@@ -32,7 +32,7 @@ static unsigned long clk_fixed_recalc_rate(struct clk *clk,
 	return fix->rate;
 }
 
-struct clk_ops clk_fixed_ops = {
+static struct clk_ops clk_fixed_ops = {
 	.recalc_rate = clk_fixed_recalc_rate,
 	.is_enabled = clk_is_enabled_always,
 };
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/8 drivers/clk/clk-fixed-factor.c: Fix sparse warning

In reply to Alexander Shiyan

drivers/clk/clk-fixed-factor.c:38:16: warning: symbol 'clk_fixed_factor_ops' was not declared. Should it be static?

---
 drivers/clk/clk-fixed-factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-fixed-factor.c +1 -1
index 52e7c16..f0ecbd3 100644
@@ -35,7 +35,7 @@ static unsigned long clk_fixed_factor_recalc_rate(struct clk *clk,
 	return (parent_rate / f->div) * f->mult;
 }
 
-struct clk_ops clk_fixed_factor_ops = {
+static struct clk_ops clk_fixed_factor_ops = {
 	.recalc_rate = clk_fixed_factor_recalc_rate,
 };
 
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 4/8 drivers/clk/clk-mux.c: Fix sparse warning

In reply to Alexander Shiyan

drivers/clk/clk-mux.c:53:16: warning: symbol 'clk_mux_ops' was not declared. Should it be static?

---
 drivers/clk/clk-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-mux.c +1 -1
index 47efe12..b22bdd1 100644
@@ -50,7 +50,7 @@ static int clk_mux_set_parent(struct clk *clk, u8 idx)
 	return 0;
 }
 
-struct clk_ops clk_mux_ops = {
+static struct clk_ops clk_mux_ops = {
 	.get_parent = clk_mux_get_parent,
 	.set_parent = clk_mux_set_parent,
 };
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 5/8 drivers/clk/clk-gate.c: Fix sparse warning

In reply to Alexander Shiyan

drivers/clk/clk-gate.c:79:16: warning: symbol 'clk_gate_ops' was not declared. Should it be static?

---
 drivers/clk/clk-gate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-gate.c +1 -1
index f33effd..baec855 100644
@@ -76,7 +76,7 @@ static int clk_gate_is_enabled(struct clk *clk)
 		return g->flags & CLK_GATE_INVERTED ? 1 : 0;
 }
 
-struct clk_ops clk_gate_ops = {
+static struct clk_ops clk_gate_ops = {
 	.enable = clk_gate_enable,
 	.disable = clk_gate_disable,
 	.is_enabled = clk_gate_is_enabled,
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 6/8 drivers/clk/clk-divider-table.c: Fix sparse warning

In reply to Alexander Shiyan

drivers/clk/clk-divider-table.c:81:16: warning: symbol 'clk_divider_table_ops' was not declared. Should it be static?

---
 drivers/clk/clk-divider-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-divider-table.c +1 -1
index 204e24d..fd2d3fc 100644
@@ -78,7 +78,7 @@ static unsigned long clk_divider_recalc_rate(struct clk *clk,
 	return parent_rate / div->table[val].div;
 }
 
-struct clk_ops clk_divider_table_ops = {
+static struct clk_ops clk_divider_table_ops = {
 	.set_rate = clk_divider_set_rate,
 	.recalc_rate = clk_divider_recalc_rate,
 };
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 7/8 drivers/i2c/i2c.c: Fix sparse warnings

In reply to Alexander Shiyan

drivers/i2c/i2c.c:246:19: warning: symbol 'i2c_new_device' was not declared. Should it be static? drivers/i2c/i2c.c:274:6: warning: symbol 'of_i2c_register_devices' was not declared. Should it be static?

---
 drivers/i2c/i2c.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/i2c/i2c.c +3 -4
index 3b9f601..f8785cb 100644
@@ -243,8 +243,8 @@ EXPORT_SYMBOL(i2c_write_reg);
  *
  * Returns the new device, or NULL.
  */
-struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
-				  struct i2c_board_info *chip)
+static struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
+					 struct i2c_board_info *chip)
 {
 	struct i2c_client *client;
 	int status;
@@ -269,9 +269,8 @@ struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
 
 	return client;
 }
-EXPORT_SYMBOL(i2c_new_device);
 
-void of_i2c_register_devices(struct i2c_adapter *adap)
+static void of_i2c_register_devices(struct i2c_adapter *adap)
 {
 	struct device_node *n;
 
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH 8/8 drivers/of/base.c: Fix sparse warnings

In reply to Alexander Shiyan

drivers/of/base.c:70:20: warning: symbol 'root_node' was not declared. Should it be static? drivers/of/base.c:72:20: warning: symbol 'of_aliases' was not declared. Should it be static? drivers/of/base.c:1724:20: warning: symbol 'of_chosen' was not declared. Should it be static? drivers/of/base.c:1725:12: warning: symbol 'of_model' was not declared. Should it be static?

---
 drivers/of/base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/of/base.c +4 -4
index 6e5e7d6..104b6da 100644
@@ -67,9 +67,9 @@ struct alias_prop {
 
 static LIST_HEAD(aliases_lookup);
 
-struct device_node *root_node;
+static struct device_node *root_node;
 
-struct device_node *of_aliases;
+static struct device_node *of_aliases;
 
 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
 #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
@@ -1721,8 +1721,8 @@ int of_add_memory(struct device_node *node, bool dump)
 	return 0;
 }
 
-struct device_node *of_chosen;
-const char *of_model;
+static struct device_node *of_chosen;
+static const char *of_model;
 
 const char *of_get_model(void)
 {
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw
In reply to Alexander Shiyan
Quoted 4 lines · Alexander Shiyan

CHECK common/kallsyms.c
common/kallsyms.c:170:12: warning: symbol 'kallsyms_lookup' was not declared. Should it be static?

Applied all, although with some of them I'm not sure whether the correct fix would be to actually add the declaration to a header file instead of making the symbol static.

Sascha

Quoted 32 lines
---
 common/kallsyms.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
common/kallsyms.c +4 -4
index 94dfcdc..121b77c 100644
@@ -167,10 +167,10 @@ static unsigned long get_symbol_pos(unsigned long addr,
  *   It resides in a module.
  * - We also guarantee that modname will be valid until rescheduled.
  */
-const char *kallsyms_lookup(unsigned long addr,
-			    unsigned long *symbolsize,
-			    unsigned long *offset,
-			    char **modname, char *namebuf)
+static const char *kallsyms_lookup(unsigned long addr,
+				   unsigned long *symbolsize,
+				   unsigned long *offset,
+				   char **modname, char *namebuf)
 {
 	namebuf[KSYM_NAME_LEN - 1] = 0;
 	namebuf[0] = 0;
Signature · 7 lines
1.8.3.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Понедельник, 17 февраля 2014, 8:25 +01:00 от Sascha Hauer <[email protected]>:

Quoted 10 lines · Alexander Shiyan
Quoted 2 lines

CHECK common/kallsyms.c
common/kallsyms.c:170:12: warning: symbol 'kallsyms_lookup' was not

declared. Should it be static?

Quoted 2 lines

Applied all, although with some of them I'm not sure whether the correct fix would be to actually add the declaration to a header file instead of making the symbol static.

You are right, but declaration may be added as they are needed.

---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox