From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B8DDC433DB for ; Wed, 6 Jan 2021 18:26:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49B3E23133 for ; Wed, 6 Jan 2021 18:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbhAFS0L (ORCPT ); Wed, 6 Jan 2021 13:26:11 -0500 Received: from smtprelay0122.hostedemail.com ([216.40.44.122]:46328 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725789AbhAFS0K (ORCPT ); Wed, 6 Jan 2021 13:26:10 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id 48EF11730875; Wed, 6 Jan 2021 18:25:29 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: stick86_3e0252b274e3 X-Filterd-Recvd-Size: 3649 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Wed, 6 Jan 2021 18:25:27 +0000 (UTC) Message-ID: Subject: Re: [PATCH] media: atomisp: ov2722: replace hardcoded function name From: Joe Perches To: Greg Kroah-Hartman , Filip Kolev Cc: devel@driverdev.osuosl.org, Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Sakari Ailus , linux-media@vger.kernel.org, Andrew Morton Date: Wed, 06 Jan 2021 10:25:26 -0800 In-Reply-To: References: <20210105202945.26913-1-fil.kolev@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-01-06 at 18:52 +0100, Greg Kroah-Hartman wrote: > On Wed, Jan 06, 2021 at 07:43:42PM +0200, Filip Kolev wrote: > > On 06-Jan-21 09:51, Greg Kroah-Hartman wrote: > > > On Tue, Jan 05, 2021 at 10:29:18PM +0200, Filip Kolev wrote: > > > > 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"); [] > > > > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c [] > > > > @@ -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? > > 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(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e6857bdfcb2d..46b8ec8fe9e1 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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",