From: Joe Perches <joe@perches.com>
To: Michael Straube <straube.linux@gmail.com>, gregkh@linuxfoundation.org
Cc: Larry.Finger@lwfinger.net, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] staging: rtl8188eu: use __func__ in hal directory
Date: Thu, 17 Sep 2020 02:25:31 -0700 [thread overview]
Message-ID: <5341538083077360205d50683ac2f3df22cfa72a.camel@perches.com> (raw)
In-Reply-To: <20200917071330.31740-1-straube.linux@gmail.com>
On Thu, 2020-09-17 at 09:13 +0200, Michael Straube wrote:
> Use __func__ instead of hardcoded function names to clear
> checkpatch warnings.
[]
> diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c
[]
> @@ -249,7 +249,7 @@ void odm_CommonInfoSelfUpdate(struct odm_dm_struct *pDM_Odm)
>
> void odm_CmnInfoInit_Debug(struct odm_dm_struct *pDM_Odm)
> {
> - ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug==>\n"));
> + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("%s==>\n", __func__));
> ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportPlatform=%d\n", pDM_Odm->SupportPlatform));
> ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportAbility=0x%x\n", pDM_Odm->SupportAbility));
> ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportInterface=%d\n", pDM_Odm->SupportInterface));
These ODM_RT_TRACE macro uses are rather ugly.
Perhaps a rename to odm_dbg would be better.
So would removing the unnecessary parentheses from
the macro uses and fixing the macro definition
Maybe using a perl script something like the below:
our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;
sub deparenthesize {
my ($string) = @_;
return "" if (!defined($string));
while ($string =~ /^\s*\(.*\)\s*$/s) {
$string =~ s@^\s*\(\s*@@s;
$string =~ s@\s*\)\s*$@@s;
}
return $string;
}
foreach my $file (@ARGV) {
my $FILE;
my $count;
open($FILE, '<', $file) or die("Can't read $file $!\n");
undef $/;
my $text = (<$FILE>);
close($FILE);
$count = $text =~ s/ODM_RT_TRACE\s*\(\s*([^,]*),\s*ODM_COMP_(\w+)\s*,\s*ODM_DBG_(\w+)\s*,\s*($balanced_parens)\s*\)\s*;/"odm_dbg($1, $2, $3, " . deparenthesize($4) . ");"/ge;
if ($count > 0) {
open($FILE, '>', $file) or die("Can't write $file $!\n");
print $FILE $text;
close($FILE);
}
}
prev parent reply other threads:[~2020-09-17 9:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 7:13 [PATCH 1/2] staging: rtl8188eu: use __func__ in hal directory Michael Straube
2020-09-17 7:13 ` [PATCH 2/2] staging: rtl8188eu: clean up comparsion style issues Michael Straube
2020-09-17 9:25 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5341538083077360205d50683ac2f3df22cfa72a.camel@perches.com \
--to=joe@perches.com \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).