linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
Cc: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Brian Norris
	<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Hartley Sweeten
	<hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>,
	Ryan Mallon <rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Sascha Hauer <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Imre Kaloz <kaloz-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>,
	Krzysztof Halasa <khalasa-NlWvg49iv0c@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Alexander Clouter <alex-L4GPcECwBoDe9xe1eoZjHA@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Gregory CLEMENT
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>,
	Haojian Zhuang
	<haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Robert
Subject: Re: [PATCH v2 11/25] coccinelle: nand: detect and correct drivers embedding an mtd_info object
Date: Tue, 1 Dec 2015 13:27:45 +0100	[thread overview]
Message-ID: <20151201132745.2bc1e294@bbrezillon> (raw)
In-Reply-To: <alpine.DEB.2.10.1512011207580.2736@hadrien>

Hi,

On Tue, 1 Dec 2015 12:17:44 +0100 (CET)
Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org> wrote:

> 
> 
> On Tue, 1 Dec 2015, Boris Brezillon wrote:
> 
> > Add nand-priv-no-mtd.cocci to detect and correct NAND controller drivers
> > directly embedding an mtd_info struct in their private struct.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > Cc: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> > ---
> > Hi Julia,
> >
> > Not sure this is the correct way to detect and fix offending drivers,
> > but I get some warnings when launching coccicheck in org or report mode:
> >
> > "warning: fix2: inherited metavariable __chipfield not used in the -, +,
> > or context code"
> >
> > Note that I don't get those warnings when running in patch mode.
> >
> > Any idea (feel free to propose a better solution to detect and fix those
> > offending drivers)?
> 
> Hi,
> 
> Is this code generated with sgen?  If so, could you send me the original
> semantic patch?

Nope, it's been hand written, which might explain the warnings :-/.
Didn't know about sgen, I thought those scripts were all hand written.

> 
> Another thing that is immediately apparent is that you have <... ...> on
> the outside of one of the rules.  This should never be needed.
> 
> The warning suggests that your org and report versions are not doing as
> much as the patch version.  If you have used sgen to generate the semantic
> patch then that would be strange.  If you have hand written the whole
> thing, then maybe you could simplify it to just do the patch version, and
> then I can check it and run sgen on it to make a complete version.

Sure, here it is:

--->8---
virtual patch

@fix1@
identifier __chipfield, __mtdfield;
type __type;
@@
(
	__type {
		...
		struct nand_chip __chipfield;
		...
-		struct mtd_info __mtdfield;
		...
	};
|
	__type {
		...
-		struct mtd_info __mtdfield;
		...
		struct nand_chip __chipfield;
		...
	};
)

@fix2 depends on fix1@
identifier fix1.__chipfield, fix1.__mtdfield;
identifier __subfield;
type fix1.__type;
__type *__priv;
@@
(
-	__priv->__mtdfield.__subfield
+	nand_to_mtd(&__priv->__chipfield)->__subfield
|
-	&(__priv->__mtdfield)
+	nand_to_mtd(&__priv->__chipfield)
)
--->8---

Thanks,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-12-01 12:27 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 11:02 [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1) Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 04/25] mips: nand: make use of mtd_to_nand() where appropriate Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 08/25] staging: mt29f_spinand: make use of mtd_to_nand() Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 10/25] mtd: nand: add nand_to_mtd() helper Boris Brezillon
     [not found] ` <1448967802-25796-1-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-01 11:02   ` [PATCH v2 01/25] ARM: nand: make use of mtd_to_nand() where appropriate Boris Brezillon
2015-12-01 11:02   ` [PATCH v2 02/25] blackfin: " Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 03/25] cris: " Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 05/25] sh: " Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 06/25] mtd: nand: make use of mtd_to_nand() in NAND core code Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 07/25] mtd: nand: make use of mtd_to_nand() in NAND drivers Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 09/25] mtd: nand: embed an mtd_info structure into nand_chip Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 11/25] coccinelle: nand: detect and correct drivers embedding an mtd_info object Boris Brezillon
2015-12-01 11:17     ` Julia Lawall
2015-12-01 12:27       ` Boris Brezillon [this message]
2015-12-01 11:03   ` [PATCH v2 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip Boris Brezillon
     [not found]     ` <1448967802-25796-13-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-01 12:28       ` kbuild test robot
2015-12-01 22:15       ` Brian Norris
2015-12-01 22:21       ` Brian Norris
2015-12-01 11:03   ` [PATCH v2 13/25] mtd: nand: update the documentation to reflect framework changes Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 14/25] staging: mt29f_spinand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 15/25] cris: nand: " Boris Brezillon
2015-12-08  8:35     ` Jesper Nilsson
2015-12-01 11:03   ` [PATCH v2 16/25] mtd: nand: update mtd_to_nand() Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 17/25] mtd: nand: remove useless mtd->priv = chip assignments Boris Brezillon
     [not found]     ` <1448967802-25796-18-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-01 22:17       ` Brian Norris
     [not found]         ` <20151201221747.GB64635-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-12-02  8:53           ` Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 18/25] cris: " Boris Brezillon
2015-12-08  8:32     ` Jesper Nilsson
2015-12-01 11:03   ` [PATCH v2 19/25] staging: mt29f_spinand: remove useless mtd->priv = chip assignment Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 20/25] mtd: nand: simplify nand_dt_init() usage Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 23/25] ARM: make use of nand_set/get_controller_data() helpers Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 24/25] mtd: nand: " Boris Brezillon
2015-12-01 11:03   ` [PATCH v2 25/25] staging: mt29f_spinand: " Boris Brezillon
2015-12-01 13:03   ` [PATCH v3 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-02  8:50   ` [PATCH v3 bis " Boris Brezillon
2015-12-09  0:17     ` Brian Norris
     [not found]       ` <20151209001741.GT120110-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-12-09  8:32         ` Boris Brezillon
2015-12-02  8:51   ` [PATCH v3 17/25] mtd: nand: remove useless mtd->priv = chip assignments Boris Brezillon
2015-12-09  0:36   ` [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1) Brian Norris
     [not found]     ` <20151209003624.GU120110-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-12-09  8:15       ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 21/25] mtd: nand: kill the chip->flash_node field Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 22/25] mtd: nand: add helpers to access ->priv Boris Brezillon

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=20151201132745.2bc1e294@bbrezillon \
    --to=boris.brezillon-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=alex-L4GPcECwBoDe9xe1eoZjHA@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=corbet-T1hC0tSOHrs@public.gmane.org \
    --cc=daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=julia.lawall-L2FTfq7BK8M@public.gmane.org \
    --cc=kaloz-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=khalasa-NlWvg49iv0c@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).