From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liam Breck Subject: Re: [PATCH v3 0/5] bq27xxx_battery data memory update Date: Wed, 20 Sep 2017 02:57:12 -0700 Message-ID: References: <20170824033617.20840-1-liam@networkimprov.net> <20170830002939.ns43wldvffmwqhuv@earth> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from mail-it0-f51.google.com ([209.85.214.51]:52047 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751590AbdITJ5N (ORCPT ); Wed, 20 Sep 2017 05:57:13 -0400 Received: by mail-it0-f51.google.com with SMTP id o200so2455121itg.0 for ; Wed, 20 Sep 2017 02:57:13 -0700 (PDT) In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Julia Lawall Cc: Sebastian Reichel , Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, "Andrew F. Davis" , =?UTF-8?Q?Pali_Roh=C3=A1r?= , Linux PM mailing list On Wed, Sep 20, 2017 at 2:45 AM, Julia Lawall wrote: >> > Also, Coccinelle is comparing the list, but I guess you would prefer that >> > it compare the set, to check for the cases where the names are the same >> > but appear in a different order. >> >> Yes, ideally it would sort arrays before doing compare. Is that doable? > > Yes. > >> >> >> >> >> > 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 >> >> We can just write >> "%s & %s are identical" > > OK. > > But just to check, there are three fields of interest: regs, dm_regs and > props. If for two entries regs are the same but dm_regs and props are > different, you still want a warning about regs, right? This is the > behavior that seemed to be in the C code and is what I have implemented. > Or do you want a warning only if all three are the same. Each set of arrays is independent, so what you have is correct. From mboxrd@z Thu Jan 1 00:00:00 1970 From: liam@networkimprov.net (Liam Breck) Date: Wed, 20 Sep 2017 02:57:12 -0700 Subject: [Cocci] [PATCH v3 0/5] bq27xxx_battery data memory update In-Reply-To: References: <20170824033617.20840-1-liam@networkimprov.net> <20170830002939.ns43wldvffmwqhuv@earth> Message-ID: To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr On Wed, Sep 20, 2017 at 2:45 AM, Julia Lawall wrote: >> > Also, Coccinelle is comparing the list, but I guess you would prefer that >> > it compare the set, to check for the cases where the names are the same >> > but appear in a different order. >> >> Yes, ideally it would sort arrays before doing compare. Is that doable? > > Yes. > >> >> >> >> >> > 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 >> >> We can just write >> "%s & %s are identical" > > OK. > > But just to check, there are three fields of interest: regs, dm_regs and > props. If for two entries regs are the same but dm_regs and props are > different, you still want a warning about regs, right? This is the > behavior that seemed to be in the C code and is what I have implemented. > Or do you want a warning only if all three are the same. Each set of arrays is independent, so what you have is correct.