Linux Power Management development
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Sebastian Reichel <sebastian.reichel@collabora.co.uk>,
	kernel-janitors@vger.kernel.org,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.com>,
	cocci@systeme.lip6.fr,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Bastien Nocera <hadess@hadess.net>,
	Stephen Just <stephenjust@gmail.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <lenb@kernel.org>,
	Robert Moore <robert.moore@intel.com>,
	Lv Zheng <lv.zheng@intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	devel@acpica.org, "linux-pm@vger.kernel.org" <linux-p>
Subject: Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu
Date: Tue, 4 Jul 2017 11:53:56 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1707041153160.3346@hadrien> (raw)
In-Reply-To: <CAHp75VdyurjwN+DZQuKnEzNe+XgZwiLLkc0Rg0NvFr=4D2GiQA@mail.gmail.com>



On Tue, 4 Jul 2017, Andy Shevchenko wrote:

> On Tue, Jul 4, 2017 at 12:11 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > Here is a revised version (not a patch because it doesn't support all of
> > the various modes) and the results.  It doesn't return anything beyond
> > what was mentioned in previous mails.
> >
> > For the following code:
> >
> >         ret = i2c_smbus_read_word_data(chip->client, reg << 1);
> >         val[0] = (u16)ret & 0xFF;
> >         val[1] = (u16)ret >> 8;
> >
> > do we want to see:
> >
> > put_unaligned(val,i2c_smbus_read_word_data(chip->client, reg << 1));
>
> If and only if the type of the pointer is a byte type (u8 *, char *,
> or alike) _and_ we try to use it as a provider for 16-bit value (2
> bytes).

OK, the provider part seems to add more complexity than is worth putting
in the rule, so I will let the developer figure out what should be done.

thanks,
julia

      reply	other threads:[~2017-07-04  9:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-01 19:28 [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Julia Lawall
2017-07-03 13:36 ` Sebastian Reichel
2017-07-03 16:37   ` Andy Shevchenko
2017-07-03 17:14     ` Sebastian Reichel
2017-07-03 17:33       ` Andy Shevchenko
2017-07-03 18:20         ` Sebastian Reichel
2017-07-04  9:11           ` Julia Lawall
2017-07-04  9:51             ` Andy Shevchenko
2017-07-04  9:53               ` Julia Lawall [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=alpine.DEB.2.20.1707041153160.3346@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=andy.shevchenko@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=devel@acpica.org \
    --cc=hadess@hadess.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mmarek@suse.com \
    --cc=nicolas.palix@imag.fr \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=sebastian.reichel@collabora.co.uk \
    --cc=stephenjust@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