linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wen Yang <wenyang@linux.alibaba.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	cocci@systeme.lip6.fr, kernel-janitors@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"Gilles Muller" <Gilles.Muller@lip6.fr>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Julia Lawall" <Julia.Lawall@lip6.fr>,
	"Masahiro Yamada" <yamada.masahiro@socionext.com>,
	"Matthias Männich" <maennich@google.com>,
	"Michal Marek" <michal.lkml@markovi.net>,
	"Nicolas Palix" <nicolas.palix@imag.fr>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH v3] coccinelle: semantic patch to check for inappropriate do_div() calls
Date: Sat, 11 Jan 2020 13:06:34 +0800	[thread overview]
Message-ID: <c4ada2f2-19b0-91ef-ddf3-a1999f4209ea@linux.alibaba.com> (raw)
In-Reply-To: <91abb141-57b8-7659-25ec-8080e290d846@web.de>



On 2020/1/11 12:35 上午, Markus Elfring wrote:
>> +@initialize:python@
> …
>> +def filter_out_safe_constants(str):
> …
>> +def construct_warnings(str, suggested_fun):
> 
> * I suggest once more to adjust the dependency specifications for the usage
>    of these functions by SmPL rules.
> 

Most of the functions here are for all operation modes.


> * Can the local variable “msg” be omitted?
> 
> 
>> +coccilib.org.print_todo(p[0], construct_warnings("div64_ul"))
> 
> I suggest again to move the prefix “div64_” into the string literal
> of the function implementation.
> 

“div64_ul” indicates the function name we recommend.
As shown in the patch:

+def construct_warnings(suggested_fun):
+    msg="WARNING: do_div() does a 64-by-32 division, please consider 
using %s instead."
+    return  msg % suggested_fun
...
+coccilib.org.print_todo(p[0], construct_warnings("div64_ul"))

If we delete the prefix "div64_", it may reduce readability.

> 
> The SmPL code for two disjunctions could become shorter.
> 

You may suggest to modify it as follows:
+@@
+*do_div(f, \( l \| ul \| ul64 \| sl64 \) );

We agree with Julia:
I don't se any point to this.  The code matched will be the same in both
cases.  The original code is quite readable, without the ugly \( etc.

--
Regards,
Wen

> Regards,
> Markus
> 

  reply	other threads:[~2020-01-11  5:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 13:15 [PATCH v3] coccinelle: semantic patch to check for inappropriate do_div() calls Wen Yang
2020-01-10 16:35 ` Markus Elfring
2020-01-11  5:06   ` Wen Yang [this message]
2020-01-11  7:30     ` [v3] " Markus Elfring
2020-01-11  7:44       ` Julia Lawall
2020-01-11  8:03         ` Markus Elfring
2020-01-11 15:36 ` [PATCH v3] " Julia Lawall
2020-01-12  8:30 ` Markus Elfring
2020-01-12  8:42   ` Julia Lawall
2020-01-12  8:49     ` [v3] " Markus Elfring

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=c4ada2f2-19b0-91ef-ddf3-a1999f4209ea@linux.alibaba.com \
    --to=wenyang@linux.alibaba.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=tglx@linutronix.de \
    --cc=yamada.masahiro@socionext.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).