mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 4/4] coccinelle: api: add spatch to prevent unnecessary .owner
Date: Tue, 28 Oct 2014 21:58:05 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1410282157510.2090@localhost6.localdomain6> (raw)
In-Reply-To: <1414514443-28943-5-git-send-email-wsa@the-dreams.de>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

On Tue, 28 Oct 2014, Wolfram Sang wrote:

> There are calls which silently set the owner of a module. This is the
> preferred way [1], so avoid setting it manually. Currently, we only care
> about platform drivers, but there might be more calls to be added later.
> 
> [1] https://lkml.org/lkml/2014/10/12/87
> 
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> ---
>  scripts/coccinelle/api/platform_no_drv_owner.cocci | 106 +++++++++++++++++++++
>  1 file changed, 106 insertions(+)
>  create mode 100644 scripts/coccinelle/api/platform_no_drv_owner.cocci
> 
> diff --git a/scripts/coccinelle/api/platform_no_drv_owner.cocci b/scripts/coccinelle/api/platform_no_drv_owner.cocci
> new file mode 100644
> index 000000000000..e065b9e714fc
> --- /dev/null
> +++ b/scripts/coccinelle/api/platform_no_drv_owner.cocci
> @@ -0,0 +1,106 @@
> +/// Remove .owner field if calls are used which set it automatically
> +///
> +// Confidence: High
> +// Copyright: (C) 2014 Wolfram Sang. GPL v2.
> +
> +virtual patch
> +virtual context
> +virtual org
> +virtual report
> +
> +@match1@
> +declarer name module_platform_driver;
> +declarer name module_platform_driver_probe;
> +identifier __driver;
> +@@
> +(
> +	module_platform_driver(__driver);
> +|
> +	module_platform_driver_probe(__driver, ...);
> +)
> +
> +@fix1 depends on match1 && patch && !context && !org && !report@
> +identifier match1.__driver;
> +@@
> +	static struct platform_driver __driver = {
> +		.driver = {
> +-			.owner = THIS_MODULE,
> +		}
> +	};
> +
> +@match2@
> +identifier __driver;
> +@@
> +(
> +	platform_driver_register(&__driver)
> +|
> +	platform_driver_probe(&__driver, ...)
> +|
> +	platform_create_bundle(&__driver, ...)
> +)
> +
> +@fix2 depends on match2 && patch && !context && !org && !report@
> +identifier match2.__driver;
> +@@
> +	static struct platform_driver __driver = {
> +		.driver = {
> +-			.owner = THIS_MODULE,
> +		}
> +	};
> +
> +// ----------------------------------------------------------------------------
> +
> +@fix1_context depends on match1 && !patch && (context || org || report)@
> +identifier match1.__driver;
> +position j0;
> +@@
> +
> + 	static struct platform_driver __driver = {
> +		.driver = {
> +*			.owner@j0 = THIS_MODULE,
> +		}
> +	};
> +
> +@fix2_context depends on match2 && !patch && (context || org || report)@
> +identifier match2.__driver;
> +position j0;
> +@@
> +
> + 	static struct platform_driver __driver = {
> +		.driver = {
> +*			.owner@j0 = THIS_MODULE,
> +		}
> +	};
> +
> +// ----------------------------------------------------------------------------
> +
> +@script:python fix1_org depends on org@
> +j0 << fix1_context.j0;
> +@@
> +
> +msg = "No need to set .owner here. The core will do it."
> +coccilib.org.print_todo(j0[0], msg)
> +
> +@script:python fix2_org depends on org@
> +j0 << fix2_context.j0;
> +@@
> +
> +msg = "No need to set .owner here. The core will do it."
> +coccilib.org.print_todo(j0[0], msg)
> +
> +// ----------------------------------------------------------------------------
> +
> +@script:python fix1_report depends on report@
> +j0 << fix1_context.j0;
> +@@
> +
> +msg = "No need to set .owner here. The core will do it."
> +coccilib.report.print_report(j0[0], msg)
> +
> +@script:python fix2_report depends on report@
> +j0 << fix2_context.j0;
> +@@
> +
> +msg = "No need to set .owner here. The core will do it."
> +coccilib.report.print_report(j0[0], msg)
> +
> -- 
> 2.0.0
> 
> 

      reply	other threads:[~2014-10-28 20:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 16:40 [PATCH RESEND 0/4] platform: fix accidently erasing .owner Wolfram Sang
2014-10-28 16:40 ` [PATCH RESEND 1/4] core: platform: add warning if driver has no owner Wolfram Sang
2014-11-10 21:32   ` Tony Luck
2014-11-11  5:30     ` Greg KH
2014-10-28 16:40 ` [PATCH RESEND 2/4] core: platform: let platform_driver_probe initialize module owner Wolfram Sang
2014-10-28 16:40 ` [PATCH RESEND 3/4] core: platform: let platform_create_bundle " Wolfram Sang
2014-10-28 16:40 ` [PATCH RESEND 4/4] coccinelle: api: add spatch to prevent unnecessary .owner Wolfram Sang
2014-10-28 20:58   ` Julia Lawall [this message]

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.02.1410282157510.2090@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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®