Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /// Remove .owner field if calls are used which set it automatically
0003 ///
0004 // Confidence: High
0005 // Copyright: (C) 2014 Wolfram Sang.
0006 
0007 virtual patch
0008 virtual context
0009 virtual org
0010 virtual report
0011 
0012 @match1@
0013 declarer name module_i2c_driver;
0014 declarer name module_platform_driver;
0015 declarer name module_platform_driver_probe;
0016 identifier __driver;
0017 @@
0018 (
0019         module_i2c_driver(__driver);
0020 |
0021         module_platform_driver(__driver);
0022 |
0023         module_platform_driver_probe(__driver, ...);
0024 )
0025 
0026 @fix1 depends on match1 && patch && !context && !org && !report@
0027 identifier match1.__driver;
0028 @@
0029         static struct platform_driver __driver = {
0030                 .driver = {
0031 -                       .owner = THIS_MODULE,
0032                 }
0033         };
0034 
0035 @fix1_i2c depends on match1 && patch && !context && !org && !report@
0036 identifier match1.__driver;
0037 @@
0038         static struct i2c_driver __driver = {
0039                 .driver = {
0040 -                       .owner = THIS_MODULE,
0041                 }
0042         };
0043 
0044 @match2@
0045 identifier __driver;
0046 @@
0047 (
0048         platform_driver_register(&__driver)
0049 |
0050         platform_driver_probe(&__driver, ...)
0051 |
0052         platform_create_bundle(&__driver, ...)
0053 |
0054         i2c_add_driver(&__driver)
0055 )
0056 
0057 @fix2 depends on match2 && patch && !context && !org && !report@
0058 identifier match2.__driver;
0059 @@
0060         static struct platform_driver __driver = {
0061                 .driver = {
0062 -                       .owner = THIS_MODULE,
0063                 }
0064         };
0065 
0066 @fix2_i2c depends on match2 && patch && !context && !org && !report@
0067 identifier match2.__driver;
0068 @@
0069         static struct i2c_driver __driver = {
0070                 .driver = {
0071 -                       .owner = THIS_MODULE,
0072                 }
0073         };
0074 
0075 // ----------------------------------------------------------------------------
0076 
0077 @fix1_context depends on match1 && !patch && (context || org || report)@
0078 identifier match1.__driver;
0079 position j0;
0080 @@
0081 
0082         static struct platform_driver __driver = {
0083                 .driver = {
0084 *                       .owner@j0 = THIS_MODULE,
0085                 }
0086         };
0087 
0088 @fix1_i2c_context depends on match1 && !patch && (context || org || report)@
0089 identifier match1.__driver;
0090 position j0;
0091 @@
0092 
0093         static struct i2c_driver __driver = {
0094                 .driver = {
0095 *                       .owner@j0 = THIS_MODULE,
0096                 }
0097         };
0098 
0099 @fix2_context depends on match2 && !patch && (context || org || report)@
0100 identifier match2.__driver;
0101 position j0;
0102 @@
0103 
0104         static struct platform_driver __driver = {
0105                 .driver = {
0106 *                       .owner@j0 = THIS_MODULE,
0107                 }
0108         };
0109 
0110 @fix2_i2c_context depends on match2 && !patch && (context || org || report)@
0111 identifier match2.__driver;
0112 position j0;
0113 @@
0114 
0115         static struct i2c_driver __driver = {
0116                 .driver = {
0117 *                       .owner@j0 = THIS_MODULE,
0118                 }
0119         };
0120 
0121 // ----------------------------------------------------------------------------
0122 
0123 @script:python fix1_org depends on org@
0124 j0 << fix1_context.j0;
0125 @@
0126 
0127 msg = "No need to set .owner here. The core will do it."
0128 coccilib.org.print_todo(j0[0], msg)
0129 
0130 @script:python fix1_i2c_org depends on org@
0131 j0 << fix1_i2c_context.j0;
0132 @@
0133 
0134 msg = "No need to set .owner here. The core will do it."
0135 coccilib.org.print_todo(j0[0], msg)
0136 
0137 @script:python fix2_org depends on org@
0138 j0 << fix2_context.j0;
0139 @@
0140 
0141 msg = "No need to set .owner here. The core will do it."
0142 coccilib.org.print_todo(j0[0], msg)
0143 
0144 @script:python fix2_i2c_org depends on org@
0145 j0 << fix2_i2c_context.j0;
0146 @@
0147 
0148 msg = "No need to set .owner here. The core will do it."
0149 coccilib.org.print_todo(j0[0], msg)
0150 
0151 // ----------------------------------------------------------------------------
0152 
0153 @script:python fix1_report depends on report@
0154 j0 << fix1_context.j0;
0155 @@
0156 
0157 msg = "No need to set .owner here. The core will do it."
0158 coccilib.report.print_report(j0[0], msg)
0159 
0160 @script:python fix1_i2c_report depends on report@
0161 j0 << fix1_i2c_context.j0;
0162 @@
0163 
0164 msg = "No need to set .owner here. The core will do it."
0165 coccilib.report.print_report(j0[0], msg)
0166 
0167 @script:python fix2_report depends on report@
0168 j0 << fix2_context.j0;
0169 @@
0170 
0171 msg = "No need to set .owner here. The core will do it."
0172 coccilib.report.print_report(j0[0], msg)
0173 
0174 @script:python fix2_i2c_report depends on report@
0175 j0 << fix2_i2c_context.j0;
0176 @@
0177 
0178 msg = "No need to set .owner here. The core will do it."
0179 coccilib.report.print_report(j0[0], msg)
0180