Skip to contentSkip to conversation

staging: media: davinci_vpfe: Use __func__ instead of function name

PATCH Superseded Mamta Shukla 2 participants 3 messages Oct 7, 2018

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: media: davinci_vpfe: Use __func__ instead of function name

Access current function name using __func__.
Use %s and __func__ instead of function name.
Predefined identifier __func__ gives the name of current function name. Thus, it gives better debug information in this case.

Issue found with checkpatch.pl

---

change in v2:
-Put useful information above ---

 drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +3 -3
index 9594276..4d09e81 100644
@@ -695,21 +695,21 @@ static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param)
 
 	if (!gamma->bypass_r) {
 		dev_err(dev,
-			"ipipe_get_gamma_params: table ptr empty for R\n");
+			"%s: table ptr empty for R\n", __func__);
 		return -EINVAL;
 	}
 	memcpy(gamma_param->table_r, gamma->table_r,
 	       (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
 
 	if (!gamma->bypass_g) {
-		dev_err(dev, "ipipe_get_gamma_params: table ptr empty for G\n");
+		dev_err(dev, "%s: table ptr empty for G\n", __func__);
 		return -EINVAL;
 	}
 	memcpy(gamma_param->table_g, gamma->table_g,
 	       (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
 
 	if (!gamma->bypass_b) {
-		dev_err(dev, "ipipe_get_gamma_params: table ptr empty for B\n");
+		dev_err(dev, "%s: table ptr empty for B\n", __func__);
 		return -EINVAL;
 	}
 	memcpy(gamma_param->table_b, gamma->table_b,
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Mamta Shukla

Access current function name using __func__.
Use %s and __func__ instead of function name.
Predefined identifier __func__ gives the name of current function name. Thus, it gives better debug information in this case.

Actually, the debug information produced is the same as before. Now, however, the code is more concise and it is more robust, in case the name of the function changes.

julia

Quoted 51 lines

Issue found with checkpatch.pl

---

change in v2:

(quoted diff) +0 -1
-Put useful information above ---
 
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +3 -4
index 9594276..4d09e81 100644
@@ -695,21 +695,21 @@ static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param)
 
 	if (!gamma->bypass_r) {
 		dev_err(dev,
-			"ipipe_get_gamma_params: table ptr empty for R\n");
+			"%s: table ptr empty for R\n", __func__);
 		return -EINVAL;
 	}
 	memcpy(gamma_param->table_r, gamma->table_r,
 	       (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
 
 	if (!gamma->bypass_g) {
-		dev_err(dev, "ipipe_get_gamma_params: table ptr empty for G\n");
+		dev_err(dev, "%s: table ptr empty for G\n", __func__);
 		return -EINVAL;
 	}
 	memcpy(gamma_param->table_g, gamma->table_g,
 	       (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
 
 	if (!gamma->bypass_b) {
-		dev_err(dev, "ipipe_get_gamma_params: table ptr empty for B\n");
+		dev_err(dev, "%s: table ptr empty for B\n", __func__);
 		return -EINVAL;
 	}
 	memcpy(gamma_param->table_b, gamma->table_b,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20181006205400.GA12894%40armorer.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 77 lines · Julia Lawall
Quoted 10 lines · Mamta Shukla

Access current function name using __func__.
Use %s and __func__ instead of function name.
Predefined identifier __func__ gives the name of current function name. Thus, it gives better debug information in this case.

Actually, the debug information produced is the same as before. Now, however, the code is more concise and it is more robust, in case the name of the function changes.

julia

Ok, I will edit the commit message and will revise the patch.

Review

Quoted 13 lines

Issue found with checkpatch.pl

---

change in v2:

(quoted diff) +0 -1
-Put useful information above ---
 
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c

drivers/staging/media/davinci_vpfe/dm365_ipipe.c static int ipipe_get_gamma_params(struct

Quoted 4 lines

index 9594276..4d09e81 100644

drivers/staging/media/davinci_vpfe/dm365_ipipe.c +0 -0
@@ -695,21 +695,21 @@ static int ipipe_get_gamma_params(struct

vpfe_ipipe_device *ipipe, void *param)

drivers/staging/media/davinci_vpfe/dm365_ipipe.c static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param)

Quoted 12 lines
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +1 -2
      if (!gamma->bypass_r) {
              dev_err(dev,
-                     "ipipe_get_gamma_params: table ptr empty for R\n");
+                     "%s: table ptr empty for R\n", __func__);
              return -EINVAL;
      }
      memcpy(gamma_param->table_r, gamma->table_r,
             (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
 
      if (!gamma->bypass_g) {
-             dev_err(dev, "ipipe_get_gamma_params: table ptr empty for

G\n");

drivers/staging/media/davinci_vpfe/dm365_ipipe.c static int ipipe_get_gamma_params(struct vpfe_ipipe_device *ipipe, void *param)

Quoted 8 lines
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +1 -1
+             dev_err(dev, "%s: table ptr empty for G\n", __func__);
              return -EINVAL;
      }
      memcpy(gamma_param->table_g, gamma->table_g,
             (table_size * sizeof(struct vpfe_ipipe_gamma_entry)));
 
      if (!gamma->bypass_b) {
-             dev_err(dev, "ipipe_get_gamma_params: table ptr empty for

B\n");

Quoted 9 lines
drivers/staging/media/davinci_vpfe/dm365_ipipe.c +1 -1
+             dev_err(dev, "%s: table ptr empty for B\n", __func__);
              return -EINVAL;
      }
      memcpy(gamma_param->table_b, gamma->table_b,
--

1.9.1

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

To post to this group, send email to [email protected]. To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/20181006205400.GA12894%40armorer
.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

Signature · 5 lines
Mamta Shukla
Pune Institute  of Computer Technology
Pune
m: 9158516957
e : [email protected]