mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Andrew F. Davis" <afd@ti.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <cocci@systeme.lip6.fr>, <linux-kernel@vger.kernel.org>,
	"Andrew F. Davis" <afd@ti.com>
Subject: [PATCH 1/1] Add SPI to platform_no_drv_owner.cocci warnings
Date: Fri, 20 Nov 2015 16:02:05 -0600	[thread overview]
Message-ID: <1448056925-389-1-git-send-email-afd@ti.com> (raw)

Remove .owner field if calls are used which set it automatically.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 scripts/coccinelle/api/platform_no_drv_owner.cocci | 73 ++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/scripts/coccinelle/api/platform_no_drv_owner.cocci b/scripts/coccinelle/api/platform_no_drv_owner.cocci
index c5e3f73f..52d5f53 100644
--- a/scripts/coccinelle/api/platform_no_drv_owner.cocci
+++ b/scripts/coccinelle/api/platform_no_drv_owner.cocci
@@ -12,6 +12,7 @@ virtual report
 declarer name module_i2c_driver;
 declarer name module_platform_driver;
 declarer name module_platform_driver_probe;
+declarer name module_spi_driver;
 identifier __driver;
 @@
 (
@@ -20,6 +21,8 @@ identifier __driver;
 	module_platform_driver(__driver);
 |
 	module_platform_driver_probe(__driver, ...);
+|
+	module_spi_driver(__driver);
 )
 
 @fix1 depends on match1 && patch && !context && !org && !report@
@@ -40,6 +43,15 @@ identifier match1.__driver;
 		}
 	};
 
+@fix1_spi depends on match1 && patch && !context && !org && !report@
+identifier match1.__driver;
+@@
+	static struct spi_driver __driver = {
+		.driver = {
+-			.owner = THIS_MODULE,
+		}
+	};
+
 @match2@
 identifier __driver;
 @@
@@ -51,6 +63,8 @@ identifier __driver;
 	platform_create_bundle(&__driver, ...)
 |
 	i2c_add_driver(&__driver)
+|
+	spi_register_driver(&__driver)
 )
 
 @fix2 depends on match2 && patch && !context && !org && !report@
@@ -71,6 +85,15 @@ identifier match2.__driver;
 		}
 	};
 
+@fix2_spi depends on match2 && patch && !context && !org && !report@
+identifier match2.__driver;
+@@
+	static struct spi_driver __driver = {
+		.driver = {
+-			.owner = THIS_MODULE,
+		}
+	};
+
 // ----------------------------------------------------------------------------
 
 @fix1_context depends on match1 && !patch && (context || org || report)@
@@ -95,6 +118,17 @@ position j0;
 		}
 	};
 
+@fix1_spi_context depends on match1 && !patch && (context || org || report)@
+identifier match1.__driver;
+position j0;
+@@
+
+	static struct spi_driver __driver = {
+		.driver = {
+*			.owner@j0 = THIS_MODULE,
+		}
+	};
+
 @fix2_context depends on match2 && !patch && (context || org || report)@
 identifier match2.__driver;
 position j0;
@@ -117,6 +151,17 @@ position j0;
 		}
 	};
 
+@fix2_spi_context depends on match2 && !patch && (context || org || report)@
+identifier match2.__driver;
+position j0;
+@@
+
+	static struct spi_driver __driver = {
+		.driver = {
+*			.owner@j0 = THIS_MODULE,
+		}
+	};
+
 // ----------------------------------------------------------------------------
 
 @script:python fix1_org depends on org@
@@ -133,6 +178,13 @@ j0 << fix1_i2c_context.j0;
 msg = "No need to set .owner here. The core will do it."
 coccilib.org.print_todo(j0[0], msg)
 
+@script:python fix1_spi_org depends on org@
+j0 << fix1_spi_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;
 @@
@@ -147,6 +199,13 @@ j0 << fix2_i2c_context.j0;
 msg = "No need to set .owner here. The core will do it."
 coccilib.org.print_todo(j0[0], msg)
 
+@script:python fix2_spi_org depends on org@
+j0 << fix2_spi_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@
@@ -163,6 +222,13 @@ j0 << fix1_i2c_context.j0;
 msg = "No need to set .owner here. The core will do it."
 coccilib.report.print_report(j0[0], msg)
 
+@script:python fix1_spi_report depends on report@
+j0 << fix1_spi_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;
 @@
@@ -177,3 +243,10 @@ j0 << fix2_i2c_context.j0;
 msg = "No need to set .owner here. The core will do it."
 coccilib.report.print_report(j0[0], msg)
 
+@script:python fix2_spi_report depends on report@
+j0 << fix2_spi_context.j0;
+@@
+
+msg = "No need to set .owner here. The core will do it."
+coccilib.report.print_report(j0[0], msg)
+
-- 
1.9.1


             reply	other threads:[~2015-11-20 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20 22:02 Andrew F. Davis [this message]
2015-11-21  4:36 ` Krzysztof Kozlowski
2015-11-21  6:48 ` Julia Lawall

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=1448056925-389-1-git-send-email-afd@ti.com \
    --to=afd@ti.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --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®