Messages in this thread | | | Subject | Re: [PATCH 1/2] staging: rtl8188eu: use __func__ in hal directory | From | Joe Perches <> | Date | Thu, 17 Sep 2020 02:25:31 -0700 |
| |
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); } }
| |