All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Liam Breck <liam@networkimprov.net>
Cc: "Julia Lawall" <julia.lawall@lip6.fr>,
	"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, 5 Sep 2017 22:14:49 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1709052214030.2058@hadrien> (raw)
In-Reply-To: <CAKvHMgRzFpueUccSL1iu_-EazCe76cF8iSAPyYgcxJ3dNOZejA@mail.gmail.com>



On Tue, 5 Sep 2017, Liam Breck wrote:

> Hi Julia, any luck on this?

I was trying to improve the parser, but it seems that my improvements
don't have a sufficient effect so I will try your suggestion of just
seding out the offending code.

julia

>
> On Thu, Aug 31, 2017 at 4:43 AM, Liam Breck <liam@networkimprov.net> wrote:
> > On Thu, Aug 31, 2017 at 4:33 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >>
> >>
> >> On Thu, 31 Aug 2017, Liam Breck wrote:
> >>
> >>> On Thu, Aug 31, 2017 at 2:54 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >>> >
> >>> >
> >>> > On Tue, 29 Aug 2017, Liam Breck wrote:
> >>> >
> >>> >> Coccinelle folks,
> >>> >>
> >>> >> On Tue, Aug 29, 2017 at 5:29 PM, Sebastian Reichel
> >>> >> <sebastian.reichel@collabora.co.uk> wrote:
> >>> >> > Hi,
> >>> >> >
> >>> >> > On Tue, Aug 29, 2017 at 04:07:12PM -0700, Liam Breck wrote:
> >>> >> >> I don't see a Julia in CC list...
> >>> >> >
> >>> >> > <_< let's try that again.
> >>> >> >
> >>> >> >> On Tue, Aug 29, 2017 at 2:22 PM, Sebastian Reichel
> >>> >> >> <sebastian.reichel@collabora.co.uk> wrote:
> >>> >> >> > [adding Julia to Cc for Coccinelle question]
> >>> >> >> >
> >>> >> >> > Hi,
> >>> >> >> >
> >>> >> >> > On Tue, Aug 29, 2017 at 10:31:57AM -0500, Andrew F. Davis wrote:
> >>> >> >> >> On 08/29/2017 05:54 AM, Sebastian Reichel wrote:
> >>> >> >> >> > On Wed, Aug 23, 2017 at 08:36:12PM -0700, Liam Breck wrote:
> >>> >> >> >> >> Overview:
> >>> >> >> >> >> * Reorganizes chip data definitions
> >>> >> >> >> >> * Enables features landed in these patches:
> >>> >> >> >> >>   dt-bindings: power: supply: bq27xxx: Add monitored-battery documentation
> >>> >> >> >> >>   power: supply: bq27xxx: Add chip data memory read/write support
> >>> >> >> >> >>   power: supply: bq27xxx: Add power_supply_battery_info support
> >>> >> >> >> >> * Supports the following chips (only BQ27425 is active)
> >>> >> >> >> >>   BQ27500, 545, 425, 421, 441, 621
> >>> >> >> >> >>
> >>> >> >> >> >> Changes in v3:
> >>> >> >> >> >> * BQ27425 tested; workaround minor chip bug
> >>> >> >> >> >> * Dropped driver_version
> >>> >> >> >> >> * Fixed dbg_dupes logic for .props & .dm_regs
> >>> >> >> >> >> * Dropped two props array dupes
> >>> >> >> >> >>
> >>> >> >> >> >> Changes in v2:
> >>> >> >> >> >> * Added di->opts flags for remaining chip features
> >>> >> >> >> >> * Commented out untested bq27xxx_dm_regs parameters
> >>> >> >> >> >> * Changed dbg_dupes to run only once
> >>> >> >> >> >>
> >>> >> >> >> >> Notes on v1:
> >>> >> >> >> >> * Not fully tested (hence RFC tag)
> >>> >> >> >> >
> >>> >> >> >> > Thanks, full series queued.
> >>> >> >> >> >
> >>> >> >> >> > -- Sebastian
> >>> >> >> >>
> >>> >> >> >> Anyway, I've not got the time to fight these changes anymore, but at
> >>> >> >> >> very least could you drop 4/5, it's static analysis code made into a
> >>> >> >> >> runtime check built into a kernel driver, if not at least add my
> >>> >> >> >> nacked-by. :)
> >>> >> >> >
> >>> >> >> > Since it's not critical at all and nobody depends on it, I dropped 4/5
> >>> >> >> > for now. I agree, that checking it at runtime is not nice. On the other
> >>> >> >> > hand I do think a duplication check makes sense. Doing a static
> >>> >> >> > check should be possible, but I have no idea how to implement this
> >>> >> >> > (without much effort). I suspect Coccinelle can do it, so I added
> >>> >> >> > Julia.
> >>> >> >> >
> >>> >> >> > For reference this is the runtime check:
> >>> >> >> > 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
> >>> >
> >>> > I worked a bit on this, but unfortunately there is a major parsing
> >>> > problem, and most of the definitions are ignored.  Specifically, the
> >>> > definitions of the regs variables are interspersed with eg:
> >>> >
> >>> > #define bq27510g1_regs bq27500_regs
> >>>
> >>> You can transform the macros with sed to either of:
> >>>
> >>> static u8 *bq27510g1_regs = 0 // skip comparison if x == 0
> >>>
> >>> static u8 bq27510g1_regs[BQ27XXX_REG_MAX] = { 0xFF } // skip
> >>> comparison if x[0] == 0xff
> >>>
> >>> Does that help?
> >>
> >> Not quite, because it's really a list of variable declarations, like
> >>
> >> int a, b, c, d;
> >>
> >> The following could be fine:
> >>
> >> *bq27510g1_regs = 0,
> >
> > i forgot about the static u8 at the top of the array set. But yes,
> > just drop static u8 from either of the alternatives I gave.
>

WARNING: multiple messages have this Message-ID (diff)
From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update
Date: Tue, 5 Sep 2017 22:14:49 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1709052214030.2058@hadrien> (raw)
In-Reply-To: <CAKvHMgRzFpueUccSL1iu_-EazCe76cF8iSAPyYgcxJ3dNOZejA@mail.gmail.com>



On Tue, 5 Sep 2017, Liam Breck wrote:

> Hi Julia, any luck on this?

I was trying to improve the parser, but it seems that my improvements
don't have a sufficient effect so I will try your suggestion of just
seding out the offending code.

julia

>
> On Thu, Aug 31, 2017 at 4:43 AM, Liam Breck <liam@networkimprov.net> wrote:
> > On Thu, Aug 31, 2017 at 4:33 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >>
> >>
> >> On Thu, 31 Aug 2017, Liam Breck wrote:
> >>
> >>> On Thu, Aug 31, 2017 at 2:54 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >>> >
> >>> >
> >>> > On Tue, 29 Aug 2017, Liam Breck wrote:
> >>> >
> >>> >> Coccinelle folks,
> >>> >>
> >>> >> On Tue, Aug 29, 2017 at 5:29 PM, Sebastian Reichel
> >>> >> <sebastian.reichel@collabora.co.uk> wrote:
> >>> >> > Hi,
> >>> >> >
> >>> >> > On Tue, Aug 29, 2017 at 04:07:12PM -0700, Liam Breck wrote:
> >>> >> >> I don't see a Julia in CC list...
> >>> >> >
> >>> >> > <_< let's try that again.
> >>> >> >
> >>> >> >> On Tue, Aug 29, 2017 at 2:22 PM, Sebastian Reichel
> >>> >> >> <sebastian.reichel@collabora.co.uk> wrote:
> >>> >> >> > [adding Julia to Cc for Coccinelle question]
> >>> >> >> >
> >>> >> >> > Hi,
> >>> >> >> >
> >>> >> >> > On Tue, Aug 29, 2017 at 10:31:57AM -0500, Andrew F. Davis wrote:
> >>> >> >> >> On 08/29/2017 05:54 AM, Sebastian Reichel wrote:
> >>> >> >> >> > On Wed, Aug 23, 2017 at 08:36:12PM -0700, Liam Breck wrote:
> >>> >> >> >> >> Overview:
> >>> >> >> >> >> * Reorganizes chip data definitions
> >>> >> >> >> >> * Enables features landed in these patches:
> >>> >> >> >> >>   dt-bindings: power: supply: bq27xxx: Add monitored-battery documentation
> >>> >> >> >> >>   power: supply: bq27xxx: Add chip data memory read/write support
> >>> >> >> >> >>   power: supply: bq27xxx: Add power_supply_battery_info support
> >>> >> >> >> >> * Supports the following chips (only BQ27425 is active)
> >>> >> >> >> >>   BQ27500, 545, 425, 421, 441, 621
> >>> >> >> >> >>
> >>> >> >> >> >> Changes in v3:
> >>> >> >> >> >> * BQ27425 tested; workaround minor chip bug
> >>> >> >> >> >> * Dropped driver_version
> >>> >> >> >> >> * Fixed dbg_dupes logic for .props & .dm_regs
> >>> >> >> >> >> * Dropped two props array dupes
> >>> >> >> >> >>
> >>> >> >> >> >> Changes in v2:
> >>> >> >> >> >> * Added di->opts flags for remaining chip features
> >>> >> >> >> >> * Commented out untested bq27xxx_dm_regs parameters
> >>> >> >> >> >> * Changed dbg_dupes to run only once
> >>> >> >> >> >>
> >>> >> >> >> >> Notes on v1:
> >>> >> >> >> >> * Not fully tested (hence RFC tag)
> >>> >> >> >> >
> >>> >> >> >> > Thanks, full series queued.
> >>> >> >> >> >
> >>> >> >> >> > -- Sebastian
> >>> >> >> >>
> >>> >> >> >> Anyway, I've not got the time to fight these changes anymore, but at
> >>> >> >> >> very least could you drop 4/5, it's static analysis code made into a
> >>> >> >> >> runtime check built into a kernel driver, if not at least add my
> >>> >> >> >> nacked-by. :)
> >>> >> >> >
> >>> >> >> > Since it's not critical at all and nobody depends on it, I dropped 4/5
> >>> >> >> > for now. I agree, that checking it at runtime is not nice. On the other
> >>> >> >> > hand I do think a duplication check makes sense. Doing a static
> >>> >> >> > check should be possible, but I have no idea how to implement this
> >>> >> >> > (without much effort). I suspect Coccinelle can do it, so I added
> >>> >> >> > Julia.
> >>> >> >> >
> >>> >> >> > For reference this is the runtime check:
> >>> >> >> > 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
> >>> >
> >>> > I worked a bit on this, but unfortunately there is a major parsing
> >>> > problem, and most of the definitions are ignored.  Specifically, the
> >>> > definitions of the regs variables are interspersed with eg:
> >>> >
> >>> > #define bq27510g1_regs bq27500_regs
> >>>
> >>> You can transform the macros with sed to either of:
> >>>
> >>> static u8 *bq27510g1_regs = 0 // skip comparison if x == 0
> >>>
> >>> static u8 bq27510g1_regs[BQ27XXX_REG_MAX] = { 0xFF } // skip
> >>> comparison if x[0] == 0xff
> >>>
> >>> Does that help?
> >>
> >> Not quite, because it's really a list of variable declarations, like
> >>
> >> int a, b, c, d;
> >>
> >> The following could be fine:
> >>
> >> *bq27510g1_regs = 0,
> >
> > i forgot about the static u8 at the top of the array set. But yes,
> > just drop static u8 from either of the alternatives I gave.
>

  reply	other threads:[~2017-09-05 20:14 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 [this message]
2017-09-05 20:14                         ` 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
2017-09-19 22:36                                   ` [Cocci] " 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=alpine.DEB.2.20.1709052214030.2058@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=afd@ti.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=liam@networkimprov.net \
    --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.