media: atomisp: ov2722: replace hardcoded function name
Subsystems (5)
PATCH 1/1 media: atomisp: ov2722: replace hardcoded function name
There is a debug message using hardcoded function name instead of the __func__ macro. Replace it.
Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...", __func__' to using 'ov2722_remove', this function's name, in a string
+ dev_dbg(&client->dev, "ov2722_remove...\n");
--- drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1 -1
@@ -1175,7 +1175,7 @@ static int ov2722_remove(struct i2c_client *client)struct v4l2_subdev *sd =i2c_get_clientdata (client);struct ov2722_device *dev =to_ov2722_sensor (sd); -dev_dbg (&client->dev,"ov2722_remove...\n" ); +dev_dbg (&client->dev,"%s...\n" , __func__); dev->platform_data->csi_cfg (sd,0 );v4l2_ctrl_handler_free (&dev->ctrl_handler);
Signature · 1 line
2.30.0
Greg Kroah-Hartman
maintainerQuoted 18 lines · Filip Kolev
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");Signed-off-by Filip Kolev <[email protected]>--- drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +0
-0
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c static int ov2722_remove(struct i2c_client *client) · line 1178
Quoted 5 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1
-1@@ -1175,7 +1175,7 @@ static int ov2722_remove(struct i2c_client *client)struct v4l2_subdev *sd =i2c_get_clientdata (client);struct ov2722_device *dev =to_ov2722_sensor (sd); -dev_dbg (&client->dev,"ov2722_remove...\n" ); +dev_dbg (&client->dev,"%s...\n" , __func__);
dev_dbg() provides the function name already, and this is just a "trace" call, and ftrace should be used instead, so the whole line should be removed entirely.
thanks,
greg k-h
Quoted 22 lines · Greg Kroah-Hartman
Quoted 21 lines · Filip Kolev
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");Signed-off-by Filip Kolev <[email protected]>--- drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +0
-0@@ -1175,7 +1175,7 @@ static int ov2722_remove(struct i2c_client *client)struct v4l2_subdev *sd =i2c_get_clientdata (client);struct ov2722_device *dev =to_ov2722_sensor (sd);
Quoted 6 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c static int ov2722_remove(struct i2c_client *client) · line 1178
Quoted 2 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1
-1-dev_dbg (&client->dev,"ov2722_remove...\n" ); +dev_dbg (&client->dev,"%s...\n" , __func__);
dev_dbg()provides the function name already, and this is just a "trace" call, and ftrace should be used instead, so the whole line should be removed entirely.
Thank you for the review!
How do I go about this? Do I amend the patch and re-send as v2 or create a new patch entirely? Newbie here, doing this as part of the Eudyptula challenge, so I very much appreciate everyone's patience.
Quoted 5 lines
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 31 lines · Filip Kolev
Quoted 14 lines · Greg Kroah-Hartman
Quoted 13 lines · Filip Kolev
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");Signed-off-by Filip Kolev <[email protected]>--- drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c static int ov2722_remove(struct i2c_client *client) · line 1177
Quoted 9 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1
-1@@ -1175,7 +1175,7 @@ static int ov2722_remove(struct i2c_client *client)struct v4l2_subdev *sd =i2c_get_clientdata (client);struct ov2722_device *dev =to_ov2722_sensor (sd); -dev_dbg (&client->dev,"ov2722_remove...\n" ); +dev_dbg (&client->dev,"%s...\n" , __func__);
dev_dbg()provides the function name already, and this is just a "trace" call, and ftrace should be used instead, so the whole line should be removed entirely.
Quoted 4 lines
Thank you for the review!
How do I go about this? Do I amend the patch and re-send as v2 or create a new patch entirely?
New patch entirely please.
thanks,
greg k-h
Joe Perches
maintainerQuoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Filip Kolev
Quoted 8 lines · Greg Kroah-Hartman
Review
Quoted 7 lines · Filip Kolev
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");
[]
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
Quoted 1 line
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +0
-0
[]
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c static int ov2722_remove(struct i2c_client *client) · line 1177
Quoted 5 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1
-1@@ -1175,7 +1175,7 @@ static int ov2722_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); struct ov2722_device *dev = to_ov2722_sensor(sd); -dev_dbg (&client->dev,"ov2722_remove...\n" ); +dev_dbg (&client->dev,"%s...\n" , __func__);
dev_dbg()provides the function name already, and this is just a "trace" call, and ftrace should be used instead, so the whole line should be removed entirely.
Quoted 6 lines
Quoted 4 lines
Thank you for the review!
How do I go about this? Do I amend the patch and re-send as v2 or create a new patch entirely?
New patch entirely please.
There are quite a lot of these relatively useless function tracing like uses in the kernel:
$ git grep -P '"%s[\.\!]*\\n"\s*,\s*__func__\s*\)' | wc -l 1065
Perhaps yet another checkpatch warning would be useful:
--- scripts/checkpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
scripts/checkpatch.pl +8 -0
@@ -5981,6 +5981,14 @@ sub process { "Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a string\n" . $herecurr); } +# check for unnecessary function tracing like uses + if ($rawline =~ /^\+\s*$logFunctions\s*\([^"]*"%s[\.\!]*\\n"\s*,\s*__func__\s*\)\s*;\s*$/) { + if (WARN("TRACING_LOGGING", + "Unnecessary ftrace-like logging - prefer using ftrace\n" . $herecurr) && + $fix) { + fix_delete_line($fixlinenr, $rawline); + } + } # check for spaces before a quoted newline if ($rawline =~ /^.*\".*\s\\n/) { if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",
Quoted 29 lines · Joe Perches
Quoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Filip Kolev
Quoted 8 lines · Greg Kroah-Hartman
Review
Quoted 7 lines · Filip Kolev
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");[]
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
Quoted 1 line
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +0
-0[]
Quoted 15 lines
Quoted 14 lines
Quoted 9 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c static int ov2722_remove(struct i2c_client *client) · line 1177
Quoted 5 lines
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1
-1@@ -1175,7 +1175,7 @@ static int ov2722_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); struct ov2722_device *dev = to_ov2722_sensor(sd); -dev_dbg (&client->dev,"ov2722_remove...\n" ); +dev_dbg (&client->dev,"%s...\n" , __func__);
dev_dbg()provides the function name already, and this is just a "trace" call, and ftrace should be used instead, so the whole line should be removed entirely.Thank you for the review!
How do I go about this? Do I amend the patch and re-send as v2 or create a new patch entirely?
Quoted 7 lines
Quoted 1 line
New patch entirely please.
There are quite a lot of these relatively useless function tracing like uses in the kernel:
$ git grep -P '"%s[\.\!]*\\n"\s*,\s*__func__\s*\)' | wc -l 1065
These are printing other stuff besides just the function name. Maybe grep for '", __func__\)'?
regards,
dan carpenter
Joe Perches
maintainerQuoted 4 lines · Dan Carpenter
Quoted 3 lines · Joe Perches
Quoted 2 lines · Greg Kroah-Hartman
Quoted 1 line · Filip Kolev
On 06-Jan-21 09:51, Greg Kroah-Hartman wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Filip Kolev
Review
Quoted 7 lines
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");
[]
Quoted 7 lines
Quoted 5 lines
There are quite a lot of these relatively useless function tracing like uses in the kernel:
$ git grep -P '"%s[\.\!]*\\n"\s*,\s*__func__\s*\)' | wc -l 1065These are printing other stuff besides just the function name.
No, these are printing _only_ the function name.
Quoted 1 line
Maybe grep for '", __func__\)'?
No, that wouldn't work as there are many many uses like:
printk('%s: some string\n", __func__);Quoted 17 lines · Joe Perches
Quoted 4 lines · Dan Carpenter
Quoted 3 lines · Joe Perches
Quoted 2 lines · Greg Kroah-Hartman
Quoted 1 line · Filip Kolev
On 06-Jan-21 09:51, Greg Kroah-Hartman wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Filip Kolev
Review
Quoted 7 lines
There is a debug message using hardcoded function name instead of the
__func__macro. Replace it.Report from checkpatch.pl on the file:
WARNING: Prefer using '"%s...",
__func__' to using 'ov2722_remove', this function's name, in a string(quoted diff) +1
-0+ dev_dbg(&client->dev, "ov2722_remove...\n");[]
Quoted 3 lines
Quoted 3 lines
There are quite a lot of these relatively useless function tracing like uses in the kernel:
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
$ git grep -P '"%s[\.\!]*\\n"\s*,\s*__func__\s*\)' | wc -l 1065These are printing other stuff besides just the function name.
No, these are printing _only_ the function name.
Oh... Duh... I was looking at the complete wrong output. My bad.
Yeah. I like this warning.
regards,
dan carpenter
Joe Perches
maintainerPATCH 1/1 checkpatch: Prefer ftrace over function entry/exit printks
Prefer using ftrace over function entry/exit logging messages.
Warn with various function entry/exit only logging that only use __func__ with or without descriptive decoration.
--- scripts/checkpatch.pl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
scripts/checkpatch.pl +35 -0
@@ -507,6 +507,30 @@ our $signature_tags = qr{(?xi: Cc: )}; +our $tracing_logging_tags = qr{(?xi: + [=-]*> | + <[=-]* | + \[ | + \] | + start | + called | + entered | + entry | + enter | + in | + inside | + here | + begin | + exit | + end | + done | + leave | + completed | + out | + return | + [\.\!:\s]* +)}; + sub edit_distance_min { my (@arr) = @_; my $len = scalar @arr;
@@ -5981,6 +6005,17 @@ sub process { "Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a string\n" . $herecurr); } +# check for unnecessary function tracing like uses +# This does not use $logFunctions because there are many instances like +# 'dprintk(FOO, "%s()\n", __func__);' which do not match $logFunctions + if ($rawline =~ /^\+.*\([^"]*"$tracing_logging_tags{0,3}%s(?:\s*\(\s*\)\s*)?$tracing_logging_tags{0,3}(?:\\n)?"\s*,\s*__func__\s*\)\s*;/) { + if (WARN("TRACING_LOGGING", + "Unnecessary ftrace-like logging - prefer using ftrace\n" . $herecurr) && + $fix) { + fix_delete_line($fixlinenr, $rawline); + } + } + # check for spaces before a quoted newline if ($rawline =~ /^.*\".*\s\\n/) { if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",