Skip to contentSkip to conversation

drivers: memory: This patch fix the following checkpatch warning.

PATCH In review Mohan Kumar 2 participants 2 messages Apr 16, 2019

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

PATCH 1/1 drivers: memory: This patch fix the following checkpatch warning.

Switch hardcoded function name with a reference to __func__ making the code more maintainable

WARNING: Prefer using '"%s...", __func__' to using function's name, in a string

Use pr_warn instead of printk

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

---
 drivers/memory/omap-gpmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +2 -2
index f629759..685f422 100644
@@ -795,7 +795,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
 #endif
 
 	gpmc_cs_bool_timings(cs, &t->bool_timings);
-	gpmc_cs_show_timings(cs, "after gpmc_cs_set_timings");
+	gpmc_cs_show_timings(cs, "%s", __func__);
 
 	return 0;
 }
@@ -1033,7 +1033,7 @@ void gpmc_cs_free(int cs)
 
 	spin_lock(&gpmc_mem_lock);
 	if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
-		printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
+		pr_err("Trying to free non-reserved GPMC CS%d\n", cs);
 		BUG();
 		spin_unlock(&gpmc_mem_lock);
 		return;
Signature · 1 line
2.7.4
#1 lore raw

Hi Mohan,

Quoted 21 lines · Mohan Kumar

Switch hardcoded function name with a reference to __func__ making the code more maintainable

WARNING: Prefer using '"%s...", __func__' to using function's name, in a string

Use pr_warn instead of printk

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...

---
 drivers/memory/omap-gpmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +0 -0
index f629759..685f422 100644

drivers/memory/omap-gpmc.c int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t, · line 798

Quoted 5 lines
drivers/memory/omap-gpmc.c +1 -1
@@ -795,7 +795,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
 #endif
 
 	gpmc_cs_bool_timings(cs, &t->bool_timings);
-	gpmc_cs_show_timings(cs, "after gpmc_cs_set_timings");
+	gpmc_cs_show_timings(cs, "%s", __func__);

This will not build. gpmc_cs_show_timings only takes 2 arguments.

drivers/memory/omap-gpmc.c void gpmc_cs_free(int cs) · line 1039

Quoted 13 lines
drivers/memory/omap-gpmc.c +1 -1
 	return 0;
 }
@@ -1033,7 +1033,7 @@ void gpmc_cs_free(int cs)
 
 	spin_lock(&gpmc_mem_lock);
 	if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
-		printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
+		pr_err("Trying to free non-reserved GPMC CS%d\n", cs);
 		BUG();
 		spin_unlock(&gpmc_mem_lock);
 		return;

cheers,
-roger

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki