All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Breck <liam@networkimprov.net>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: "Sebastian Reichel" <sebastian.reichel@collabora.co.uk>,
	"Gilles Muller" <Gilles.Muller@lip6.fr>,
	"Nicolas Palix" <nicolas.palix@imag.fr>,
	"Michal Marek" <mmarek@suse.com>,
	cocci@systeme.lip6.fr, "Andrew F. Davis" <afd@ti.com>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Linux PM mailing list" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v3 0/5] bq27xxx_battery data memory update
Date: Tue, 19 Sep 2017 15:36:28 -0700	[thread overview]
Message-ID: <CAKvHMgTF8C+7xcO31MvVeepCmSiP4V6tvvC4uVfcA4_JAfFHsw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1709192355160.2518@hadrien>

On Tue, Sep 19, 2017 at 3:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Tue, 19 Sep 2017, Liam Breck wrote:
>
>> Hi Julia,
>>
>> I think Sebastian referred this to you in hopes of receiving a script
>> that would find duplicate arrays, similarly to the way
>> bq27xxx_battery_dbg_dupes does in the running code. Did you interpret
>> his request differently?
>>
>> bq27xxx_battery_dbg_dupes:
>> https://patchwork.kernel.org/patch/9918953/
>>
>> The data structures being checked start here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/tree/drivers/power/supply/bq27xxx_battery.c?h=for-next#n138
>>
>> And are aggregated here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/tree/drivers/power/supply/bq27xxx_battery.c?h=for-next#n743
>>
>> The defines can be sed'd to pointers with 0 value, and array
>> comparisons where 1 pointer is 0 can be skipped.
>
> I followed the spirit of the runtime testing code.  But Coccinelle doesn't
> normally unfold the definitions of macros.  All it can do is take the
> different lists of fields and see if they are textually the same.

There's no need to unfold macros. If you did, you would get false
positives. You do need to skip them somehow, hence the idea of sed'ing
to null pointers.

> I've attached the script and some fake data that I made to test it.  The
> fake data has some added cases where I have replaced 27 in the structure
> name by 07.  For my test data I get:
>
> bq07421_regs and bq27421_regs have the same registers
> bq07000_regs and bq27000_regs have the same registers
> bq07421_dm_regs and bq27421_dm_regs have the same registers
> bq07421_props and bq27421_props have the same properties
> bq07000_props and bq27000_props have the same properties
>
> You won't get this currently; I needed to make some improvements to the
> Coccinelle C code parser.

I didn't see anything attached, script or data.

The script should compare each object with only those objects that
follow it in sequence, so it doesn't repeat comparisons or compare to
self.

WARNING: multiple messages have this Message-ID (diff)
From: liam@networkimprov.net (Liam Breck)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update
Date: Tue, 19 Sep 2017 15:36:28 -0700	[thread overview]
Message-ID: <CAKvHMgTF8C+7xcO31MvVeepCmSiP4V6tvvC4uVfcA4_JAfFHsw@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1709192355160.2518@hadrien>

On Tue, Sep 19, 2017 at 3:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Tue, 19 Sep 2017, Liam Breck wrote:
>
>> Hi Julia,
>>
>> I think Sebastian referred this to you in hopes of receiving a script
>> that would find duplicate arrays, similarly to the way
>> bq27xxx_battery_dbg_dupes does in the running code. Did you interpret
>> his request differently?
>>
>> bq27xxx_battery_dbg_dupes:
>> https://patchwork.kernel.org/patch/9918953/
>>
>> The data structures being checked start here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/tree/drivers/power/supply/bq27xxx_battery.c?h=for-next#n138
>>
>> And are aggregated here:
>> https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git/tree/drivers/power/supply/bq27xxx_battery.c?h=for-next#n743
>>
>> The defines can be sed'd to pointers with 0 value, and array
>> comparisons where 1 pointer is 0 can be skipped.
>
> I followed the spirit of the runtime testing code.  But Coccinelle doesn't
> normally unfold the definitions of macros.  All it can do is take the
> different lists of fields and see if they are textually the same.

There's no need to unfold macros. If you did, you would get false
positives. You do need to skip them somehow, hence the idea of sed'ing
to null pointers.

> I've attached the script and some fake data that I made to test it.  The
> fake data has some added cases where I have replaced 27 in the structure
> name by 07.  For my test data I get:
>
> bq07421_regs and bq27421_regs have the same registers
> bq07000_regs and bq27000_regs have the same registers
> bq07421_dm_regs and bq27421_dm_regs have the same registers
> bq07421_props and bq27421_props have the same properties
> bq07000_props and bq27000_props have the same properties
>
> You won't get this currently; I needed to make some improvements to the
> Coccinelle C code parser.

I didn't see anything attached, script or data.

The script should compare each object with only those objects that
follow it in sequence, so it doesn't repeat comparisons or compare to
self.

  reply	other threads:[~2017-09-19 22:36 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  3:36 [PATCH v3 0/5] bq27xxx_battery data memory update Liam Breck
2017-08-24  3:36 ` [PATCH v3 1/5] power: supply: bq27xxx: Create single chip data table Liam Breck
2017-08-24  3:36 ` [PATCH v3 2/5] power: supply: bq27xxx: Add chip IDs for previously shadowed chips Liam Breck
2017-08-24  3:36 ` [PATCH v3 3/5] power: supply: bq27xxx: Enable data memory update for certain chips Liam Breck
2017-08-24  3:36 ` [PATCH v3 4/5] power: supply: bq27xxx: Flag identical chip data when in debug mode Liam Breck
2017-08-24  3:36 ` [PATCH v3 5/5] power: supply: bq27xxx: Remove duplicate chip data arrays Liam Breck
2017-08-29 10:54 ` [PATCH v3 0/5] bq27xxx_battery data memory update Sebastian Reichel
2017-08-29 15:31   ` Andrew F. Davis
2017-08-29 21:22     ` Sebastian Reichel
2017-08-29 23:07       ` Liam Breck
2017-08-30  0:29         ` Sebastian Reichel
2017-08-30  0:29           ` [Cocci] " Sebastian Reichel
2017-08-30  1:14           ` Liam Breck
2017-08-30  1:14             ` [Cocci] " Liam Breck
2017-08-30  6:01             ` Julia Lawall
2017-08-30  6:01               ` [Cocci] " Julia Lawall
2017-08-31  9:54             ` Julia Lawall
2017-08-31  9:54               ` [Cocci] " Julia Lawall
2017-08-31 11:01               ` Liam Breck
2017-08-31 11:01                 ` [Cocci] " Liam Breck
2017-08-31 11:33                 ` Julia Lawall
2017-08-31 11:33                   ` [Cocci] " Julia Lawall
2017-08-31 11:43                   ` Liam Breck
2017-08-31 11:43                     ` [Cocci] " Liam Breck
2017-09-05 19:15                     ` Liam Breck
2017-09-05 19:15                       ` [Cocci] " Liam Breck
2017-09-05 20:14                       ` Julia Lawall
2017-09-05 20:14                         ` [Cocci] " Julia Lawall
2017-09-18  0:45                         ` Liam Breck
2017-09-18  0:45                           ` [Cocci] " Liam Breck
2017-09-18  5:33                           ` Julia Lawall
2017-09-18  5:33                             ` [Cocci] " Julia Lawall
2017-09-19 21:47                             ` Liam Breck
2017-09-19 21:47                               ` [Cocci] " Liam Breck
2017-09-19 22:00                               ` Julia Lawall
2017-09-19 22:00                                 ` [Cocci] " Julia Lawall
2017-09-19 22:36                                 ` Liam Breck [this message]
2017-09-19 22:36                                   ` Liam Breck
2017-09-20  9:14                                   ` Julia Lawall
2017-09-20  9:14                                     ` [Cocci] " Julia Lawall
2017-09-20  9:41                                     ` Liam Breck
2017-09-20  9:41                                       ` [Cocci] " Liam Breck
2017-09-20  9:45                                       ` Julia Lawall
2017-09-20  9:45                                         ` [Cocci] " Julia Lawall
2017-09-20  9:57                                         ` Liam Breck
2017-09-20  9:57                                           ` [Cocci] " Liam Breck
2017-09-27 10:02                                       ` Julia Lawall
2017-09-27 10:02                                         ` [Cocci] " Julia Lawall
2017-09-27 12:02                                         ` Liam Breck
2017-09-27 12:02                                           ` [Cocci] " Liam Breck
2017-09-27 12:16                                           ` Julia Lawall
2017-09-27 12:16                                             ` [Cocci] " Julia Lawall
2017-09-27 12:46                                             ` Liam Breck
2017-09-27 12:46                                               ` [Cocci] " Liam Breck
2017-10-01 11:59                                               ` Julia Lawall
2017-10-01 11:59                                                 ` [Cocci] " Julia Lawall
2017-09-27 13:12                                         ` Liam Breck
2017-09-27 13:12                                           ` [Cocci] " Liam Breck
2017-09-27 13:25                                           ` Julia Lawall
2017-09-27 13:25                                             ` [Cocci] " Julia Lawall
2017-09-27 13:25                                           ` Julia Lawall
2017-09-27 13:25                                             ` [Cocci] " Julia Lawall
2017-08-29 22:29     ` Liam Breck

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=CAKvHMgTF8C+7xcO31MvVeepCmSiP4V6tvvC4uVfcA4_JAfFHsw@mail.gmail.com \
    --to=liam@networkimprov.net \
    --cc=Gilles.Muller@lip6.fr \
    --cc=afd@ti.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-pm@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=nicolas.palix@imag.fr \
    --cc=pali.rohar@gmail.com \
    --cc=sebastian.reichel@collabora.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.