From: Julia Lawall Date: Mon, 07 Sep 2020 13:46:44 +0000 Subject: =?UTF-8?Q?Re=3A_=5BPATCH=5D_Coccinelle=3A_api=3A_Add_SmPL_scr?= =?UTF-8?Q?ipt_=E2=80=9Cuse=5Fdevm=5F Message-Id: List-Id: References: <25b804fd-0d04-475d-f614-26c03c9fd544@web.de> <5f9fdd59-4b0b-1cb5-c3a2-92efc5bb3841@web.de> <477abcea-e008-e509-d03f-f2753ebdfb20@web.de> <46d314d5-822e-3d73-2d70-015794556e56@web.de> In-Reply-To: <46d314d5-822e-3d73-2d70-015794556e56@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Markus Elfring Cc: kernel-janitors@vger.kernel.org, Michal Marek , Gilles Muller , Dejin Zheng , Nicolas Palix , LKML , Coccinelle > >>>> +@replacement depends on patch@ > >>>> +expression base, device1, device2, index, private, resource; > >>>> +@@ > >>>> +( > >>>> +-resource = platform_get_resource(device1, IORESOURCE_MEM, index); > >>>> + base > >>>> +- devm_ioremap_resource > >>>> ++ devm_platform_get_and_ioremap_resource > >>>> + ( > >>>> +- & > >>>> + device1 > >>>> +- ->dev > >>>> + , > >>>> +- resource > >>>> ++ index, &resource > >>>> + ); > >>>> +| > >>>> +-private->res = platform_get_resource(device1, IORESOURCE_MEM, index); > >>>> + base > >>>> +- devm_ioremap_resource > >>>> ++ devm_platform_get_and_ioremap_resource > >>>> + (device2, > >>> > >>> It is very suspicious that in one case you change the first argument of > >>> devm_platform_get_and_ioremap_resource and in one case you don't. > >> > >> I noticed a few special cases during my source code analysis approach. > > > > This is not a reasonable answer. Does the rule work correctly or not? > > If it doesn't work correctly, it needs to be removed. > > Both source code change patterns from these branches of a SmPL disjunction > work as I would expect it by the current Coccinelle software. > Would you like to clarify any remaining related open issues? In one case the first argument of devm_ioremap_resource has to be changed to produce the first argument of devm_platform_get_and_ioremap_resource and in the other case there is no such change. "work as I would expect" is not a proper explanation of why this is correct. Maybe you can point to some previous commits that have made the change in this way. julia