mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 17:33:01 +00:00
ca34cba431
According to Documentation/SubmittingPatches: "Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour." So do as recommended. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
71 lines
1.2 KiB
Plaintext
71 lines
1.2 KiB
Plaintext
/// Remove an open coded simple_open() function
|
|
/// and replace file operations references to the function
|
|
/// with simple_open() instead.
|
|
///
|
|
// Confidence: High
|
|
// Comments:
|
|
// Options: --no-includes --include-headers
|
|
|
|
virtual patch
|
|
virtual report
|
|
|
|
@ open depends on patch @
|
|
identifier open_f != simple_open;
|
|
identifier i, f;
|
|
@@
|
|
-int open_f(struct inode *i, struct file *f)
|
|
-{
|
|
(
|
|
-if (i->i_private)
|
|
-f->private_data = i->i_private;
|
|
|
|
|
-f->private_data = i->i_private;
|
|
)
|
|
-return 0;
|
|
-}
|
|
|
|
@ has_open depends on open @
|
|
identifier fops;
|
|
identifier open.open_f;
|
|
@@
|
|
struct file_operations fops = {
|
|
...,
|
|
-.open = open_f,
|
|
+.open = simple_open,
|
|
...
|
|
};
|
|
|
|
@ openr depends on report @
|
|
identifier open_f != simple_open;
|
|
identifier i, f;
|
|
position p;
|
|
@@
|
|
int open_f@p(struct inode *i, struct file *f)
|
|
{
|
|
(
|
|
if (i->i_private)
|
|
f->private_data = i->i_private;
|
|
|
|
|
f->private_data = i->i_private;
|
|
)
|
|
return 0;
|
|
}
|
|
|
|
@ has_openr depends on openr @
|
|
identifier fops;
|
|
identifier openr.open_f;
|
|
position p;
|
|
@@
|
|
struct file_operations fops = {
|
|
...,
|
|
.open = open_f@p,
|
|
...
|
|
};
|
|
|
|
@script:python@
|
|
pf << openr.p;
|
|
ps << has_openr.p;
|
|
@@
|
|
|
|
coccilib.report.print_report(pf[0],"WARNING opportunity for simple_open, see also structure on line %s"%(ps[0].line))
|