Re: [Cocci] [RFC] drop owner assignment from platform_drivers

From: Julia Lawall
Date: Fri Oct 10 2014 - 03:54:32 EST


> @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@
> 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@
> identifier match2.__driver;
> @@
> static struct platform_driver __driver = {
> .driver = {
> - .owner = THIS_MODULE,
> }
> };

The semantic patch looks fine. I'm a little surprised that it doesn't
complain about the lack of a comma after

.driver = { .owner = THIS_MODULE, }

but it seems that it does not.

If you think that it would be useful to have this in the Linux kernel, so
people don't add the owner initializer back in the future, you can try

coccinelle/tools/sgen/sgen

(run make in the coccinelle/tools/sgen directory). That will guide you
through the process of making a Linux-ready semantic patch. Feedback
would be appreciated.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/