mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: cocci@inria.fr, Julia Lawall <Julia.Lawall@inria.fr>,
	kernel-janitors@vger.kernel.org,
	Nicolas Palix <nicolas.palix@imag.fr>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL
Date: Mon, 7 Nov 2022 21:08:15 +0100	[thread overview]
Message-ID: <20221107200815.u7hcwejileeabnct@pengutronix.de> (raw)
In-Reply-To: <bd13da2d-6d18-4f33-0987-a193e3c9b761@web.de>

[-- Attachment #1: Type: text/plain, Size: 3678 bytes --]

On Mon, Nov 07, 2022 at 08:00:33PM +0100, Markus Elfring wrote:
> 
> > devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to
> > the shorter devm_platform_ioremap_resource(pdev, index).
> …
> >  create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci
> …
> > +@depends on patch@
> > +expression pdev,index;
> > +position p != r1.p;
> 
> 
> Why do you think that different source code positions would be required for
> your transformation approach?

That is important that the implementation of
devm_platform_ioremap_resource isn't adapted.

> > +@@
> > +
> > +-  devm_platform_get_and_ioremap_resource@p(pdev, index, NULL)
> > ++  devm_platform_ioremap_resource(pdev, index)
> 
> I suggest to use the following SmPL code variant instead.
> 
> -devm_platform_get_and_ioremap_resource@p
> +devm_platform_ioremap_resource
>  (pdev, index
> - , NULL
>  )

I don't care much, but IMHO my variant is easier to read. Might be
subjective, though.
 
> > +@r2 depends on !patch exists@
> > +expression pdev,index;
> > +position p;
> > +@@
> > +
> > +*  devm_platform_get_and_ioremap_resource@p(pdev, index, NULL)
> 
> 
> I doubt that the usage of the SmPL asterisk is appropriate for the operation
> modes “org” and “report”.

I have no idea about org and report modes. When I try these I get a
python2 error message:

	uwe@taurus:~/gsrc/linux$ make coccicheck
	You have not explicitly specified the mode to use. Using default "report" mode.
	Available modes are the following: patch, report, context, org, chain
	You can specify the mode with "make coccicheck MODE=<mode>"
	Note however that some modes are not implemented by some semantic patches.

	Please check for false positives in the output before submitting a patch.
	When using "patch" mode, carefully review the patch before submitting it.

	/usr/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h --jobs 4 --chunksize 1
	Py.find_library: unable to find the Python library [libpython2.7m.so returned libpython2.7m.so: cannot open shared object file: No such file or directory] [/usr/bin/../lib/libpython2.7m.so returned /usr/bin/../lib/libpython2.7m.so: cannot open shared object file: No such file or directory] [libpython2.7.so returned libpython2.7.so: cannot open shared object file: No such file or directory] [/usr/bin/../lib/libpython2.7.so returned /usr/bin/../lib/libpython2.7.so: cannot open shared object file: No such file or directory]
	coccicheck failed
	make: *** [Makefile:2076: coccicheck] Error 255

After uninstalling python2 this ends in:

	Cannot find Python library
	coccicheck failed
	make: *** [Makefile:2076: coccicheck] Error 255

Didn't try to debug that any further. Is that worth a bug report against
coccinelle (which is shipped by my distribution)?

I tried to adapt the org and report modes from other patches in the same
directory. So a critical glimpse by someone more knowledgable than me is
recommended. However I don't know how to react to "I doubt ... is
appropriate", I'd need a more constructive feedback to act on.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2022-11-07 20:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 11:47 [PATCH v1] " Uwe Kleine-König
2022-11-07 12:45 ` Julia Lawall
2022-11-07 18:11   ` [PATCH v2] " Uwe Kleine-König
2022-11-10 15:07     ` Uwe Kleine-König
     [not found] ` <bd13da2d-6d18-4f33-0987-a193e3c9b761@web.de>
2022-11-07 20:08   ` Uwe Kleine-König [this message]
2022-11-08  5:51     ` [cocci] [PATCH] " Julia Lawall
2022-11-08  7:55       ` Nicolas Palix
2022-11-08  9:54         ` Uwe Kleine-König

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=20221107200815.u7hcwejileeabnct@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=Julia.Lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.palix@imag.fr \
    /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

all inboxes | Powered by JetHome®