aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-05 18:30:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-05 18:30:34 -0400
commit5d32c88f0b94061b3af2e3ade92422407282eb12 (patch)
tree2e1f81aa47b2cf59625c8fba17199617e33802e6
parent43f63c8711ce02226b7bbdafeba7b8031faf3fb4 (diff)
parentdac23b0d0513916498d40412818bd2c581b365f7 (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge batch of fixes from Andrew Morton: "The simple_open() cleanup was held back while I wanted for laggards to merge things. I still need to send a few checkpoint/restore patches. I've been wobbly about merging them because I'm wobbly about the overall prospects for success of the project. But after speaking with Pavel at the LSF conference, it sounds like they're further toward completion than I feared - apparently davem is at the "has stopped complaining" stage regarding the net changes. So I need to go back and re-review those patchs and their (lengthy) discussion." * emailed from Andrew Morton <akpm@linux-foundation.org>: (16 patches) memcg swap: use mem_cgroup_uncharge_swap fix backlight: add driver for DA9052/53 PMIC v1 C6X: use set_current_blocked() and block_sigmask() MAINTAINERS: add entry for sparse checker MAINTAINERS: fix REMOTEPROC F: typo alpha: use set_current_blocked() and block_sigmask() simple_open: automatically convert to simple_open() scripts/coccinelle/api/simple_open.cocci: semantic patch for simple_open() libfs: add simple_open() hugetlbfs: remove unregister_filesystem() when initializing module drivers/rtc/rtc-88pm860x.c: fix rtc irq enable callback fs/xattr.c:setxattr(): improve handling of allocation failures fs/xattr.c:listxattr(): fall back to vmalloc() if kmalloc() failed fs/xattr.c: suppress page allocation failure warnings from sys_listxattr() sysrq: use SEND_SIG_FORCED instead of force_sig() proc: fix mount -t proc -o AAA
-rw-r--r--MAINTAINERS11
-rw-r--r--arch/alpha/kernel/signal.c31
-rw-r--r--arch/arm/mach-msm/smd_debug.c8
-rw-r--r--arch/c6x/kernel/signal.c16
-rw-r--r--arch/x86/kernel/kdebugfs.c9
-rw-r--r--drivers/acpi/ec_sys.c8
-rw-r--r--drivers/base/regmap/regmap-debugfs.c12
-rw-r--r--drivers/bluetooth/btmrvl_debugfs.c26
-rw-r--r--drivers/char/virtio_console.c8
-rw-r--r--drivers/dma/coh901318.c9
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c14
-rw-r--r--drivers/hid/hid-picolcd.c16
-rw-r--r--drivers/hid/hid-wiimote-debug.c8
-rw-r--r--drivers/idle/i7300_idle.c8
-rw-r--r--drivers/iommu/omap-iommu-debug.c10
-rw-r--r--drivers/mfd/aat2870-core.c9
-rw-r--r--drivers/mfd/ab3100-core.c8
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c8
-rw-r--r--drivers/mtd/ubi/debug.c10
-rw-r--r--drivers/net/caif/caif_spi.c10
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c9
-rw-r--r--drivers/net/wimax/i2400m/debugfs.c15
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c23
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c42
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c37
-rw-r--r--drivers/net/wireless/ath/ath9k/dfs_debug.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_debug.c26
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c8
-rw-r--r--drivers/net/wireless/ath/carl9170/debug.c7
-rw-r--r--drivers/net/wireless/b43/debugfs.c8
-rw-r--r--drivers/net/wireless/b43legacy/debugfs.c8
-rw-r--r--drivers/net/wireless/iwlegacy/3945-rs.c8
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c12
-rw-r--r--drivers/net/wireless/iwlegacy/debug.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c12
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debugfs.c14
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c9
-rw-r--r--drivers/net/wireless/libertas/debugfs.c10
-rw-r--r--drivers/net/wireless/mwifiex/debugfs.c18
-rw-r--r--drivers/net/wireless/wl1251/debugfs.c14
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c38
-rw-r--r--drivers/oprofile/oprofilefs.c14
-rw-r--r--drivers/remoteproc/remoteproc_debugfs.c13
-rw-r--r--drivers/rtc/rtc-88pm860x.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c9
-rw-r--r--drivers/spi/spi-dw.c8
-rw-r--r--drivers/tty/serial/mfd.c9
-rw-r--r--drivers/tty/serial/pch_uart.c8
-rw-r--r--drivers/tty/sysrq.c2
-rw-r--r--drivers/usb/core/inode.c10
-rw-r--r--drivers/usb/host/ehci-dbg.c9
-rw-r--r--drivers/uwb/uwb-debug.c9
-rw-r--r--drivers/video/backlight/Kconfig6
-rw-r--r--drivers/video/backlight/Makefile1
-rw-r--r--drivers/video/backlight/da9052_bl.c187
-rw-r--r--fs/debugfs/file.c14
-rw-r--r--fs/dlm/debug_fs.c9
-rw-r--r--fs/hugetlbfs/inode.c1
-rw-r--r--fs/libfs.c8
-rw-r--r--fs/proc/root.c9
-rw-r--r--fs/pstore/inode.c8
-rw-r--r--fs/xattr.c40
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/swap.h14
-rw-r--r--kernel/trace/blktrace.c18
-rw-r--r--net/mac80211/debugfs.c12
-rw-r--r--net/mac80211/debugfs.h1
-rw-r--r--net/mac80211/debugfs_key.c4
-rw-r--r--net/mac80211/debugfs_netdev.c2
-rw-r--r--net/mac80211/debugfs_sta.c4
-rw-r--r--net/mac80211/rate.c2
-rw-r--r--net/wireless/debugfs.c10
-rw-r--r--scripts/coccinelle/api/simple_open.cocci70
-rw-r--r--sound/soc/imx/imx-audmux.c8
-rw-r--r--sound/soc/soc-core.c8
-rw-r--r--sound/soc/soc-dapm.c16
78 files changed, 518 insertions, 631 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 962232d62781..3e25ba82e0fa 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5637,7 +5637,7 @@ M: Ohad Ben-Cohen <ohad@wizery.com>
5637S: Maintained 5637S: Maintained
5638F: drivers/remoteproc/ 5638F: drivers/remoteproc/
5639F: Documentation/remoteproc.txt 5639F: Documentation/remoteproc.txt
5640F: include/linux/remoteproc.txt 5640F: include/linux/remoteproc.h
5641 5641
5642RFKILL 5642RFKILL
5643M: Johannes Berg <johannes@sipsolutions.net> 5643M: Johannes Berg <johannes@sipsolutions.net>
@@ -6287,6 +6287,15 @@ F: drivers/tty/serial/sunsu.c
6287F: drivers/tty/serial/sunzilog.c 6287F: drivers/tty/serial/sunzilog.c
6288F: drivers/tty/serial/sunzilog.h 6288F: drivers/tty/serial/sunzilog.h
6289 6289
6290SPARSE CHECKER
6291M: "Christopher Li" <sparse@chrisli.org>
6292L: linux-sparse@vger.kernel.org
6293W: https://sparse.wiki.kernel.org/
6294T: git git://git.kernel.org/pub/scm/devel/sparse/sparse.git
6295T: git git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git
6296S: Maintained
6297F: include/linux/compiler.h
6298
6290SPEAR PLATFORM SUPPORT 6299SPEAR PLATFORM SUPPORT
6291M: Viresh Kumar <viresh.kumar@st.com> 6300M: Viresh Kumar <viresh.kumar@st.com>
6292L: spear-devel@list.st.com 6301L: spear-devel@list.st.com
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index 6f7feb5db271..35f2ef44de12 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -120,12 +120,13 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
120 */ 120 */
121SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) 121SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
122{ 122{
123 mask &= _BLOCKABLE; 123 sigset_t blocked;
124 spin_lock_irq(&current->sighand->siglock); 124
125 current->saved_sigmask = current->blocked; 125 current->saved_sigmask = current->blocked;
126 siginitset(&current->blocked, mask); 126
127 recalc_sigpending(); 127 mask &= _BLOCKABLE;
128 spin_unlock_irq(&current->sighand->siglock); 128 siginitset(&blocked, mask);
129 set_current_blocked(&blocked);
129 130
130 current->state = TASK_INTERRUPTIBLE; 131 current->state = TASK_INTERRUPTIBLE;
131 schedule(); 132 schedule();
@@ -238,10 +239,7 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
238 goto give_sigsegv; 239 goto give_sigsegv;
239 240
240 sigdelsetmask(&set, ~_BLOCKABLE); 241 sigdelsetmask(&set, ~_BLOCKABLE);
241 spin_lock_irq(&current->sighand->siglock); 242 set_current_blocked(&set);
242 current->blocked = set;
243 recalc_sigpending();
244 spin_unlock_irq(&current->sighand->siglock);
245 243
246 if (restore_sigcontext(sc, regs, sw)) 244 if (restore_sigcontext(sc, regs, sw))
247 goto give_sigsegv; 245 goto give_sigsegv;
@@ -276,10 +274,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
276 goto give_sigsegv; 274 goto give_sigsegv;
277 275
278 sigdelsetmask(&set, ~_BLOCKABLE); 276 sigdelsetmask(&set, ~_BLOCKABLE);
279 spin_lock_irq(&current->sighand->siglock); 277 set_current_blocked(&set);
280 current->blocked = set;
281 recalc_sigpending();
282 spin_unlock_irq(&current->sighand->siglock);
283 278
284 if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw)) 279 if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw))
285 goto give_sigsegv; 280 goto give_sigsegv;
@@ -501,14 +496,8 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
501 else 496 else
502 ret = setup_frame(sig, ka, oldset, regs, sw); 497 ret = setup_frame(sig, ka, oldset, regs, sw);
503 498
504 if (ret == 0) { 499 if (ret == 0)
505 spin_lock_irq(&current->sighand->siglock); 500 block_sigmask(ka, sig);
506 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
507 if (!(ka->sa.sa_flags & SA_NODEFER))
508 sigaddset(&current->blocked,sig);
509 recalc_sigpending();
510 spin_unlock_irq(&current->sighand->siglock);
511 }
512 501
513 return ret; 502 return ret;
514} 503}
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index 0c56a5aaf588..c56df9e932ae 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -203,15 +203,9 @@ static ssize_t debug_read(struct file *file, char __user *buf,
203 return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize); 203 return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize);
204} 204}
205 205
206static int debug_open(struct inode *inode, struct file *file)
207{
208 file->private_data = inode->i_private;
209 return 0;
210}
211
212static const struct file_operations debug_ops = { 206static const struct file_operations debug_ops = {
213 .read = debug_read, 207 .read = debug_read,
214 .open = debug_open, 208 .open = simple_open,
215 .llseek = default_llseek, 209 .llseek = default_llseek,
216}; 210};
217 211
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c
index 304f675826e9..3b5a05099989 100644
--- a/arch/c6x/kernel/signal.c
+++ b/arch/c6x/kernel/signal.c
@@ -85,10 +85,7 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs)
85 goto badframe; 85 goto badframe;
86 86
87 sigdelsetmask(&set, ~_BLOCKABLE); 87 sigdelsetmask(&set, ~_BLOCKABLE);
88 spin_lock_irq(&current->sighand->siglock); 88 set_current_blocked(&set);
89 current->blocked = set;
90 recalc_sigpending();
91 spin_unlock_irq(&current->sighand->siglock);
92 89
93 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 90 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
94 goto badframe; 91 goto badframe;
@@ -279,15 +276,8 @@ static int handle_signal(int sig,
279 276
280 /* Set up the stack frame */ 277 /* Set up the stack frame */
281 ret = setup_rt_frame(sig, ka, info, oldset, regs); 278 ret = setup_rt_frame(sig, ka, info, oldset, regs);
282 if (ret == 0) { 279 if (ret == 0)
283 spin_lock_irq(&current->sighand->siglock); 280 block_sigmask(ka, sig);
284 sigorsets(&current->blocked, &current->blocked,
285 &ka->sa.sa_mask);
286 if (!(ka->sa.sa_flags & SA_NODEFER))
287 sigaddset(&current->blocked, sig);
288 recalc_sigpending();
289 spin_unlock_irq(&current->sighand->siglock);
290 }
291 281
292 return ret; 282 return ret;
293} 283}
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index 90fcf62854bb..1d5d31ea686b 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -68,16 +68,9 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf,
68 return count; 68 return count;
69} 69}
70 70
71static int setup_data_open(struct inode *inode, struct file *file)
72{
73 file->private_data = inode->i_private;
74
75 return 0;
76}
77
78static const struct file_operations fops_setup_data = { 71static const struct file_operations fops_setup_data = {
79 .read = setup_data_read, 72 .read = setup_data_read,
80 .open = setup_data_open, 73 .open = simple_open,
81 .llseek = default_llseek, 74 .llseek = default_llseek,
82}; 75};
83 76
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index b258cab9061c..7586544fddb4 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -27,12 +27,6 @@ MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
27 27
28static struct dentry *acpi_ec_debugfs_dir; 28static struct dentry *acpi_ec_debugfs_dir;
29 29
30static int acpi_ec_open_io(struct inode *i, struct file *f)
31{
32 f->private_data = i->i_private;
33 return 0;
34}
35
36static ssize_t acpi_ec_read_io(struct file *f, char __user *buf, 30static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
37 size_t count, loff_t *off) 31 size_t count, loff_t *off)
38{ 32{
@@ -95,7 +89,7 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
95 89
96static const struct file_operations acpi_ec_io_ops = { 90static const struct file_operations acpi_ec_io_ops = {
97 .owner = THIS_MODULE, 91 .owner = THIS_MODULE,
98 .open = acpi_ec_open_io, 92 .open = simple_open,
99 .read = acpi_ec_read_io, 93 .read = acpi_ec_read_io,
100 .write = acpi_ec_write_io, 94 .write = acpi_ec_write_io,
101 .llseek = default_llseek, 95 .llseek = default_llseek,
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 58517a5dac13..251eb70f83e7 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -27,12 +27,6 @@ static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size)
27 return strlen(buf); 27 return strlen(buf);
28} 28}
29 29
30static int regmap_open_file(struct inode *inode, struct file *file)
31{
32 file->private_data = inode->i_private;
33 return 0;
34}
35
36static ssize_t regmap_name_read_file(struct file *file, 30static ssize_t regmap_name_read_file(struct file *file,
37 char __user *user_buf, size_t count, 31 char __user *user_buf, size_t count,
38 loff_t *ppos) 32 loff_t *ppos)
@@ -57,7 +51,7 @@ static ssize_t regmap_name_read_file(struct file *file,
57} 51}
58 52
59static const struct file_operations regmap_name_fops = { 53static const struct file_operations regmap_name_fops = {
60 .open = regmap_open_file, 54 .open = simple_open,
61 .read = regmap_name_read_file, 55 .read = regmap_name_read_file,
62 .llseek = default_llseek, 56 .llseek = default_llseek,
63}; 57};
@@ -174,7 +168,7 @@ static ssize_t regmap_map_write_file(struct file *file,
174#endif 168#endif
175 169
176static const struct file_operations regmap_map_fops = { 170static const struct file_operations regmap_map_fops = {
177 .open = regmap_open_file, 171 .open = simple_open,
178 .read = regmap_map_read_file, 172 .read = regmap_map_read_file,
179 .write = regmap_map_write_file, 173 .write = regmap_map_write_file,
180 .llseek = default_llseek, 174 .llseek = default_llseek,
@@ -243,7 +237,7 @@ out:
243} 237}
244 238
245static const struct file_operations regmap_access_fops = { 239static const struct file_operations regmap_access_fops = {
246 .open = regmap_open_file, 240 .open = simple_open,
247 .read = regmap_access_read_file, 241 .read = regmap_access_read_file,
248 .llseek = default_llseek, 242 .llseek = default_llseek,
249}; 243};
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c
index 6c20bbb54b71..428dbb7574bd 100644
--- a/drivers/bluetooth/btmrvl_debugfs.c
+++ b/drivers/bluetooth/btmrvl_debugfs.c
@@ -45,12 +45,6 @@ struct btmrvl_debugfs_data {
45 struct dentry *txdnldready; 45 struct dentry *txdnldready;
46}; 46};
47 47
48static int btmrvl_open_generic(struct inode *inode, struct file *file)
49{
50 file->private_data = inode->i_private;
51 return 0;
52}
53
54static ssize_t btmrvl_hscfgcmd_write(struct file *file, 48static ssize_t btmrvl_hscfgcmd_write(struct file *file,
55 const char __user *ubuf, size_t count, loff_t *ppos) 49 const char __user *ubuf, size_t count, loff_t *ppos)
56{ 50{
@@ -93,7 +87,7 @@ static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf,
93static const struct file_operations btmrvl_hscfgcmd_fops = { 87static const struct file_operations btmrvl_hscfgcmd_fops = {
94 .read = btmrvl_hscfgcmd_read, 88 .read = btmrvl_hscfgcmd_read,
95 .write = btmrvl_hscfgcmd_write, 89 .write = btmrvl_hscfgcmd_write,
96 .open = btmrvl_open_generic, 90 .open = simple_open,
97 .llseek = default_llseek, 91 .llseek = default_llseek,
98}; 92};
99 93
@@ -134,7 +128,7 @@ static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf,
134static const struct file_operations btmrvl_psmode_fops = { 128static const struct file_operations btmrvl_psmode_fops = {
135 .read = btmrvl_psmode_read, 129 .read = btmrvl_psmode_read,
136 .write = btmrvl_psmode_write, 130 .write = btmrvl_psmode_write,
137 .open = btmrvl_open_generic, 131 .open = simple_open,
138 .llseek = default_llseek, 132 .llseek = default_llseek,
139}; 133};
140 134
@@ -180,7 +174,7 @@ static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf,
180static const struct file_operations btmrvl_pscmd_fops = { 174static const struct file_operations btmrvl_pscmd_fops = {
181 .read = btmrvl_pscmd_read, 175 .read = btmrvl_pscmd_read,
182 .write = btmrvl_pscmd_write, 176 .write = btmrvl_pscmd_write,
183 .open = btmrvl_open_generic, 177 .open = simple_open,
184 .llseek = default_llseek, 178 .llseek = default_llseek,
185}; 179};
186 180
@@ -221,7 +215,7 @@ static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf,
221static const struct file_operations btmrvl_gpiogap_fops = { 215static const struct file_operations btmrvl_gpiogap_fops = {
222 .read = btmrvl_gpiogap_read, 216 .read = btmrvl_gpiogap_read,
223 .write = btmrvl_gpiogap_write, 217 .write = btmrvl_gpiogap_write,
224 .open = btmrvl_open_generic, 218 .open = simple_open,
225 .llseek = default_llseek, 219 .llseek = default_llseek,
226}; 220};
227 221
@@ -265,7 +259,7 @@ static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf,
265static const struct file_operations btmrvl_hscmd_fops = { 259static const struct file_operations btmrvl_hscmd_fops = {
266 .read = btmrvl_hscmd_read, 260 .read = btmrvl_hscmd_read,
267 .write = btmrvl_hscmd_write, 261 .write = btmrvl_hscmd_write,
268 .open = btmrvl_open_generic, 262 .open = simple_open,
269 .llseek = default_llseek, 263 .llseek = default_llseek,
270}; 264};
271 265
@@ -305,7 +299,7 @@ static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf,
305static const struct file_operations btmrvl_hsmode_fops = { 299static const struct file_operations btmrvl_hsmode_fops = {
306 .read = btmrvl_hsmode_read, 300 .read = btmrvl_hsmode_read,
307 .write = btmrvl_hsmode_write, 301 .write = btmrvl_hsmode_write,
308 .open = btmrvl_open_generic, 302 .open = simple_open,
309 .llseek = default_llseek, 303 .llseek = default_llseek,
310}; 304};
311 305
@@ -323,7 +317,7 @@ static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf,
323 317
324static const struct file_operations btmrvl_curpsmode_fops = { 318static const struct file_operations btmrvl_curpsmode_fops = {
325 .read = btmrvl_curpsmode_read, 319 .read = btmrvl_curpsmode_read,
326 .open = btmrvl_open_generic, 320 .open = simple_open,
327 .llseek = default_llseek, 321 .llseek = default_llseek,
328}; 322};
329 323
@@ -341,7 +335,7 @@ static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf,
341 335
342static const struct file_operations btmrvl_psstate_fops = { 336static const struct file_operations btmrvl_psstate_fops = {
343 .read = btmrvl_psstate_read, 337 .read = btmrvl_psstate_read,
344 .open = btmrvl_open_generic, 338 .open = simple_open,
345 .llseek = default_llseek, 339 .llseek = default_llseek,
346}; 340};
347 341
@@ -359,7 +353,7 @@ static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf,
359 353
360static const struct file_operations btmrvl_hsstate_fops = { 354static const struct file_operations btmrvl_hsstate_fops = {
361 .read = btmrvl_hsstate_read, 355 .read = btmrvl_hsstate_read,
362 .open = btmrvl_open_generic, 356 .open = simple_open,
363 .llseek = default_llseek, 357 .llseek = default_llseek,
364}; 358};
365 359
@@ -378,7 +372,7 @@ static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf,
378 372
379static const struct file_operations btmrvl_txdnldready_fops = { 373static const struct file_operations btmrvl_txdnldready_fops = {
380 .read = btmrvl_txdnldready_read, 374 .read = btmrvl_txdnldready_read,
381 .open = btmrvl_open_generic, 375 .open = simple_open,
382 .llseek = default_llseek, 376 .llseek = default_llseek,
383}; 377};
384 378
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index b58b56187065..ddf86b6500b7 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1038,12 +1038,6 @@ static struct attribute_group port_attribute_group = {
1038 .attrs = port_sysfs_entries, 1038 .attrs = port_sysfs_entries,
1039}; 1039};
1040 1040
1041static int debugfs_open(struct inode *inode, struct file *filp)
1042{
1043 filp->private_data = inode->i_private;
1044 return 0;
1045}
1046
1047static ssize_t debugfs_read(struct file *filp, char __user *ubuf, 1041static ssize_t debugfs_read(struct file *filp, char __user *ubuf,
1048 size_t count, loff_t *offp) 1042 size_t count, loff_t *offp)
1049{ 1043{
@@ -1087,7 +1081,7 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf,
1087 1081
1088static const struct file_operations port_debugfs_ops = { 1082static const struct file_operations port_debugfs_ops = {
1089 .owner = THIS_MODULE, 1083 .owner = THIS_MODULE,
1090 .open = debugfs_open, 1084 .open = simple_open,
1091 .read = debugfs_read, 1085 .read = debugfs_read,
1092}; 1086};
1093 1087
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index dc89455f5550..750925f9638b 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -104,13 +104,6 @@ static void coh901318_list_print(struct coh901318_chan *cohc,
104static struct coh901318_base *debugfs_dma_base; 104static struct coh901318_base *debugfs_dma_base;
105static struct dentry *dma_dentry; 105static struct dentry *dma_dentry;
106 106
107static int coh901318_debugfs_open(struct inode *inode, struct file *file)
108{
109
110 file->private_data = inode->i_private;
111 return 0;
112}
113
114static int coh901318_debugfs_read(struct file *file, char __user *buf, 107static int coh901318_debugfs_read(struct file *file, char __user *buf,
115 size_t count, loff_t *f_pos) 108 size_t count, loff_t *f_pos)
116{ 109{
@@ -158,7 +151,7 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf,
158 151
159static const struct file_operations coh901318_debugfs_status_operations = { 152static const struct file_operations coh901318_debugfs_status_operations = {
160 .owner = THIS_MODULE, 153 .owner = THIS_MODULE,
161 .open = coh901318_debugfs_open, 154 .open = simple_open,
162 .read = coh901318_debugfs_read, 155 .read = coh901318_debugfs_read,
163 .llseek = default_llseek, 156 .llseek = default_llseek,
164}; 157};
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index fdb7ccefffbd..b505b70dba05 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1502,14 +1502,6 @@ static int i915_ppgtt_info(struct seq_file *m, void *data)
1502 return 0; 1502 return 0;
1503} 1503}
1504 1504
1505static int
1506i915_debugfs_common_open(struct inode *inode,
1507 struct file *filp)
1508{
1509 filp->private_data = inode->i_private;
1510 return 0;
1511}
1512
1513static ssize_t 1505static ssize_t
1514i915_wedged_read(struct file *filp, 1506i915_wedged_read(struct file *filp,
1515 char __user *ubuf, 1507 char __user *ubuf,
@@ -1560,7 +1552,7 @@ i915_wedged_write(struct file *filp,
1560 1552
1561static const struct file_operations i915_wedged_fops = { 1553static const struct file_operations i915_wedged_fops = {
1562 .owner = THIS_MODULE, 1554 .owner = THIS_MODULE,
1563 .open = i915_debugfs_common_open, 1555 .open = simple_open,
1564 .read = i915_wedged_read, 1556 .read = i915_wedged_read,
1565 .write = i915_wedged_write, 1557 .write = i915_wedged_write,
1566 .llseek = default_llseek, 1558 .llseek = default_llseek,
@@ -1622,7 +1614,7 @@ i915_max_freq_write(struct file *filp,
1622 1614
1623static const struct file_operations i915_max_freq_fops = { 1615static const struct file_operations i915_max_freq_fops = {
1624 .owner = THIS_MODULE, 1616 .owner = THIS_MODULE,
1625 .open = i915_debugfs_common_open, 1617 .open = simple_open,
1626 .read = i915_max_freq_read, 1618 .read = i915_max_freq_read,
1627 .write = i915_max_freq_write, 1619 .write = i915_max_freq_write,
1628 .llseek = default_llseek, 1620 .llseek = default_llseek,
@@ -1693,7 +1685,7 @@ i915_cache_sharing_write(struct file *filp,
1693 1685
1694static const struct file_operations i915_cache_sharing_fops = { 1686static const struct file_operations i915_cache_sharing_fops = {
1695 .owner = THIS_MODULE, 1687 .owner = THIS_MODULE,
1696 .open = i915_debugfs_common_open, 1688 .open = simple_open,
1697 .read = i915_cache_sharing_read, 1689 .read = i915_cache_sharing_read,
1698 .write = i915_cache_sharing_write, 1690 .write = i915_cache_sharing_write,
1699 .llseek = default_llseek, 1691 .llseek = default_llseek,
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index 12f9777c385d..45c3433f7986 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -1525,12 +1525,6 @@ static const struct file_operations picolcd_debug_reset_fops = {
1525/* 1525/*
1526 * The "eeprom" file 1526 * The "eeprom" file
1527 */ 1527 */
1528static int picolcd_debug_eeprom_open(struct inode *i, struct file *f)
1529{
1530 f->private_data = i->i_private;
1531 return 0;
1532}
1533
1534static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u, 1528static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u,
1535 size_t s, loff_t *off) 1529 size_t s, loff_t *off)
1536{ 1530{
@@ -1618,7 +1612,7 @@ static ssize_t picolcd_debug_eeprom_write(struct file *f, const char __user *u,
1618 */ 1612 */
1619static const struct file_operations picolcd_debug_eeprom_fops = { 1613static const struct file_operations picolcd_debug_eeprom_fops = {
1620 .owner = THIS_MODULE, 1614 .owner = THIS_MODULE,
1621 .open = picolcd_debug_eeprom_open, 1615 .open = simple_open,
1622 .read = picolcd_debug_eeprom_read, 1616 .read = picolcd_debug_eeprom_read,
1623 .write = picolcd_debug_eeprom_write, 1617 .write = picolcd_debug_eeprom_write,
1624 .llseek = generic_file_llseek, 1618 .llseek = generic_file_llseek,
@@ -1627,12 +1621,6 @@ static const struct file_operations picolcd_debug_eeprom_fops = {
1627/* 1621/*
1628 * The "flash" file 1622 * The "flash" file
1629 */ 1623 */
1630static int picolcd_debug_flash_open(struct inode *i, struct file *f)
1631{
1632 f->private_data = i->i_private;
1633 return 0;
1634}
1635
1636/* record a flash address to buf (bounds check to be done by caller) */ 1624/* record a flash address to buf (bounds check to be done by caller) */
1637static int _picolcd_flash_setaddr(struct picolcd_data *data, u8 *buf, long off) 1625static int _picolcd_flash_setaddr(struct picolcd_data *data, u8 *buf, long off)
1638{ 1626{
@@ -1817,7 +1805,7 @@ static ssize_t picolcd_debug_flash_write(struct file *f, const char __user *u,
1817 */ 1805 */
1818static const struct file_operations picolcd_debug_flash_fops = { 1806static const struct file_operations picolcd_debug_flash_fops = {
1819 .owner = THIS_MODULE, 1807 .owner = THIS_MODULE,
1820 .open = picolcd_debug_flash_open, 1808 .open = simple_open,
1821 .read = picolcd_debug_flash_read, 1809 .read = picolcd_debug_flash_read,
1822 .write = picolcd_debug_flash_write, 1810 .write = picolcd_debug_flash_write,
1823 .llseek = generic_file_llseek, 1811 .llseek = generic_file_llseek,
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c
index 17dabc1f339e..eec329197c16 100644
--- a/drivers/hid/hid-wiimote-debug.c
+++ b/drivers/hid/hid-wiimote-debug.c
@@ -23,12 +23,6 @@ struct wiimote_debug {
23 struct dentry *drm; 23 struct dentry *drm;
24}; 24};
25 25
26static int wiidebug_eeprom_open(struct inode *i, struct file *f)
27{
28 f->private_data = i->i_private;
29 return 0;
30}
31
32static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, 26static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s,
33 loff_t *off) 27 loff_t *off)
34{ 28{
@@ -83,7 +77,7 @@ static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s,
83 77
84static const struct file_operations wiidebug_eeprom_fops = { 78static const struct file_operations wiidebug_eeprom_fops = {
85 .owner = THIS_MODULE, 79 .owner = THIS_MODULE,
86 .open = wiidebug_eeprom_open, 80 .open = simple_open,
87 .read = wiidebug_eeprom_read, 81 .read = wiidebug_eeprom_read,
88 .llseek = generic_file_llseek, 82 .llseek = generic_file_llseek,
89}; 83};
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c
index c976285d313e..fa080ebd568f 100644
--- a/drivers/idle/i7300_idle.c
+++ b/drivers/idle/i7300_idle.c
@@ -516,12 +516,6 @@ static struct notifier_block i7300_idle_nb = {
516 516
517MODULE_DEVICE_TABLE(pci, pci_tbl); 517MODULE_DEVICE_TABLE(pci, pci_tbl);
518 518
519int stats_open_generic(struct inode *inode, struct file *fp)
520{
521 fp->private_data = inode->i_private;
522 return 0;
523}
524
525static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, 519static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count,
526 loff_t *off) 520 loff_t *off)
527{ 521{
@@ -534,7 +528,7 @@ static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count,
534} 528}
535 529
536static const struct file_operations idle_fops = { 530static const struct file_operations idle_fops = {
537 .open = stats_open_generic, 531 .open = simple_open,
538 .read = stats_read_ul, 532 .read = stats_read_ul,
539 .llseek = default_llseek, 533 .llseek = default_llseek,
540}; 534};
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index 103dbd92e256..f55fc5dfbadc 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -323,15 +323,9 @@ err_out:
323 return count; 323 return count;
324} 324}
325 325
326static int debug_open_generic(struct inode *inode, struct file *file)
327{
328 file->private_data = inode->i_private;
329 return 0;
330}
331
332#define DEBUG_FOPS(name) \ 326#define DEBUG_FOPS(name) \
333 static const struct file_operations debug_##name##_fops = { \ 327 static const struct file_operations debug_##name##_fops = { \
334 .open = debug_open_generic, \ 328 .open = simple_open, \
335 .read = debug_read_##name, \ 329 .read = debug_read_##name, \
336 .write = debug_write_##name, \ 330 .write = debug_write_##name, \
337 .llseek = generic_file_llseek, \ 331 .llseek = generic_file_llseek, \
@@ -339,7 +333,7 @@ static int debug_open_generic(struct inode *inode, struct file *file)
339 333
340#define DEBUG_FOPS_RO(name) \ 334#define DEBUG_FOPS_RO(name) \
341 static const struct file_operations debug_##name##_fops = { \ 335 static const struct file_operations debug_##name##_fops = { \
342 .open = debug_open_generic, \ 336 .open = simple_open, \
343 .read = debug_read_##name, \ 337 .read = debug_read_##name, \
344 .llseek = generic_file_llseek, \ 338 .llseek = generic_file_llseek, \
345 }; 339 };
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 3aa36eb5c79b..44a3fdbadef4 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -262,13 +262,6 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf)
262 return count; 262 return count;
263} 263}
264 264
265static int aat2870_reg_open_file(struct inode *inode, struct file *file)
266{
267 file->private_data = inode->i_private;
268
269 return 0;
270}
271
272static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, 265static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf,
273 size_t count, loff_t *ppos) 266 size_t count, loff_t *ppos)
274{ 267{
@@ -330,7 +323,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
330} 323}
331 324
332static const struct file_operations aat2870_reg_fops = { 325static const struct file_operations aat2870_reg_fops = {
333 .open = aat2870_reg_open_file, 326 .open = simple_open,
334 .read = aat2870_reg_read_file, 327 .read = aat2870_reg_read_file,
335 .write = aat2870_reg_write_file, 328 .write = aat2870_reg_write_file,
336}; 329};
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 60107ee166fc..1efad20fb175 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -483,12 +483,6 @@ struct ab3100_get_set_reg_priv {
483 bool mode; 483 bool mode;
484}; 484};
485 485
486static int ab3100_get_set_reg_open_file(struct inode *inode, struct file *file)
487{
488 file->private_data = inode->i_private;
489 return 0;
490}
491
492static ssize_t ab3100_get_set_reg(struct file *file, 486static ssize_t ab3100_get_set_reg(struct file *file,
493 const char __user *user_buf, 487 const char __user *user_buf,
494 size_t count, loff_t *ppos) 488 size_t count, loff_t *ppos)
@@ -583,7 +577,7 @@ static ssize_t ab3100_get_set_reg(struct file *file,
583} 577}
584 578
585static const struct file_operations ab3100_get_set_reg_fops = { 579static const struct file_operations ab3100_get_set_reg_fops = {
586 .open = ab3100_get_set_reg_open_file, 580 .open = simple_open,
587 .write = ab3100_get_set_reg, 581 .write = ab3100_get_set_reg,
588 .llseek = noop_llseek, 582 .llseek = noop_llseek,
589}; 583};
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 1c034b80d408..6673e578b3e9 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -500,12 +500,6 @@ static ssize_t r_heartbeat_file_write(struct file *file, const char __user *buf,
500 return 1; 500 return 1;
501} 501}
502 502
503static int remote_settings_file_open(struct inode *inode, struct file *file)
504{
505 file->private_data = inode->i_private;
506 return 0;
507}
508
509static int remote_settings_file_close(struct inode *inode, struct file *file) 503static int remote_settings_file_close(struct inode *inode, struct file *file)
510{ 504{
511 return 0; 505 return 0;
@@ -600,7 +594,7 @@ static const struct file_operations r_heartbeat_fops = {
600}; 594};
601 595
602static const struct file_operations remote_settings_fops = { 596static const struct file_operations remote_settings_fops = {
603 .open = remote_settings_file_open, 597 .open = simple_open,
604 .release = remote_settings_file_close, 598 .release = remote_settings_file_close,
605 .read = remote_settings_file_read, 599 .read = remote_settings_file_read,
606 .write = remote_settings_file_write, 600 .write = remote_settings_file_write,
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index e2cdebf40840..61af9bb560ab 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -386,19 +386,11 @@ out:
386 return count; 386 return count;
387} 387}
388 388
389static int default_open(struct inode *inode, struct file *file)
390{
391 if (inode->i_private)
392 file->private_data = inode->i_private;
393
394 return 0;
395}
396
397/* File operations for all UBI debugfs files */ 389/* File operations for all UBI debugfs files */
398static const struct file_operations dfs_fops = { 390static const struct file_operations dfs_fops = {
399 .read = dfs_file_read, 391 .read = dfs_file_read,
400 .write = dfs_file_write, 392 .write = dfs_file_write,
401 .open = default_open, 393 .open = simple_open,
402 .llseek = no_llseek, 394 .llseek = no_llseek,
403 .owner = THIS_MODULE, 395 .owner = THIS_MODULE,
404}; 396};
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 96391c36fa74..b71ce9bf0afb 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -127,12 +127,6 @@ static inline void dev_debugfs_rem(struct cfspi *cfspi)
127 debugfs_remove(cfspi->dbgfs_dir); 127 debugfs_remove(cfspi->dbgfs_dir);
128} 128}
129 129
130static int dbgfs_open(struct inode *inode, struct file *file)
131{
132 file->private_data = inode->i_private;
133 return 0;
134}
135
136static ssize_t dbgfs_state(struct file *file, char __user *user_buf, 130static ssize_t dbgfs_state(struct file *file, char __user *user_buf,
137 size_t count, loff_t *ppos) 131 size_t count, loff_t *ppos)
138{ 132{
@@ -243,13 +237,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf,
243} 237}
244 238
245static const struct file_operations dbgfs_state_fops = { 239static const struct file_operations dbgfs_state_fops = {
246 .open = dbgfs_open, 240 .open = simple_open,
247 .read = dbgfs_state, 241 .read = dbgfs_state,
248 .owner = THIS_MODULE 242 .owner = THIS_MODULE
249}; 243};
250 244
251static const struct file_operations dbgfs_frame_fops = { 245static const struct file_operations dbgfs_frame_fops = {
252 .open = dbgfs_open, 246 .open = simple_open,
253 .read = dbgfs_frame, 247 .read = dbgfs_frame,
254 .owner = THIS_MODULE 248 .owner = THIS_MODULE
255}; 249};
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 05ff076af06d..b126b98065a9 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2000,13 +2000,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
2000/* 2000/*
2001 * debugfs support 2001 * debugfs support
2002 */ 2002 */
2003
2004static int mem_open(struct inode *inode, struct file *file)
2005{
2006 file->private_data = inode->i_private;
2007 return 0;
2008}
2009
2010static ssize_t mem_read(struct file *file, char __user *buf, size_t count, 2003static ssize_t mem_read(struct file *file, char __user *buf, size_t count,
2011 loff_t *ppos) 2004 loff_t *ppos)
2012{ 2005{
@@ -2050,7 +2043,7 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count,
2050 2043
2051static const struct file_operations mem_debugfs_fops = { 2044static const struct file_operations mem_debugfs_fops = {
2052 .owner = THIS_MODULE, 2045 .owner = THIS_MODULE,
2053 .open = mem_open, 2046 .open = simple_open,
2054 .read = mem_read, 2047 .read = mem_read,
2055 .llseek = default_llseek, 2048 .llseek = default_llseek,
2056}; 2049};
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index 129ba36bd04d..4b66ab1d0e5c 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -53,17 +53,6 @@ struct dentry *debugfs_create_netdev_queue_stopped(
53 &fops_netdev_queue_stopped); 53 &fops_netdev_queue_stopped);
54} 54}
55 55
56
57/*
58 * inode->i_private has the @data argument to debugfs_create_file()
59 */
60static
61int i2400m_stats_open(struct inode *inode, struct file *filp)
62{
63 filp->private_data = inode->i_private;
64 return 0;
65}
66
67/* 56/*
68 * We don't allow partial reads of this file, as then the reader would 57 * We don't allow partial reads of this file, as then the reader would
69 * get weirdly confused data as it is updated. 58 * get weirdly confused data as it is updated.
@@ -117,7 +106,7 @@ ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer,
117static 106static
118const struct file_operations i2400m_rx_stats_fops = { 107const struct file_operations i2400m_rx_stats_fops = {
119 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
120 .open = i2400m_stats_open, 109 .open = simple_open,
121 .read = i2400m_rx_stats_read, 110 .read = i2400m_rx_stats_read,
122 .write = i2400m_rx_stats_write, 111 .write = i2400m_rx_stats_write,
123 .llseek = default_llseek, 112 .llseek = default_llseek,
@@ -170,7 +159,7 @@ ssize_t i2400m_tx_stats_write(struct file *filp, const char __user *buffer,
170static 159static
171const struct file_operations i2400m_tx_stats_fops = { 160const struct file_operations i2400m_tx_stats_fops = {
172 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
173 .open = i2400m_stats_open, 162 .open = simple_open,
174 .read = i2400m_tx_stats_read, 163 .read = i2400m_tx_stats_read,
175 .write = i2400m_tx_stats_write, 164 .write = i2400m_tx_stats_write,
176 .llseek = default_llseek, 165 .llseek = default_llseek,
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 8c5ce8b0c734..e5e8f45d86ac 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -71,13 +71,6 @@ static unsigned int ath5k_debug;
71module_param_named(debug, ath5k_debug, uint, 0); 71module_param_named(debug, ath5k_debug, uint, 0);
72 72
73 73
74static int ath5k_debugfs_open(struct inode *inode, struct file *file)
75{
76 file->private_data = inode->i_private;
77 return 0;
78}
79
80
81/* debugfs: registers */ 74/* debugfs: registers */
82 75
83struct reg { 76struct reg {
@@ -265,7 +258,7 @@ static ssize_t write_file_beacon(struct file *file,
265static const struct file_operations fops_beacon = { 258static const struct file_operations fops_beacon = {
266 .read = read_file_beacon, 259 .read = read_file_beacon,
267 .write = write_file_beacon, 260 .write = write_file_beacon,
268 .open = ath5k_debugfs_open, 261 .open = simple_open,
269 .owner = THIS_MODULE, 262 .owner = THIS_MODULE,
270 .llseek = default_llseek, 263 .llseek = default_llseek,
271}; 264};
@@ -285,7 +278,7 @@ static ssize_t write_file_reset(struct file *file,
285 278
286static const struct file_operations fops_reset = { 279static const struct file_operations fops_reset = {
287 .write = write_file_reset, 280 .write = write_file_reset,
288 .open = ath5k_debugfs_open, 281 .open = simple_open,
289 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
290 .llseek = noop_llseek, 283 .llseek = noop_llseek,
291}; 284};
@@ -365,7 +358,7 @@ static ssize_t write_file_debug(struct file *file,
365static const struct file_operations fops_debug = { 358static const struct file_operations fops_debug = {
366 .read = read_file_debug, 359 .read = read_file_debug,
367 .write = write_file_debug, 360 .write = write_file_debug,
368 .open = ath5k_debugfs_open, 361 .open = simple_open,
369 .owner = THIS_MODULE, 362 .owner = THIS_MODULE,
370 .llseek = default_llseek, 363 .llseek = default_llseek,
371}; 364};
@@ -477,7 +470,7 @@ static ssize_t write_file_antenna(struct file *file,
477static const struct file_operations fops_antenna = { 470static const struct file_operations fops_antenna = {
478 .read = read_file_antenna, 471 .read = read_file_antenna,
479 .write = write_file_antenna, 472 .write = write_file_antenna,
480 .open = ath5k_debugfs_open, 473 .open = simple_open,
481 .owner = THIS_MODULE, 474 .owner = THIS_MODULE,
482 .llseek = default_llseek, 475 .llseek = default_llseek,
483}; 476};
@@ -532,7 +525,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
532 525
533static const struct file_operations fops_misc = { 526static const struct file_operations fops_misc = {
534 .read = read_file_misc, 527 .read = read_file_misc,
535 .open = ath5k_debugfs_open, 528 .open = simple_open,
536 .owner = THIS_MODULE, 529 .owner = THIS_MODULE,
537}; 530};
538 531
@@ -647,7 +640,7 @@ static ssize_t write_file_frameerrors(struct file *file,
647static const struct file_operations fops_frameerrors = { 640static const struct file_operations fops_frameerrors = {
648 .read = read_file_frameerrors, 641 .read = read_file_frameerrors,
649 .write = write_file_frameerrors, 642 .write = write_file_frameerrors,
650 .open = ath5k_debugfs_open, 643 .open = simple_open,
651 .owner = THIS_MODULE, 644 .owner = THIS_MODULE,
652 .llseek = default_llseek, 645 .llseek = default_llseek,
653}; 646};
@@ -810,7 +803,7 @@ static ssize_t write_file_ani(struct file *file,
810static const struct file_operations fops_ani = { 803static const struct file_operations fops_ani = {
811 .read = read_file_ani, 804 .read = read_file_ani,
812 .write = write_file_ani, 805 .write = write_file_ani,
813 .open = ath5k_debugfs_open, 806 .open = simple_open,
814 .owner = THIS_MODULE, 807 .owner = THIS_MODULE,
815 .llseek = default_llseek, 808 .llseek = default_llseek,
816}; 809};
@@ -881,7 +874,7 @@ static ssize_t write_file_queue(struct file *file,
881static const struct file_operations fops_queue = { 874static const struct file_operations fops_queue = {
882 .read = read_file_queue, 875 .read = read_file_queue,
883 .write = write_file_queue, 876 .write = write_file_queue,
884 .open = ath5k_debugfs_open, 877 .open = simple_open,
885 .owner = THIS_MODULE, 878 .owner = THIS_MODULE,
886 .llseek = default_llseek, 879 .llseek = default_llseek,
887}; 880};
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 552adb3f80d0..d01403a263ff 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -217,12 +217,6 @@ void dump_cred_dist_stats(struct htc_target *target)
217 target->credit_info->cur_free_credits); 217 target->credit_info->cur_free_credits);
218} 218}
219 219
220static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
221{
222 file->private_data = inode->i_private;
223 return 0;
224}
225
226void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) 220void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
227{ 221{
228 switch (war) { 222 switch (war) {
@@ -263,7 +257,7 @@ static ssize_t read_file_war_stats(struct file *file, char __user *user_buf,
263 257
264static const struct file_operations fops_war_stats = { 258static const struct file_operations fops_war_stats = {
265 .read = read_file_war_stats, 259 .read = read_file_war_stats,
266 .open = ath6kl_debugfs_open, 260 .open = simple_open,
267 .owner = THIS_MODULE, 261 .owner = THIS_MODULE,
268 .llseek = default_llseek, 262 .llseek = default_llseek,
269}; 263};
@@ -488,7 +482,7 @@ static ssize_t ath6kl_fwlog_mask_write(struct file *file,
488} 482}
489 483
490static const struct file_operations fops_fwlog_mask = { 484static const struct file_operations fops_fwlog_mask = {
491 .open = ath6kl_debugfs_open, 485 .open = simple_open,
492 .read = ath6kl_fwlog_mask_read, 486 .read = ath6kl_fwlog_mask_read,
493 .write = ath6kl_fwlog_mask_write, 487 .write = ath6kl_fwlog_mask_write,
494 .owner = THIS_MODULE, 488 .owner = THIS_MODULE,
@@ -634,7 +628,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
634 628
635static const struct file_operations fops_tgt_stats = { 629static const struct file_operations fops_tgt_stats = {
636 .read = read_file_tgt_stats, 630 .read = read_file_tgt_stats,
637 .open = ath6kl_debugfs_open, 631 .open = simple_open,
638 .owner = THIS_MODULE, 632 .owner = THIS_MODULE,
639 .llseek = default_llseek, 633 .llseek = default_llseek,
640}; 634};
@@ -699,7 +693,7 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
699 693
700static const struct file_operations fops_credit_dist_stats = { 694static const struct file_operations fops_credit_dist_stats = {
701 .read = read_file_credit_dist_stats, 695 .read = read_file_credit_dist_stats,
702 .open = ath6kl_debugfs_open, 696 .open = simple_open,
703 .owner = THIS_MODULE, 697 .owner = THIS_MODULE,
704 .llseek = default_llseek, 698 .llseek = default_llseek,
705}; 699};
@@ -802,7 +796,7 @@ static ssize_t ath6kl_endpoint_stats_write(struct file *file,
802} 796}
803 797
804static const struct file_operations fops_endpoint_stats = { 798static const struct file_operations fops_endpoint_stats = {
805 .open = ath6kl_debugfs_open, 799 .open = simple_open,
806 .read = ath6kl_endpoint_stats_read, 800 .read = ath6kl_endpoint_stats_read,
807 .write = ath6kl_endpoint_stats_write, 801 .write = ath6kl_endpoint_stats_write,
808 .owner = THIS_MODULE, 802 .owner = THIS_MODULE,
@@ -875,7 +869,7 @@ static ssize_t ath6kl_regread_write(struct file *file,
875static const struct file_operations fops_diag_reg_read = { 869static const struct file_operations fops_diag_reg_read = {
876 .read = ath6kl_regread_read, 870 .read = ath6kl_regread_read,
877 .write = ath6kl_regread_write, 871 .write = ath6kl_regread_write,
878 .open = ath6kl_debugfs_open, 872 .open = simple_open,
879 .owner = THIS_MODULE, 873 .owner = THIS_MODULE,
880 .llseek = default_llseek, 874 .llseek = default_llseek,
881}; 875};
@@ -999,7 +993,7 @@ static ssize_t ath6kl_lrssi_roam_read(struct file *file,
999static const struct file_operations fops_lrssi_roam_threshold = { 993static const struct file_operations fops_lrssi_roam_threshold = {
1000 .read = ath6kl_lrssi_roam_read, 994 .read = ath6kl_lrssi_roam_read,
1001 .write = ath6kl_lrssi_roam_write, 995 .write = ath6kl_lrssi_roam_write,
1002 .open = ath6kl_debugfs_open, 996 .open = simple_open,
1003 .owner = THIS_MODULE, 997 .owner = THIS_MODULE,
1004 .llseek = default_llseek, 998 .llseek = default_llseek,
1005}; 999};
@@ -1061,7 +1055,7 @@ static ssize_t ath6kl_regwrite_write(struct file *file,
1061static const struct file_operations fops_diag_reg_write = { 1055static const struct file_operations fops_diag_reg_write = {
1062 .read = ath6kl_regwrite_read, 1056 .read = ath6kl_regwrite_read,
1063 .write = ath6kl_regwrite_write, 1057 .write = ath6kl_regwrite_write,
1064 .open = ath6kl_debugfs_open, 1058 .open = simple_open,
1065 .owner = THIS_MODULE, 1059 .owner = THIS_MODULE,
1066 .llseek = default_llseek, 1060 .llseek = default_llseek,
1067}; 1061};
@@ -1166,7 +1160,7 @@ static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf,
1166 1160
1167static const struct file_operations fops_roam_table = { 1161static const struct file_operations fops_roam_table = {
1168 .read = ath6kl_roam_table_read, 1162 .read = ath6kl_roam_table_read,
1169 .open = ath6kl_debugfs_open, 1163 .open = simple_open,
1170 .owner = THIS_MODULE, 1164 .owner = THIS_MODULE,
1171 .llseek = default_llseek, 1165 .llseek = default_llseek,
1172}; 1166};
@@ -1204,7 +1198,7 @@ static ssize_t ath6kl_force_roam_write(struct file *file,
1204 1198
1205static const struct file_operations fops_force_roam = { 1199static const struct file_operations fops_force_roam = {
1206 .write = ath6kl_force_roam_write, 1200 .write = ath6kl_force_roam_write,
1207 .open = ath6kl_debugfs_open, 1201 .open = simple_open,
1208 .owner = THIS_MODULE, 1202 .owner = THIS_MODULE,
1209 .llseek = default_llseek, 1203 .llseek = default_llseek,
1210}; 1204};
@@ -1244,7 +1238,7 @@ static ssize_t ath6kl_roam_mode_write(struct file *file,
1244 1238
1245static const struct file_operations fops_roam_mode = { 1239static const struct file_operations fops_roam_mode = {
1246 .write = ath6kl_roam_mode_write, 1240 .write = ath6kl_roam_mode_write,
1247 .open = ath6kl_debugfs_open, 1241 .open = simple_open,
1248 .owner = THIS_MODULE, 1242 .owner = THIS_MODULE,
1249 .llseek = default_llseek, 1243 .llseek = default_llseek,
1250}; 1244};
@@ -1286,7 +1280,7 @@ static ssize_t ath6kl_keepalive_write(struct file *file,
1286} 1280}
1287 1281
1288static const struct file_operations fops_keepalive = { 1282static const struct file_operations fops_keepalive = {
1289 .open = ath6kl_debugfs_open, 1283 .open = simple_open,
1290 .read = ath6kl_keepalive_read, 1284 .read = ath6kl_keepalive_read,
1291 .write = ath6kl_keepalive_write, 1285 .write = ath6kl_keepalive_write,
1292 .owner = THIS_MODULE, 1286 .owner = THIS_MODULE,
@@ -1331,7 +1325,7 @@ static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
1331} 1325}
1332 1326
1333static const struct file_operations fops_disconnect_timeout = { 1327static const struct file_operations fops_disconnect_timeout = {
1334 .open = ath6kl_debugfs_open, 1328 .open = simple_open,
1335 .read = ath6kl_disconnect_timeout_read, 1329 .read = ath6kl_disconnect_timeout_read,
1336 .write = ath6kl_disconnect_timeout_write, 1330 .write = ath6kl_disconnect_timeout_write,
1337 .owner = THIS_MODULE, 1331 .owner = THIS_MODULE,
@@ -1512,7 +1506,7 @@ static ssize_t ath6kl_create_qos_write(struct file *file,
1512 1506
1513static const struct file_operations fops_create_qos = { 1507static const struct file_operations fops_create_qos = {
1514 .write = ath6kl_create_qos_write, 1508 .write = ath6kl_create_qos_write,
1515 .open = ath6kl_debugfs_open, 1509 .open = simple_open,
1516 .owner = THIS_MODULE, 1510 .owner = THIS_MODULE,
1517 .llseek = default_llseek, 1511 .llseek = default_llseek,
1518}; 1512};
@@ -1560,7 +1554,7 @@ static ssize_t ath6kl_delete_qos_write(struct file *file,
1560 1554
1561static const struct file_operations fops_delete_qos = { 1555static const struct file_operations fops_delete_qos = {
1562 .write = ath6kl_delete_qos_write, 1556 .write = ath6kl_delete_qos_write,
1563 .open = ath6kl_debugfs_open, 1557 .open = simple_open,
1564 .owner = THIS_MODULE, 1558 .owner = THIS_MODULE,
1565 .llseek = default_llseek, 1559 .llseek = default_llseek,
1566}; 1560};
@@ -1593,7 +1587,7 @@ static ssize_t ath6kl_bgscan_int_write(struct file *file,
1593 1587
1594static const struct file_operations fops_bgscan_int = { 1588static const struct file_operations fops_bgscan_int = {
1595 .write = ath6kl_bgscan_int_write, 1589 .write = ath6kl_bgscan_int_write,
1596 .open = ath6kl_debugfs_open, 1590 .open = simple_open,
1597 .owner = THIS_MODULE, 1591 .owner = THIS_MODULE,
1598 .llseek = default_llseek, 1592 .llseek = default_llseek,
1599}; 1593};
@@ -1651,7 +1645,7 @@ static ssize_t ath6kl_listen_int_read(struct file *file,
1651static const struct file_operations fops_listen_int = { 1645static const struct file_operations fops_listen_int = {
1652 .read = ath6kl_listen_int_read, 1646 .read = ath6kl_listen_int_read,
1653 .write = ath6kl_listen_int_write, 1647 .write = ath6kl_listen_int_write,
1654 .open = ath6kl_debugfs_open, 1648 .open = simple_open,
1655 .owner = THIS_MODULE, 1649 .owner = THIS_MODULE,
1656 .llseek = default_llseek, 1650 .llseek = default_llseek,
1657}; 1651};
@@ -1711,7 +1705,7 @@ static ssize_t ath6kl_power_params_write(struct file *file,
1711 1705
1712static const struct file_operations fops_power_params = { 1706static const struct file_operations fops_power_params = {
1713 .write = ath6kl_power_params_write, 1707 .write = ath6kl_power_params_write,
1714 .open = ath6kl_debugfs_open, 1708 .open = simple_open,
1715 .owner = THIS_MODULE, 1709 .owner = THIS_MODULE,
1716 .llseek = default_llseek, 1710 .llseek = default_llseek,
1717}; 1711};
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 35d1c8e91d1c..ff47b32ecaf4 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -26,11 +26,6 @@
26#define REG_READ_D(_ah, _reg) \ 26#define REG_READ_D(_ah, _reg) \
27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
28 28
29static int ath9k_debugfs_open(struct inode *inode, struct file *file)
30{
31 file->private_data = inode->i_private;
32 return 0;
33}
34 29
35static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, 30static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
36 size_t count, loff_t *ppos) 31 size_t count, loff_t *ppos)
@@ -83,7 +78,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
83static const struct file_operations fops_debug = { 78static const struct file_operations fops_debug = {
84 .read = read_file_debug, 79 .read = read_file_debug,
85 .write = write_file_debug, 80 .write = write_file_debug,
86 .open = ath9k_debugfs_open, 81 .open = simple_open,
87 .owner = THIS_MODULE, 82 .owner = THIS_MODULE,
88 .llseek = default_llseek, 83 .llseek = default_llseek,
89}; 84};
@@ -129,7 +124,7 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use
129static const struct file_operations fops_tx_chainmask = { 124static const struct file_operations fops_tx_chainmask = {
130 .read = read_file_tx_chainmask, 125 .read = read_file_tx_chainmask,
131 .write = write_file_tx_chainmask, 126 .write = write_file_tx_chainmask,
132 .open = ath9k_debugfs_open, 127 .open = simple_open,
133 .owner = THIS_MODULE, 128 .owner = THIS_MODULE,
134 .llseek = default_llseek, 129 .llseek = default_llseek,
135}; 130};
@@ -172,7 +167,7 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use
172static const struct file_operations fops_rx_chainmask = { 167static const struct file_operations fops_rx_chainmask = {
173 .read = read_file_rx_chainmask, 168 .read = read_file_rx_chainmask,
174 .write = write_file_rx_chainmask, 169 .write = write_file_rx_chainmask,
175 .open = ath9k_debugfs_open, 170 .open = simple_open,
176 .owner = THIS_MODULE, 171 .owner = THIS_MODULE,
177 .llseek = default_llseek, 172 .llseek = default_llseek,
178}; 173};
@@ -223,7 +218,7 @@ static ssize_t write_file_disable_ani(struct file *file,
223static const struct file_operations fops_disable_ani = { 218static const struct file_operations fops_disable_ani = {
224 .read = read_file_disable_ani, 219 .read = read_file_disable_ani,
225 .write = write_file_disable_ani, 220 .write = write_file_disable_ani,
226 .open = ath9k_debugfs_open, 221 .open = simple_open,
227 .owner = THIS_MODULE, 222 .owner = THIS_MODULE,
228 .llseek = default_llseek, 223 .llseek = default_llseek,
229}; 224};
@@ -324,7 +319,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
324 319
325static const struct file_operations fops_dma = { 320static const struct file_operations fops_dma = {
326 .read = read_file_dma, 321 .read = read_file_dma,
327 .open = ath9k_debugfs_open, 322 .open = simple_open,
328 .owner = THIS_MODULE, 323 .owner = THIS_MODULE,
329 .llseek = default_llseek, 324 .llseek = default_llseek,
330}; 325};
@@ -446,7 +441,7 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
446 441
447static const struct file_operations fops_interrupt = { 442static const struct file_operations fops_interrupt = {
448 .read = read_file_interrupt, 443 .read = read_file_interrupt,
449 .open = ath9k_debugfs_open, 444 .open = simple_open,
450 .owner = THIS_MODULE, 445 .owner = THIS_MODULE,
451 .llseek = default_llseek, 446 .llseek = default_llseek,
452}; 447};
@@ -852,28 +847,28 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
852 847
853static const struct file_operations fops_xmit = { 848static const struct file_operations fops_xmit = {
854 .read = read_file_xmit, 849 .read = read_file_xmit,
855 .open = ath9k_debugfs_open, 850 .open = simple_open,
856 .owner = THIS_MODULE, 851 .owner = THIS_MODULE,
857 .llseek = default_llseek, 852 .llseek = default_llseek,
858}; 853};
859 854
860static const struct file_operations fops_stations = { 855static const struct file_operations fops_stations = {
861 .read = read_file_stations, 856 .read = read_file_stations,
862 .open = ath9k_debugfs_open, 857 .open = simple_open,
863 .owner = THIS_MODULE, 858 .owner = THIS_MODULE,
864 .llseek = default_llseek, 859 .llseek = default_llseek,
865}; 860};
866 861
867static const struct file_operations fops_misc = { 862static const struct file_operations fops_misc = {
868 .read = read_file_misc, 863 .read = read_file_misc,
869 .open = ath9k_debugfs_open, 864 .open = simple_open,
870 .owner = THIS_MODULE, 865 .owner = THIS_MODULE,
871 .llseek = default_llseek, 866 .llseek = default_llseek,
872}; 867};
873 868
874static const struct file_operations fops_reset = { 869static const struct file_operations fops_reset = {
875 .read = read_file_reset, 870 .read = read_file_reset,
876 .open = ath9k_debugfs_open, 871 .open = simple_open,
877 .owner = THIS_MODULE, 872 .owner = THIS_MODULE,
878 .llseek = default_llseek, 873 .llseek = default_llseek,
879}; 874};
@@ -1016,7 +1011,7 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
1016 1011
1017static const struct file_operations fops_recv = { 1012static const struct file_operations fops_recv = {
1018 .read = read_file_recv, 1013 .read = read_file_recv,
1019 .open = ath9k_debugfs_open, 1014 .open = simple_open,
1020 .owner = THIS_MODULE, 1015 .owner = THIS_MODULE,
1021 .llseek = default_llseek, 1016 .llseek = default_llseek,
1022}; 1017};
@@ -1055,7 +1050,7 @@ static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
1055static const struct file_operations fops_regidx = { 1050static const struct file_operations fops_regidx = {
1056 .read = read_file_regidx, 1051 .read = read_file_regidx,
1057 .write = write_file_regidx, 1052 .write = write_file_regidx,
1058 .open = ath9k_debugfs_open, 1053 .open = simple_open,
1059 .owner = THIS_MODULE, 1054 .owner = THIS_MODULE,
1060 .llseek = default_llseek, 1055 .llseek = default_llseek,
1061}; 1056};
@@ -1102,7 +1097,7 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
1102static const struct file_operations fops_regval = { 1097static const struct file_operations fops_regval = {
1103 .read = read_file_regval, 1098 .read = read_file_regval,
1104 .write = write_file_regval, 1099 .write = write_file_regval,
1105 .open = ath9k_debugfs_open, 1100 .open = simple_open,
1106 .owner = THIS_MODULE, 1101 .owner = THIS_MODULE,
1107 .llseek = default_llseek, 1102 .llseek = default_llseek,
1108}; 1103};
@@ -1191,7 +1186,7 @@ static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf,
1191 1186
1192static const struct file_operations fops_dump_nfcal = { 1187static const struct file_operations fops_dump_nfcal = {
1193 .read = read_file_dump_nfcal, 1188 .read = read_file_dump_nfcal,
1194 .open = ath9k_debugfs_open, 1189 .open = simple_open,
1195 .owner = THIS_MODULE, 1190 .owner = THIS_MODULE,
1196 .llseek = default_llseek, 1191 .llseek = default_llseek,
1197}; 1192};
@@ -1219,7 +1214,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
1219 1214
1220static const struct file_operations fops_base_eeprom = { 1215static const struct file_operations fops_base_eeprom = {
1221 .read = read_file_base_eeprom, 1216 .read = read_file_base_eeprom,
1222 .open = ath9k_debugfs_open, 1217 .open = simple_open,
1223 .owner = THIS_MODULE, 1218 .owner = THIS_MODULE,
1224 .llseek = default_llseek, 1219 .llseek = default_llseek,
1225}; 1220};
@@ -1247,7 +1242,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
1247 1242
1248static const struct file_operations fops_modal_eeprom = { 1243static const struct file_operations fops_modal_eeprom = {
1249 .read = read_file_modal_eeprom, 1244 .read = read_file_modal_eeprom,
1250 .open = ath9k_debugfs_open, 1245 .open = simple_open,
1251 .owner = THIS_MODULE, 1246 .owner = THIS_MODULE,
1252 .llseek = default_llseek, 1247 .llseek = default_llseek,
1253}; 1248};
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c
index 106d031d834a..4364c103ed33 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_debug.c
+++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c
@@ -60,16 +60,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
60 return retval; 60 return retval;
61} 61}
62 62
63static int ath9k_dfs_debugfs_open(struct inode *inode, struct file *file)
64{
65 file->private_data = inode->i_private;
66
67 return 0;
68}
69
70static const struct file_operations fops_dfs_stats = { 63static const struct file_operations fops_dfs_stats = {
71 .read = read_file_dfs, 64 .read = read_file_dfs,
72 .open = ath9k_dfs_debugfs_open, 65 .open = simple_open,
73 .owner = THIS_MODULE, 66 .owner = THIS_MODULE,
74 .llseek = default_llseek, 67 .llseek = default_llseek,
75}; 68};
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index d3ff33c71aa5..3035deb7a0cd 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -16,12 +16,6 @@
16 16
17#include "htc.h" 17#include "htc.h"
18 18
19static int ath9k_debugfs_open(struct inode *inode, struct file *file)
20{
21 file->private_data = inode->i_private;
22 return 0;
23}
24
25static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, 19static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
26 size_t count, loff_t *ppos) 20 size_t count, loff_t *ppos)
27{ 21{
@@ -75,7 +69,7 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
75 69
76static const struct file_operations fops_tgt_int_stats = { 70static const struct file_operations fops_tgt_int_stats = {
77 .read = read_file_tgt_int_stats, 71 .read = read_file_tgt_int_stats,
78 .open = ath9k_debugfs_open, 72 .open = simple_open,
79 .owner = THIS_MODULE, 73 .owner = THIS_MODULE,
80 .llseek = default_llseek, 74 .llseek = default_llseek,
81}; 75};
@@ -145,7 +139,7 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf,
145 139
146static const struct file_operations fops_tgt_tx_stats = { 140static const struct file_operations fops_tgt_tx_stats = {
147 .read = read_file_tgt_tx_stats, 141 .read = read_file_tgt_tx_stats,
148 .open = ath9k_debugfs_open, 142 .open = simple_open,
149 .owner = THIS_MODULE, 143 .owner = THIS_MODULE,
150 .llseek = default_llseek, 144 .llseek = default_llseek,
151}; 145};
@@ -191,7 +185,7 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf,
191 185
192static const struct file_operations fops_tgt_rx_stats = { 186static const struct file_operations fops_tgt_rx_stats = {
193 .read = read_file_tgt_rx_stats, 187 .read = read_file_tgt_rx_stats,
194 .open = ath9k_debugfs_open, 188 .open = simple_open,
195 .owner = THIS_MODULE, 189 .owner = THIS_MODULE,
196 .llseek = default_llseek, 190 .llseek = default_llseek,
197}; 191};
@@ -243,7 +237,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
243 237
244static const struct file_operations fops_xmit = { 238static const struct file_operations fops_xmit = {
245 .read = read_file_xmit, 239 .read = read_file_xmit,
246 .open = ath9k_debugfs_open, 240 .open = simple_open,
247 .owner = THIS_MODULE, 241 .owner = THIS_MODULE,
248 .llseek = default_llseek, 242 .llseek = default_llseek,
249}; 243};
@@ -364,7 +358,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
364 358
365static const struct file_operations fops_recv = { 359static const struct file_operations fops_recv = {
366 .read = read_file_recv, 360 .read = read_file_recv,
367 .open = ath9k_debugfs_open, 361 .open = simple_open,
368 .owner = THIS_MODULE, 362 .owner = THIS_MODULE,
369 .llseek = default_llseek, 363 .llseek = default_llseek,
370}; 364};
@@ -399,7 +393,7 @@ static ssize_t read_file_slot(struct file *file, char __user *user_buf,
399 393
400static const struct file_operations fops_slot = { 394static const struct file_operations fops_slot = {
401 .read = read_file_slot, 395 .read = read_file_slot,
402 .open = ath9k_debugfs_open, 396 .open = simple_open,
403 .owner = THIS_MODULE, 397 .owner = THIS_MODULE,
404 .llseek = default_llseek, 398 .llseek = default_llseek,
405}; 399};
@@ -446,7 +440,7 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
446 440
447static const struct file_operations fops_queue = { 441static const struct file_operations fops_queue = {
448 .read = read_file_queue, 442 .read = read_file_queue,
449 .open = ath9k_debugfs_open, 443 .open = simple_open,
450 .owner = THIS_MODULE, 444 .owner = THIS_MODULE,
451 .llseek = default_llseek, 445 .llseek = default_llseek,
452}; 446};
@@ -487,7 +481,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
487static const struct file_operations fops_debug = { 481static const struct file_operations fops_debug = {
488 .read = read_file_debug, 482 .read = read_file_debug,
489 .write = write_file_debug, 483 .write = write_file_debug,
490 .open = ath9k_debugfs_open, 484 .open = simple_open,
491 .owner = THIS_MODULE, 485 .owner = THIS_MODULE,
492 .llseek = default_llseek, 486 .llseek = default_llseek,
493}; 487};
@@ -636,7 +630,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
636 630
637static const struct file_operations fops_base_eeprom = { 631static const struct file_operations fops_base_eeprom = {
638 .read = read_file_base_eeprom, 632 .read = read_file_base_eeprom,
639 .open = ath9k_debugfs_open, 633 .open = simple_open,
640 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
641 .llseek = default_llseek, 635 .llseek = default_llseek,
642}; 636};
@@ -917,7 +911,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf,
917 911
918static const struct file_operations fops_modal_eeprom = { 912static const struct file_operations fops_modal_eeprom = {
919 .read = read_file_modal_eeprom, 913 .read = read_file_modal_eeprom,
920 .open = ath9k_debugfs_open, 914 .open = simple_open,
921 .owner = THIS_MODULE, 915 .owner = THIS_MODULE,
922 .llseek = default_llseek, 916 .llseek = default_llseek,
923}; 917};
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 4f848493fece..08bb45532701 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1480,12 +1480,6 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1480 1480
1481#ifdef CONFIG_ATH9K_DEBUGFS 1481#ifdef CONFIG_ATH9K_DEBUGFS
1482 1482
1483static int ath9k_debugfs_open(struct inode *inode, struct file *file)
1484{
1485 file->private_data = inode->i_private;
1486 return 0;
1487}
1488
1489static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, 1483static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
1490 size_t count, loff_t *ppos) 1484 size_t count, loff_t *ppos)
1491{ 1485{
@@ -1553,7 +1547,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
1553 1547
1554static const struct file_operations fops_rcstat = { 1548static const struct file_operations fops_rcstat = {
1555 .read = read_file_rcstat, 1549 .read = read_file_rcstat,
1556 .open = ath9k_debugfs_open, 1550 .open = simple_open,
1557 .owner = THIS_MODULE 1551 .owner = THIS_MODULE
1558}; 1552};
1559 1553
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
index 3c164226687f..93fe6003a493 100644
--- a/drivers/net/wireless/ath/carl9170/debug.c
+++ b/drivers/net/wireless/ath/carl9170/debug.c
@@ -48,11 +48,6 @@
48#define ADD(buf, off, max, fmt, args...) \ 48#define ADD(buf, off, max, fmt, args...) \
49 off += snprintf(&buf[off], max - off, fmt, ##args); 49 off += snprintf(&buf[off], max - off, fmt, ##args);
50 50
51static int carl9170_debugfs_open(struct inode *inode, struct file *file)
52{
53 file->private_data = inode->i_private;
54 return 0;
55}
56 51
57struct carl9170_debugfs_fops { 52struct carl9170_debugfs_fops {
58 unsigned int read_bufsize; 53 unsigned int read_bufsize;
@@ -178,7 +173,7 @@ static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
178 .attr = _attr, \ 173 .attr = _attr, \
179 .req_dev_state = _dstate, \ 174 .req_dev_state = _dstate, \
180 .fops = { \ 175 .fops = { \
181 .open = carl9170_debugfs_open, \ 176 .open = simple_open, \
182 .read = carl9170_debugfs_read, \ 177 .read = carl9170_debugfs_read, \
183 .write = carl9170_debugfs_write, \ 178 .write = carl9170_debugfs_write, \
184 .owner = THIS_MODULE \ 179 .owner = THIS_MODULE \
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index e751fdee89b2..e807bd930647 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -500,12 +500,6 @@ out:
500 500
501#undef fappend 501#undef fappend
502 502
503static int b43_debugfs_open(struct inode *inode, struct file *file)
504{
505 file->private_data = inode->i_private;
506 return 0;
507}
508
509static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, 503static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf,
510 size_t count, loff_t *ppos) 504 size_t count, loff_t *ppos)
511{ 505{
@@ -624,7 +618,7 @@ out_unlock:
624 .read = _read, \ 618 .read = _read, \
625 .write = _write, \ 619 .write = _write, \
626 .fops = { \ 620 .fops = { \
627 .open = b43_debugfs_open, \ 621 .open = simple_open, \
628 .read = b43_debugfs_read, \ 622 .read = b43_debugfs_read, \
629 .write = b43_debugfs_write, \ 623 .write = b43_debugfs_write, \
630 .llseek = generic_file_llseek, \ 624 .llseek = generic_file_llseek, \
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c
index 5e28ad0d6d17..1965edb765a2 100644
--- a/drivers/net/wireless/b43legacy/debugfs.c
+++ b/drivers/net/wireless/b43legacy/debugfs.c
@@ -197,12 +197,6 @@ static int restart_write_file(struct b43legacy_wldev *dev, const char *buf, size
197 197
198#undef fappend 198#undef fappend
199 199
200static int b43legacy_debugfs_open(struct inode *inode, struct file *file)
201{
202 file->private_data = inode->i_private;
203 return 0;
204}
205
206static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, 200static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
207 size_t count, loff_t *ppos) 201 size_t count, loff_t *ppos)
208{ 202{
@@ -331,7 +325,7 @@ out_unlock:
331 .read = _read, \ 325 .read = _read, \
332 .write = _write, \ 326 .write = _write, \
333 .fops = { \ 327 .fops = { \
334 .open = b43legacy_debugfs_open, \ 328 .open = simple_open, \
335 .read = b43legacy_debugfs_read, \ 329 .read = b43legacy_debugfs_read, \
336 .write = b43legacy_debugfs_write, \ 330 .write = b43legacy_debugfs_write, \
337 .llseek = generic_file_llseek, \ 331 .llseek = generic_file_llseek, \
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index 70bee1a4d876..4b10157d8686 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -821,12 +821,6 @@ out:
821} 821}
822 822
823#ifdef CONFIG_MAC80211_DEBUGFS 823#ifdef CONFIG_MAC80211_DEBUGFS
824static int
825il3945_open_file_generic(struct inode *inode, struct file *file)
826{
827 file->private_data = inode->i_private;
828 return 0;
829}
830 824
831static ssize_t 825static ssize_t
832il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, 826il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf,
@@ -862,7 +856,7 @@ il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf,
862 856
863static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 857static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
864 .read = il3945_sta_dbgfs_stats_table_read, 858 .read = il3945_sta_dbgfs_stats_table_read,
865 .open = il3945_open_file_generic, 859 .open = simple_open,
866 .llseek = default_llseek, 860 .llseek = default_llseek,
867}; 861};
868 862
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index d7e2856e41d3..11ab1247fae1 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2518,12 +2518,6 @@ il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta)
2518} 2518}
2519 2519
2520#ifdef CONFIG_MAC80211_DEBUGFS 2520#ifdef CONFIG_MAC80211_DEBUGFS
2521static int
2522il4965_open_file_generic(struct inode *inode, struct file *file)
2523{
2524 file->private_data = inode->i_private;
2525 return 0;
2526}
2527 2521
2528static void 2522static void
2529il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) 2523il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx)
@@ -2695,7 +2689,7 @@ il4965_rs_sta_dbgfs_scale_table_read(struct file *file, char __user *user_buf,
2695static const struct file_operations rs_sta_dbgfs_scale_table_ops = { 2689static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
2696 .write = il4965_rs_sta_dbgfs_scale_table_write, 2690 .write = il4965_rs_sta_dbgfs_scale_table_write,
2697 .read = il4965_rs_sta_dbgfs_scale_table_read, 2691 .read = il4965_rs_sta_dbgfs_scale_table_read,
2698 .open = il4965_open_file_generic, 2692 .open = simple_open,
2699 .llseek = default_llseek, 2693 .llseek = default_llseek,
2700}; 2694};
2701 2695
@@ -2740,7 +2734,7 @@ il4965_rs_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf,
2740 2734
2741static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 2735static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
2742 .read = il4965_rs_sta_dbgfs_stats_table_read, 2736 .read = il4965_rs_sta_dbgfs_stats_table_read,
2743 .open = il4965_open_file_generic, 2737 .open = simple_open,
2744 .llseek = default_llseek, 2738 .llseek = default_llseek,
2745}; 2739};
2746 2740
@@ -2768,7 +2762,7 @@ il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file,
2768 2762
2769static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 2763static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
2770 .read = il4965_rs_sta_dbgfs_rate_scale_data_read, 2764 .read = il4965_rs_sta_dbgfs_rate_scale_data_read,
2771 .open = il4965_open_file_generic, 2765 .open = simple_open,
2772 .llseek = default_llseek, 2766 .llseek = default_llseek,
2773}; 2767};
2774 2768
diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c
index 229849150aac..eff26501d60a 100644
--- a/drivers/net/wireless/iwlegacy/debug.c
+++ b/drivers/net/wireless/iwlegacy/debug.c
@@ -160,18 +160,12 @@ static ssize_t il_dbgfs_##name##_write(struct file *file, \
160 const char __user *user_buf, \ 160 const char __user *user_buf, \
161 size_t count, loff_t *ppos); 161 size_t count, loff_t *ppos);
162 162
163static int
164il_dbgfs_open_file_generic(struct inode *inode, struct file *file)
165{
166 file->private_data = inode->i_private;
167 return 0;
168}
169 163
170#define DEBUGFS_READ_FILE_OPS(name) \ 164#define DEBUGFS_READ_FILE_OPS(name) \
171 DEBUGFS_READ_FUNC(name); \ 165 DEBUGFS_READ_FUNC(name); \
172static const struct file_operations il_dbgfs_##name##_ops = { \ 166static const struct file_operations il_dbgfs_##name##_ops = { \
173 .read = il_dbgfs_##name##_read, \ 167 .read = il_dbgfs_##name##_read, \
174 .open = il_dbgfs_open_file_generic, \ 168 .open = simple_open, \
175 .llseek = generic_file_llseek, \ 169 .llseek = generic_file_llseek, \
176}; 170};
177 171
@@ -179,7 +173,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \
179 DEBUGFS_WRITE_FUNC(name); \ 173 DEBUGFS_WRITE_FUNC(name); \
180static const struct file_operations il_dbgfs_##name##_ops = { \ 174static const struct file_operations il_dbgfs_##name##_ops = { \
181 .write = il_dbgfs_##name##_write, \ 175 .write = il_dbgfs_##name##_write, \
182 .open = il_dbgfs_open_file_generic, \ 176 .open = simple_open, \
183 .llseek = generic_file_llseek, \ 177 .llseek = generic_file_llseek, \
184}; 178};
185 179
@@ -189,7 +183,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \
189static const struct file_operations il_dbgfs_##name##_ops = { \ 183static const struct file_operations il_dbgfs_##name##_ops = { \
190 .write = il_dbgfs_##name##_write, \ 184 .write = il_dbgfs_##name##_write, \
191 .read = il_dbgfs_##name##_read, \ 185 .read = il_dbgfs_##name##_read, \
192 .open = il_dbgfs_open_file_generic, \ 186 .open = simple_open, \
193 .llseek = generic_file_llseek, \ 187 .llseek = generic_file_llseek, \
194}; 188};
195 189
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 53f8c51cfcdb..7e590b349dd7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -3083,11 +3083,6 @@ static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
3083} 3083}
3084 3084
3085#ifdef CONFIG_MAC80211_DEBUGFS 3085#ifdef CONFIG_MAC80211_DEBUGFS
3086static int open_file_generic(struct inode *inode, struct file *file)
3087{
3088 file->private_data = inode->i_private;
3089 return 0;
3090}
3091static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, 3086static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
3092 u32 *rate_n_flags, int index) 3087 u32 *rate_n_flags, int index)
3093{ 3088{
@@ -3226,7 +3221,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
3226static const struct file_operations rs_sta_dbgfs_scale_table_ops = { 3221static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
3227 .write = rs_sta_dbgfs_scale_table_write, 3222 .write = rs_sta_dbgfs_scale_table_write,
3228 .read = rs_sta_dbgfs_scale_table_read, 3223 .read = rs_sta_dbgfs_scale_table_read,
3229 .open = open_file_generic, 3224 .open = simple_open,
3230 .llseek = default_llseek, 3225 .llseek = default_llseek,
3231}; 3226};
3232static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, 3227static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
@@ -3269,7 +3264,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
3269 3264
3270static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 3265static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
3271 .read = rs_sta_dbgfs_stats_table_read, 3266 .read = rs_sta_dbgfs_stats_table_read,
3272 .open = open_file_generic, 3267 .open = simple_open,
3273 .llseek = default_llseek, 3268 .llseek = default_llseek,
3274}; 3269};
3275 3270
@@ -3295,7 +3290,7 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
3295 3290
3296static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 3291static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
3297 .read = rs_sta_dbgfs_rate_scale_data_read, 3292 .read = rs_sta_dbgfs_rate_scale_data_read,
3298 .open = open_file_generic, 3293 .open = simple_open,
3299 .llseek = default_llseek, 3294 .llseek = default_llseek,
3300}; 3295};
3301 3296
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index b7b1c04f2fba..2bbaebd99ad4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -84,17 +84,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
84 size_t count, loff_t *ppos); 84 size_t count, loff_t *ppos);
85 85
86 86
87static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
88{
89 file->private_data = inode->i_private;
90 return 0;
91}
92
93#define DEBUGFS_READ_FILE_OPS(name) \ 87#define DEBUGFS_READ_FILE_OPS(name) \
94 DEBUGFS_READ_FUNC(name); \ 88 DEBUGFS_READ_FUNC(name); \
95static const struct file_operations iwl_dbgfs_##name##_ops = { \ 89static const struct file_operations iwl_dbgfs_##name##_ops = { \
96 .read = iwl_dbgfs_##name##_read, \ 90 .read = iwl_dbgfs_##name##_read, \
97 .open = iwl_dbgfs_open_file_generic, \ 91 .open = simple_open, \
98 .llseek = generic_file_llseek, \ 92 .llseek = generic_file_llseek, \
99}; 93};
100 94
@@ -102,7 +96,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
102 DEBUGFS_WRITE_FUNC(name); \ 96 DEBUGFS_WRITE_FUNC(name); \
103static const struct file_operations iwl_dbgfs_##name##_ops = { \ 97static const struct file_operations iwl_dbgfs_##name##_ops = { \
104 .write = iwl_dbgfs_##name##_write, \ 98 .write = iwl_dbgfs_##name##_write, \
105 .open = iwl_dbgfs_open_file_generic, \ 99 .open = simple_open, \
106 .llseek = generic_file_llseek, \ 100 .llseek = generic_file_llseek, \
107}; 101};
108 102
@@ -113,7 +107,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
113static const struct file_operations iwl_dbgfs_##name##_ops = { \ 107static const struct file_operations iwl_dbgfs_##name##_ops = { \
114 .write = iwl_dbgfs_##name##_write, \ 108 .write = iwl_dbgfs_##name##_write, \
115 .read = iwl_dbgfs_##name##_read, \ 109 .read = iwl_dbgfs_##name##_read, \
116 .open = iwl_dbgfs_open_file_generic, \ 110 .open = simple_open, \
117 .llseek = generic_file_llseek, \ 111 .llseek = generic_file_llseek, \
118}; 112};
119 113
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index b4f796c82e1e..4d7b30d3e648 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -1898,17 +1898,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
1898 size_t count, loff_t *ppos); 1898 size_t count, loff_t *ppos);
1899 1899
1900 1900
1901static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
1902{
1903 file->private_data = inode->i_private;
1904 return 0;
1905}
1906
1907#define DEBUGFS_READ_FILE_OPS(name) \ 1901#define DEBUGFS_READ_FILE_OPS(name) \
1908 DEBUGFS_READ_FUNC(name); \ 1902 DEBUGFS_READ_FUNC(name); \
1909static const struct file_operations iwl_dbgfs_##name##_ops = { \ 1903static const struct file_operations iwl_dbgfs_##name##_ops = { \
1910 .read = iwl_dbgfs_##name##_read, \ 1904 .read = iwl_dbgfs_##name##_read, \
1911 .open = iwl_dbgfs_open_file_generic, \ 1905 .open = simple_open, \
1912 .llseek = generic_file_llseek, \ 1906 .llseek = generic_file_llseek, \
1913}; 1907};
1914 1908
@@ -1916,7 +1910,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
1916 DEBUGFS_WRITE_FUNC(name); \ 1910 DEBUGFS_WRITE_FUNC(name); \
1917static const struct file_operations iwl_dbgfs_##name##_ops = { \ 1911static const struct file_operations iwl_dbgfs_##name##_ops = { \
1918 .write = iwl_dbgfs_##name##_write, \ 1912 .write = iwl_dbgfs_##name##_write, \
1919 .open = iwl_dbgfs_open_file_generic, \ 1913 .open = simple_open, \
1920 .llseek = generic_file_llseek, \ 1914 .llseek = generic_file_llseek, \
1921}; 1915};
1922 1916
@@ -1926,7 +1920,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
1926static const struct file_operations iwl_dbgfs_##name##_ops = { \ 1920static const struct file_operations iwl_dbgfs_##name##_ops = { \
1927 .write = iwl_dbgfs_##name##_write, \ 1921 .write = iwl_dbgfs_##name##_write, \
1928 .read = iwl_dbgfs_##name##_read, \ 1922 .read = iwl_dbgfs_##name##_read, \
1929 .open = iwl_dbgfs_open_file_generic, \ 1923 .open = simple_open, \
1930 .llseek = generic_file_llseek, \ 1924 .llseek = generic_file_llseek, \
1931}; 1925};
1932 1926
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
index 87eef5773a02..b6199d124bb9 100644
--- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
@@ -99,12 +99,6 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iwm_dbg_modules,
99 iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write, 99 iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write,
100 "%llu\n"); 100 "%llu\n");
101 101
102static int iwm_generic_open(struct inode *inode, struct file *filp)
103{
104 filp->private_data = inode->i_private;
105 return 0;
106}
107
108 102
109static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer, 103static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer,
110 size_t count, loff_t *ppos) 104 size_t count, loff_t *ppos)
@@ -401,28 +395,28 @@ out:
401 395
402static const struct file_operations iwm_debugfs_txq_fops = { 396static const struct file_operations iwm_debugfs_txq_fops = {
403 .owner = THIS_MODULE, 397 .owner = THIS_MODULE,
404 .open = iwm_generic_open, 398 .open = simple_open,
405 .read = iwm_debugfs_txq_read, 399 .read = iwm_debugfs_txq_read,
406 .llseek = default_llseek, 400 .llseek = default_llseek,
407}; 401};
408 402
409static const struct file_operations iwm_debugfs_tx_credit_fops = { 403static const struct file_operations iwm_debugfs_tx_credit_fops = {
410 .owner = THIS_MODULE, 404 .owner = THIS_MODULE,
411 .open = iwm_generic_open, 405 .open = simple_open,
412 .read = iwm_debugfs_tx_credit_read, 406 .read = iwm_debugfs_tx_credit_read,
413 .llseek = default_llseek, 407 .llseek = default_llseek,
414}; 408};
415 409
416static const struct file_operations iwm_debugfs_rx_ticket_fops = { 410static const struct file_operations iwm_debugfs_rx_ticket_fops = {
417 .owner = THIS_MODULE, 411 .owner = THIS_MODULE,
418 .open = iwm_generic_open, 412 .open = simple_open,
419 .read = iwm_debugfs_rx_ticket_read, 413 .read = iwm_debugfs_rx_ticket_read,
420 .llseek = default_llseek, 414 .llseek = default_llseek,
421}; 415};
422 416
423static const struct file_operations iwm_debugfs_fw_err_fops = { 417static const struct file_operations iwm_debugfs_fw_err_fops = {
424 .owner = THIS_MODULE, 418 .owner = THIS_MODULE,
425 .open = iwm_generic_open, 419 .open = simple_open,
426 .read = iwm_debugfs_fw_err_read, 420 .read = iwm_debugfs_fw_err_read,
427 .llseek = default_llseek, 421 .llseek = default_llseek,
428}; 422};
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index 764b40dd24ad..0042f204b07f 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -264,13 +264,6 @@ static int if_sdio_send_chunk(struct iwm_priv *iwm, u8 *buf, int count)
264 return ret; 264 return ret;
265} 265}
266 266
267/* debugfs hooks */
268static int iwm_debugfs_sdio_open(struct inode *inode, struct file *filp)
269{
270 filp->private_data = inode->i_private;
271 return 0;
272}
273
274static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer, 267static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer,
275 size_t count, loff_t *ppos) 268 size_t count, loff_t *ppos)
276{ 269{
@@ -363,7 +356,7 @@ err:
363 356
364static const struct file_operations iwm_debugfs_sdio_fops = { 357static const struct file_operations iwm_debugfs_sdio_fops = {
365 .owner = THIS_MODULE, 358 .owner = THIS_MODULE,
366 .open = iwm_debugfs_sdio_open, 359 .open = simple_open,
367 .read = iwm_debugfs_sdio_read, 360 .read = iwm_debugfs_sdio_read,
368 .llseek = default_llseek, 361 .llseek = default_llseek,
369}; 362};
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index c192671610fc..a06cc283e23d 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -21,12 +21,6 @@ static char *szStates[] = {
21static void lbs_debug_init(struct lbs_private *priv); 21static void lbs_debug_init(struct lbs_private *priv);
22#endif 22#endif
23 23
24static int open_file_generic(struct inode *inode, struct file *file)
25{
26 file->private_data = inode->i_private;
27 return 0;
28}
29
30static ssize_t write_file_dummy(struct file *file, const char __user *buf, 24static ssize_t write_file_dummy(struct file *file, const char __user *buf,
31 size_t count, loff_t *ppos) 25 size_t count, loff_t *ppos)
32{ 26{
@@ -696,7 +690,7 @@ out_unlock:
696 690
697#define FOPS(fread, fwrite) { \ 691#define FOPS(fread, fwrite) { \
698 .owner = THIS_MODULE, \ 692 .owner = THIS_MODULE, \
699 .open = open_file_generic, \ 693 .open = simple_open, \
700 .read = (fread), \ 694 .read = (fread), \
701 .write = (fwrite), \ 695 .write = (fwrite), \
702 .llseek = generic_file_llseek, \ 696 .llseek = generic_file_llseek, \
@@ -962,7 +956,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
962 956
963static const struct file_operations lbs_debug_fops = { 957static const struct file_operations lbs_debug_fops = {
964 .owner = THIS_MODULE, 958 .owner = THIS_MODULE,
965 .open = open_file_generic, 959 .open = simple_open,
966 .write = lbs_debugfs_write, 960 .write = lbs_debugfs_write,
967 .read = lbs_debugfs_read, 961 .read = lbs_debugfs_read,
968 .llseek = default_llseek, 962 .llseek = default_llseek,
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
index d26a78b6b3c4..1a845074c52a 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -140,18 +140,6 @@ static struct mwifiex_debug_data items[] = {
140static int num_of_items = ARRAY_SIZE(items); 140static int num_of_items = ARRAY_SIZE(items);
141 141
142/* 142/*
143 * Generic proc file open handler.
144 *
145 * This function is called every time a file is accessed for read or write.
146 */
147static int
148mwifiex_open_generic(struct inode *inode, struct file *file)
149{
150 file->private_data = inode->i_private;
151 return 0;
152}
153
154/*
155 * Proc info file read handler. 143 * Proc info file read handler.
156 * 144 *
157 * This function is called when the 'info' file is opened for reading. 145 * This function is called when the 'info' file is opened for reading.
@@ -676,19 +664,19 @@ done:
676static const struct file_operations mwifiex_dfs_##name##_fops = { \ 664static const struct file_operations mwifiex_dfs_##name##_fops = { \
677 .read = mwifiex_##name##_read, \ 665 .read = mwifiex_##name##_read, \
678 .write = mwifiex_##name##_write, \ 666 .write = mwifiex_##name##_write, \
679 .open = mwifiex_open_generic, \ 667 .open = simple_open, \
680}; 668};
681 669
682#define MWIFIEX_DFS_FILE_READ_OPS(name) \ 670#define MWIFIEX_DFS_FILE_READ_OPS(name) \
683static const struct file_operations mwifiex_dfs_##name##_fops = { \ 671static const struct file_operations mwifiex_dfs_##name##_fops = { \
684 .read = mwifiex_##name##_read, \ 672 .read = mwifiex_##name##_read, \
685 .open = mwifiex_open_generic, \ 673 .open = simple_open, \
686}; 674};
687 675
688#define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ 676#define MWIFIEX_DFS_FILE_WRITE_OPS(name) \
689static const struct file_operations mwifiex_dfs_##name##_fops = { \ 677static const struct file_operations mwifiex_dfs_##name##_fops = { \
690 .write = mwifiex_##name##_write, \ 678 .write = mwifiex_##name##_write, \
691 .open = mwifiex_open_generic, \ 679 .open = simple_open, \
692}; 680};
693 681
694 682
diff --git a/drivers/net/wireless/wl1251/debugfs.c b/drivers/net/wireless/wl1251/debugfs.c
index 6c274007d200..448da1f8c22f 100644
--- a/drivers/net/wireless/wl1251/debugfs.c
+++ b/drivers/net/wireless/wl1251/debugfs.c
@@ -47,7 +47,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
47 \ 47 \
48static const struct file_operations name## _ops = { \ 48static const struct file_operations name## _ops = { \
49 .read = name## _read, \ 49 .read = name## _read, \
50 .open = wl1251_open_file_generic, \ 50 .open = simple_open, \
51 .llseek = generic_file_llseek, \ 51 .llseek = generic_file_llseek, \
52}; 52};
53 53
@@ -84,7 +84,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
84 \ 84 \
85static const struct file_operations sub## _ ##name## _ops = { \ 85static const struct file_operations sub## _ ##name## _ops = { \
86 .read = sub## _ ##name## _read, \ 86 .read = sub## _ ##name## _read, \
87 .open = wl1251_open_file_generic, \ 87 .open = simple_open, \
88 .llseek = generic_file_llseek, \ 88 .llseek = generic_file_llseek, \
89}; 89};
90 90
@@ -117,12 +117,6 @@ out:
117 mutex_unlock(&wl->mutex); 117 mutex_unlock(&wl->mutex);
118} 118}
119 119
120static int wl1251_open_file_generic(struct inode *inode, struct file *file)
121{
122 file->private_data = inode->i_private;
123 return 0;
124}
125
126DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); 120DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u");
127 121
128DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); 122DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u");
@@ -235,7 +229,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
235 229
236static const struct file_operations tx_queue_len_ops = { 230static const struct file_operations tx_queue_len_ops = {
237 .read = tx_queue_len_read, 231 .read = tx_queue_len_read,
238 .open = wl1251_open_file_generic, 232 .open = simple_open,
239 .llseek = generic_file_llseek, 233 .llseek = generic_file_llseek,
240}; 234};
241 235
@@ -257,7 +251,7 @@ static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf,
257 251
258static const struct file_operations tx_queue_status_ops = { 252static const struct file_operations tx_queue_status_ops = {
259 .read = tx_queue_status_read, 253 .read = tx_queue_status_read,
260 .open = wl1251_open_file_generic, 254 .open = simple_open,
261 .llseek = generic_file_llseek, 255 .llseek = generic_file_llseek,
262}; 256};
263 257
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index e1cf72765965..564d49575c94 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -63,7 +63,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
63 \ 63 \
64static const struct file_operations name## _ops = { \ 64static const struct file_operations name## _ops = { \
65 .read = name## _read, \ 65 .read = name## _read, \
66 .open = wl1271_open_file_generic, \ 66 .open = simple_open, \
67 .llseek = generic_file_llseek, \ 67 .llseek = generic_file_llseek, \
68}; 68};
69 69
@@ -96,7 +96,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
96 \ 96 \
97static const struct file_operations sub## _ ##name## _ops = { \ 97static const struct file_operations sub## _ ##name## _ops = { \
98 .read = sub## _ ##name## _read, \ 98 .read = sub## _ ##name## _read, \
99 .open = wl1271_open_file_generic, \ 99 .open = simple_open, \
100 .llseek = generic_file_llseek, \ 100 .llseek = generic_file_llseek, \
101}; 101};
102 102
@@ -126,12 +126,6 @@ out:
126 mutex_unlock(&wl->mutex); 126 mutex_unlock(&wl->mutex);
127} 127}
128 128
129static int wl1271_open_file_generic(struct inode *inode, struct file *file)
130{
131 file->private_data = inode->i_private;
132 return 0;
133}
134
135DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); 129DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u");
136 130
137DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); 131DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u");
@@ -243,7 +237,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
243 237
244static const struct file_operations tx_queue_len_ops = { 238static const struct file_operations tx_queue_len_ops = {
245 .read = tx_queue_len_read, 239 .read = tx_queue_len_read,
246 .open = wl1271_open_file_generic, 240 .open = simple_open,
247 .llseek = default_llseek, 241 .llseek = default_llseek,
248}; 242};
249 243
@@ -289,7 +283,7 @@ static ssize_t gpio_power_write(struct file *file,
289static const struct file_operations gpio_power_ops = { 283static const struct file_operations gpio_power_ops = {
290 .read = gpio_power_read, 284 .read = gpio_power_read,
291 .write = gpio_power_write, 285 .write = gpio_power_write,
292 .open = wl1271_open_file_generic, 286 .open = simple_open,
293 .llseek = default_llseek, 287 .llseek = default_llseek,
294}; 288};
295 289
@@ -308,7 +302,7 @@ static ssize_t start_recovery_write(struct file *file,
308 302
309static const struct file_operations start_recovery_ops = { 303static const struct file_operations start_recovery_ops = {
310 .write = start_recovery_write, 304 .write = start_recovery_write,
311 .open = wl1271_open_file_generic, 305 .open = simple_open,
312 .llseek = default_llseek, 306 .llseek = default_llseek,
313}; 307};
314 308
@@ -372,7 +366,7 @@ out:
372static const struct file_operations dynamic_ps_timeout_ops = { 366static const struct file_operations dynamic_ps_timeout_ops = {
373 .read = dynamic_ps_timeout_read, 367 .read = dynamic_ps_timeout_read,
374 .write = dynamic_ps_timeout_write, 368 .write = dynamic_ps_timeout_write,
375 .open = wl1271_open_file_generic, 369 .open = simple_open,
376 .llseek = default_llseek, 370 .llseek = default_llseek,
377}; 371};
378 372
@@ -441,7 +435,7 @@ out:
441static const struct file_operations forced_ps_ops = { 435static const struct file_operations forced_ps_ops = {
442 .read = forced_ps_read, 436 .read = forced_ps_read,
443 .write = forced_ps_write, 437 .write = forced_ps_write,
444 .open = wl1271_open_file_generic, 438 .open = simple_open,
445 .llseek = default_llseek, 439 .llseek = default_llseek,
446}; 440};
447 441
@@ -483,7 +477,7 @@ static ssize_t split_scan_timeout_write(struct file *file,
483static const struct file_operations split_scan_timeout_ops = { 477static const struct file_operations split_scan_timeout_ops = {
484 .read = split_scan_timeout_read, 478 .read = split_scan_timeout_read,
485 .write = split_scan_timeout_write, 479 .write = split_scan_timeout_write,
486 .open = wl1271_open_file_generic, 480 .open = simple_open,
487 .llseek = default_llseek, 481 .llseek = default_llseek,
488}; 482};
489 483
@@ -566,7 +560,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
566 560
567static const struct file_operations driver_state_ops = { 561static const struct file_operations driver_state_ops = {
568 .read = driver_state_read, 562 .read = driver_state_read,
569 .open = wl1271_open_file_generic, 563 .open = simple_open,
570 .llseek = default_llseek, 564 .llseek = default_llseek,
571}; 565};
572 566
@@ -675,7 +669,7 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf,
675 669
676static const struct file_operations vifs_state_ops = { 670static const struct file_operations vifs_state_ops = {
677 .read = vifs_state_read, 671 .read = vifs_state_read,
678 .open = wl1271_open_file_generic, 672 .open = simple_open,
679 .llseek = default_llseek, 673 .llseek = default_llseek,
680}; 674};
681 675
@@ -733,7 +727,7 @@ static ssize_t dtim_interval_write(struct file *file,
733static const struct file_operations dtim_interval_ops = { 727static const struct file_operations dtim_interval_ops = {
734 .read = dtim_interval_read, 728 .read = dtim_interval_read,
735 .write = dtim_interval_write, 729 .write = dtim_interval_write,
736 .open = wl1271_open_file_generic, 730 .open = simple_open,
737 .llseek = default_llseek, 731 .llseek = default_llseek,
738}; 732};
739 733
@@ -791,7 +785,7 @@ static ssize_t suspend_dtim_interval_write(struct file *file,
791static const struct file_operations suspend_dtim_interval_ops = { 785static const struct file_operations suspend_dtim_interval_ops = {
792 .read = suspend_dtim_interval_read, 786 .read = suspend_dtim_interval_read,
793 .write = suspend_dtim_interval_write, 787 .write = suspend_dtim_interval_write,
794 .open = wl1271_open_file_generic, 788 .open = simple_open,
795 .llseek = default_llseek, 789 .llseek = default_llseek,
796}; 790};
797 791
@@ -849,7 +843,7 @@ static ssize_t beacon_interval_write(struct file *file,
849static const struct file_operations beacon_interval_ops = { 843static const struct file_operations beacon_interval_ops = {
850 .read = beacon_interval_read, 844 .read = beacon_interval_read,
851 .write = beacon_interval_write, 845 .write = beacon_interval_write,
852 .open = wl1271_open_file_generic, 846 .open = simple_open,
853 .llseek = default_llseek, 847 .llseek = default_llseek,
854}; 848};
855 849
@@ -904,7 +898,7 @@ static ssize_t rx_streaming_interval_read(struct file *file,
904static const struct file_operations rx_streaming_interval_ops = { 898static const struct file_operations rx_streaming_interval_ops = {
905 .read = rx_streaming_interval_read, 899 .read = rx_streaming_interval_read,
906 .write = rx_streaming_interval_write, 900 .write = rx_streaming_interval_write,
907 .open = wl1271_open_file_generic, 901 .open = simple_open,
908 .llseek = default_llseek, 902 .llseek = default_llseek,
909}; 903};
910 904
@@ -959,7 +953,7 @@ static ssize_t rx_streaming_always_read(struct file *file,
959static const struct file_operations rx_streaming_always_ops = { 953static const struct file_operations rx_streaming_always_ops = {
960 .read = rx_streaming_always_read, 954 .read = rx_streaming_always_read,
961 .write = rx_streaming_always_write, 955 .write = rx_streaming_always_write,
962 .open = wl1271_open_file_generic, 956 .open = simple_open,
963 .llseek = default_llseek, 957 .llseek = default_llseek,
964}; 958};
965 959
@@ -1003,7 +997,7 @@ out:
1003 997
1004static const struct file_operations beacon_filtering_ops = { 998static const struct file_operations beacon_filtering_ops = {
1005 .write = beacon_filtering_write, 999 .write = beacon_filtering_write,
1006 .open = wl1271_open_file_generic, 1000 .open = simple_open,
1007 .llseek = default_llseek, 1001 .llseek = default_llseek,
1008}; 1002};
1009 1003
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index ee8fd037bb53..849357c1045c 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -117,25 +117,17 @@ static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_
117} 117}
118 118
119 119
120static int default_open(struct inode *inode, struct file *filp)
121{
122 if (inode->i_private)
123 filp->private_data = inode->i_private;
124 return 0;
125}
126
127
128static const struct file_operations ulong_fops = { 120static const struct file_operations ulong_fops = {
129 .read = ulong_read_file, 121 .read = ulong_read_file,
130 .write = ulong_write_file, 122 .write = ulong_write_file,
131 .open = default_open, 123 .open = simple_open,
132 .llseek = default_llseek, 124 .llseek = default_llseek,
133}; 125};
134 126
135 127
136static const struct file_operations ulong_ro_fops = { 128static const struct file_operations ulong_ro_fops = {
137 .read = ulong_read_file, 129 .read = ulong_read_file,
138 .open = default_open, 130 .open = simple_open,
139 .llseek = default_llseek, 131 .llseek = default_llseek,
140}; 132};
141 133
@@ -187,7 +179,7 @@ static ssize_t atomic_read_file(struct file *file, char __user *buf, size_t coun
187 179
188static const struct file_operations atomic_ro_fops = { 180static const struct file_operations atomic_ro_fops = {
189 .read = atomic_read_file, 181 .read = atomic_read_file,
190 .open = default_open, 182 .open = simple_open,
191 .llseek = default_llseek, 183 .llseek = default_llseek,
192}; 184};
193 185
diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c
index 70277a530133..85d31a69e117 100644
--- a/drivers/remoteproc/remoteproc_debugfs.c
+++ b/drivers/remoteproc/remoteproc_debugfs.c
@@ -50,16 +50,9 @@ static ssize_t rproc_trace_read(struct file *filp, char __user *userbuf,
50 return simple_read_from_buffer(userbuf, count, ppos, trace->va, len); 50 return simple_read_from_buffer(userbuf, count, ppos, trace->va, len);
51} 51}
52 52
53static int rproc_open_generic(struct inode *inode, struct file *file)
54{
55 file->private_data = inode->i_private;
56
57 return 0;
58}
59
60static const struct file_operations trace_rproc_ops = { 53static const struct file_operations trace_rproc_ops = {
61 .read = rproc_trace_read, 54 .read = rproc_trace_read,
62 .open = rproc_open_generic, 55 .open = simple_open,
63 .llseek = generic_file_llseek, 56 .llseek = generic_file_llseek,
64}; 57};
65 58
@@ -94,7 +87,7 @@ static ssize_t rproc_state_read(struct file *filp, char __user *userbuf,
94 87
95static const struct file_operations rproc_state_ops = { 88static const struct file_operations rproc_state_ops = {
96 .read = rproc_state_read, 89 .read = rproc_state_read,
97 .open = rproc_open_generic, 90 .open = simple_open,
98 .llseek = generic_file_llseek, 91 .llseek = generic_file_llseek,
99}; 92};
100 93
@@ -114,7 +107,7 @@ static ssize_t rproc_name_read(struct file *filp, char __user *userbuf,
114 107
115static const struct file_operations rproc_name_ops = { 108static const struct file_operations rproc_name_ops = {
116 .read = rproc_name_read, 109 .read = rproc_name_read,
117 .open = rproc_open_generic, 110 .open = simple_open,
118 .llseek = generic_file_llseek, 111 .llseek = generic_file_llseek,
119}; 112};
120 113
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
index afee0e8ae714..feddefc42109 100644
--- a/drivers/rtc/rtc-88pm860x.c
+++ b/drivers/rtc/rtc-88pm860x.c
@@ -72,9 +72,9 @@ static int pm860x_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
72 struct pm860x_rtc_info *info = dev_get_drvdata(dev); 72 struct pm860x_rtc_info *info = dev_get_drvdata(dev);
73 73
74 if (enabled) 74 if (enabled)
75 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM, ALARM); 75 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, ALARM_EN);
76 else 76 else
77 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM, 0); 77 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, 0);
78 return 0; 78 return 0;
79} 79}
80 80
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 5bdf2eecb178..af04b0d6688d 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -997,13 +997,6 @@ lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf,
997 return nbytes; 997 return nbytes;
998} 998}
999 999
1000static int
1001lpfc_debugfs_dif_err_open(struct inode *inode, struct file *file)
1002{
1003 file->private_data = inode->i_private;
1004 return 0;
1005}
1006
1007static ssize_t 1000static ssize_t
1008lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, 1001lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
1009 size_t nbytes, loff_t *ppos) 1002 size_t nbytes, loff_t *ppos)
@@ -3541,7 +3534,7 @@ static const struct file_operations lpfc_debugfs_op_dumpDif = {
3541#undef lpfc_debugfs_op_dif_err 3534#undef lpfc_debugfs_op_dif_err
3542static const struct file_operations lpfc_debugfs_op_dif_err = { 3535static const struct file_operations lpfc_debugfs_op_dif_err = {
3543 .owner = THIS_MODULE, 3536 .owner = THIS_MODULE,
3544 .open = lpfc_debugfs_dif_err_open, 3537 .open = simple_open,
3545 .llseek = lpfc_debugfs_lseek, 3538 .llseek = lpfc_debugfs_lseek,
3546 .read = lpfc_debugfs_dif_err_read, 3539 .read = lpfc_debugfs_dif_err_read,
3547 .write = lpfc_debugfs_dif_err_write, 3540 .write = lpfc_debugfs_dif_err_write,
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 082458d73ce9..d1a495f64e2d 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -63,12 +63,6 @@ struct chip_data {
63}; 63};
64 64
65#ifdef CONFIG_DEBUG_FS 65#ifdef CONFIG_DEBUG_FS
66static int spi_show_regs_open(struct inode *inode, struct file *file)
67{
68 file->private_data = inode->i_private;
69 return 0;
70}
71
72#define SPI_REGS_BUFSIZE 1024 66#define SPI_REGS_BUFSIZE 1024
73static ssize_t spi_show_regs(struct file *file, char __user *user_buf, 67static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
74 size_t count, loff_t *ppos) 68 size_t count, loff_t *ppos)
@@ -128,7 +122,7 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
128 122
129static const struct file_operations mrst_spi_regs_ops = { 123static const struct file_operations mrst_spi_regs_ops = {
130 .owner = THIS_MODULE, 124 .owner = THIS_MODULE,
131 .open = spi_show_regs_open, 125 .open = simple_open,
132 .read = spi_show_regs, 126 .read = spi_show_regs,
133 .llseek = default_llseek, 127 .llseek = default_llseek,
134}; 128};
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index a9234ba8f8d5..c4b50af46c44 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -127,11 +127,6 @@ static inline void serial_out(struct uart_hsu_port *up, int offset, int value)
127 127
128#define HSU_REGS_BUFSIZE 1024 128#define HSU_REGS_BUFSIZE 1024
129 129
130static int hsu_show_regs_open(struct inode *inode, struct file *file)
131{
132 file->private_data = inode->i_private;
133 return 0;
134}
135 130
136static ssize_t port_show_regs(struct file *file, char __user *user_buf, 131static ssize_t port_show_regs(struct file *file, char __user *user_buf,
137 size_t count, loff_t *ppos) 132 size_t count, loff_t *ppos)
@@ -231,14 +226,14 @@ static ssize_t dma_show_regs(struct file *file, char __user *user_buf,
231 226
232static const struct file_operations port_regs_ops = { 227static const struct file_operations port_regs_ops = {
233 .owner = THIS_MODULE, 228 .owner = THIS_MODULE,
234 .open = hsu_show_regs_open, 229 .open = simple_open,
235 .read = port_show_regs, 230 .read = port_show_regs,
236 .llseek = default_llseek, 231 .llseek = default_llseek,
237}; 232};
238 233
239static const struct file_operations dma_regs_ops = { 234static const struct file_operations dma_regs_ops = {
240 .owner = THIS_MODULE, 235 .owner = THIS_MODULE,
241 .open = hsu_show_regs_open, 236 .open = simple_open,
242 .read = dma_show_regs, 237 .read = dma_show_regs,
243 .llseek = default_llseek, 238 .llseek = default_llseek,
244}; 239};
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index e825460478be..08b9962b8fda 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -304,11 +304,7 @@ static const int trigger_level_1[4] = { 1, 1, 1, 1 };
304#ifdef CONFIG_DEBUG_FS 304#ifdef CONFIG_DEBUG_FS
305 305
306#define PCH_REGS_BUFSIZE 1024 306#define PCH_REGS_BUFSIZE 1024
307static int pch_show_regs_open(struct inode *inode, struct file *file) 307
308{
309 file->private_data = inode->i_private;
310 return 0;
311}
312 308
313static ssize_t port_show_regs(struct file *file, char __user *user_buf, 309static ssize_t port_show_regs(struct file *file, char __user *user_buf,
314 size_t count, loff_t *ppos) 310 size_t count, loff_t *ppos)
@@ -362,7 +358,7 @@ static ssize_t port_show_regs(struct file *file, char __user *user_buf,
362 358
363static const struct file_operations port_regs_ops = { 359static const struct file_operations port_regs_ops = {
364 .owner = THIS_MODULE, 360 .owner = THIS_MODULE,
365 .open = pch_show_regs_open, 361 .open = simple_open,
366 .read = port_show_regs, 362 .read = port_show_regs,
367 .llseek = default_llseek, 363 .llseek = default_llseek,
368}; 364};
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 136e86faa1e1..05728894a88c 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -327,7 +327,7 @@ static void send_sig_all(int sig)
327 if (is_global_init(p)) 327 if (is_global_init(p))
328 continue; 328 continue;
329 329
330 force_sig(sig, p); 330 do_send_sig_info(sig, SEND_SIG_FORCED, p, true);
331 } 331 }
332 read_unlock(&tasklist_lock); 332 read_unlock(&tasklist_lock);
333} 333}
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index cefa0c8b5b6a..d2b9af59cba9 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -428,18 +428,10 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
428 return retval; 428 return retval;
429} 429}
430 430
431static int default_open (struct inode *inode, struct file *file)
432{
433 if (inode->i_private)
434 file->private_data = inode->i_private;
435
436 return 0;
437}
438
439static const struct file_operations default_file_operations = { 431static const struct file_operations default_file_operations = {
440 .read = default_read_file, 432 .read = default_read_file,
441 .write = default_write_file, 433 .write = default_write_file,
442 .open = default_open, 434 .open = simple_open,
443 .llseek = default_file_lseek, 435 .llseek = default_file_lseek,
444}; 436};
445 437
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index fd9109d7eb0e..680e1a31fb87 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -352,7 +352,6 @@ static int debug_async_open(struct inode *, struct file *);
352static int debug_periodic_open(struct inode *, struct file *); 352static int debug_periodic_open(struct inode *, struct file *);
353static int debug_registers_open(struct inode *, struct file *); 353static int debug_registers_open(struct inode *, struct file *);
354static int debug_async_open(struct inode *, struct file *); 354static int debug_async_open(struct inode *, struct file *);
355static int debug_lpm_open(struct inode *, struct file *);
356static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, 355static ssize_t debug_lpm_read(struct file *file, char __user *user_buf,
357 size_t count, loff_t *ppos); 356 size_t count, loff_t *ppos);
358static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, 357static ssize_t debug_lpm_write(struct file *file, const char __user *buffer,
@@ -385,7 +384,7 @@ static const struct file_operations debug_registers_fops = {
385}; 384};
386static const struct file_operations debug_lpm_fops = { 385static const struct file_operations debug_lpm_fops = {
387 .owner = THIS_MODULE, 386 .owner = THIS_MODULE,
388 .open = debug_lpm_open, 387 .open = simple_open,
389 .read = debug_lpm_read, 388 .read = debug_lpm_read,
390 .write = debug_lpm_write, 389 .write = debug_lpm_write,
391 .release = debug_lpm_close, 390 .release = debug_lpm_close,
@@ -970,12 +969,6 @@ static int debug_registers_open(struct inode *inode, struct file *file)
970 return file->private_data ? 0 : -ENOMEM; 969 return file->private_data ? 0 : -ENOMEM;
971} 970}
972 971
973static int debug_lpm_open(struct inode *inode, struct file *file)
974{
975 file->private_data = inode->i_private;
976 return 0;
977}
978
979static int debug_lpm_close(struct inode *inode, struct file *file) 972static int debug_lpm_close(struct inode *inode, struct file *file)
980{ 973{
981 return 0; 974 return 0;
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c
index 2eecec0c13c9..6ec45beb7af5 100644
--- a/drivers/uwb/uwb-debug.c
+++ b/drivers/uwb/uwb-debug.c
@@ -159,13 +159,6 @@ static int cmd_ie_rm(struct uwb_rc *rc, struct uwb_dbg_cmd_ie *ie_to_rm)
159 return uwb_rc_ie_rm(rc, ie_to_rm->data[0]); 159 return uwb_rc_ie_rm(rc, ie_to_rm->data[0]);
160} 160}
161 161
162static int command_open(struct inode *inode, struct file *file)
163{
164 file->private_data = inode->i_private;
165
166 return 0;
167}
168
169static ssize_t command_write(struct file *file, const char __user *buf, 162static ssize_t command_write(struct file *file, const char __user *buf,
170 size_t len, loff_t *off) 163 size_t len, loff_t *off)
171{ 164{
@@ -206,7 +199,7 @@ static ssize_t command_write(struct file *file, const char __user *buf,
206} 199}
207 200
208static const struct file_operations command_fops = { 201static const struct file_operations command_fops = {
209 .open = command_open, 202 .open = simple_open,
210 .write = command_write, 203 .write = command_write,
211 .read = NULL, 204 .read = NULL,
212 .llseek = no_llseek, 205 .llseek = no_llseek,
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 7ed9991fa747..af16884491ed 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -245,6 +245,12 @@ config BACKLIGHT_DA903X
245 If you have a LCD backlight connected to the WLED output of DA9030 245 If you have a LCD backlight connected to the WLED output of DA9030
246 or DA9034 WLED output, say Y here to enable this driver. 246 or DA9034 WLED output, say Y here to enable this driver.
247 247
248config BACKLIGHT_DA9052
249 tristate "Dialog DA9052/DA9053 WLED"
250 depends on PMIC_DA9052
251 help
252 Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs.
253
248config BACKLIGHT_MAX8925 254config BACKLIGHT_MAX8925
249 tristate "Backlight driver for MAX8925" 255 tristate "Backlight driver for MAX8925"
250 depends on MFD_MAX8925 256 depends on MFD_MAX8925
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 8071eb656147..36855ae887d6 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
29obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o 29obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
30obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o 30obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
31obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o 31obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o
32obj-$(CONFIG_BACKLIGHT_DA9052) += da9052_bl.o
32obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o 33obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o
33obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o 34obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o
34obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o 35obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
new file mode 100644
index 000000000000..b628d68f5162
--- /dev/null
+++ b/drivers/video/backlight/da9052_bl.c
@@ -0,0 +1,187 @@
1/*
2 * Backlight Driver for Dialog DA9052 PMICs
3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/backlight.h>
16#include <linux/delay.h>
17#include <linux/fb.h>
18#include <linux/module.h>
19#include <linux/platform_device.h>
20
21#include <linux/mfd/da9052/da9052.h>
22#include <linux/mfd/da9052/reg.h>
23
24#define DA9052_MAX_BRIGHTNESS 0xFF
25
26enum {
27 DA9052_WLEDS_OFF,
28 DA9052_WLEDS_ON,
29};
30
31enum {
32 DA9052_TYPE_WLED1,
33 DA9052_TYPE_WLED2,
34 DA9052_TYPE_WLED3,
35};
36
37static unsigned char wled_bank[] = {
38 DA9052_LED1_CONF_REG,
39 DA9052_LED2_CONF_REG,
40 DA9052_LED3_CONF_REG,
41};
42
43struct da9052_bl {
44 struct da9052 *da9052;
45 uint brightness;
46 uint state;
47 uint led_reg;
48};
49
50static int da9052_adjust_wled_brightness(struct da9052_bl *wleds)
51{
52 unsigned char boost_en;
53 unsigned char i_sink;
54 int ret;
55
56 boost_en = 0x3F;
57 i_sink = 0xFF;
58 if (wleds->state == DA9052_WLEDS_OFF) {
59 boost_en = 0x00;
60 i_sink = 0x00;
61 }
62
63 ret = da9052_reg_write(wleds->da9052, DA9052_BOOST_REG, boost_en);
64 if (ret < 0)
65 return ret;
66
67 ret = da9052_reg_write(wleds->da9052, DA9052_LED_CONT_REG, i_sink);
68 if (ret < 0)
69 return ret;
70
71 ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], 0x0);
72 if (ret < 0)
73 return ret;
74
75 msleep(10);
76
77 if (wleds->brightness) {
78 ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg],
79 wleds->brightness);
80 if (ret < 0)
81 return ret;
82 }
83
84 return 0;
85}
86
87static int da9052_backlight_update_status(struct backlight_device *bl)
88{
89 int brightness = bl->props.brightness;
90 struct da9052_bl *wleds = bl_get_data(bl);
91
92 wleds->brightness = brightness;
93 wleds->state = DA9052_WLEDS_ON;
94
95 return da9052_adjust_wled_brightness(wleds);
96}
97
98static int da9052_backlight_get_brightness(struct backlight_device *bl)
99{
100 struct da9052_bl *wleds = bl_get_data(bl);
101
102 return wleds->brightness;
103}
104
105static const struct backlight_ops da9052_backlight_ops = {
106 .update_status = da9052_backlight_update_status,
107 .get_brightness = da9052_backlight_get_brightness,
108};
109
110static int da9052_backlight_probe(struct platform_device *pdev)
111{
112 struct backlight_device *bl;
113 struct backlight_properties props;
114 struct da9052_bl *wleds;
115
116 wleds = devm_kzalloc(&pdev->dev, sizeof(struct da9052_bl), GFP_KERNEL);
117 if (!wleds)
118 return -ENOMEM;
119
120 wleds->da9052 = dev_get_drvdata(pdev->dev.parent);
121 wleds->brightness = 0;
122 wleds->led_reg = platform_get_device_id(pdev)->driver_data;
123 wleds->state = DA9052_WLEDS_OFF;
124
125 props.type = BACKLIGHT_RAW;
126 props.max_brightness = DA9052_MAX_BRIGHTNESS;
127
128 bl = backlight_device_register(pdev->name, wleds->da9052->dev, wleds,
129 &da9052_backlight_ops, &props);
130 if (IS_ERR(bl)) {
131 dev_err(&pdev->dev, "Failed to register backlight\n");
132 devm_kfree(&pdev->dev, wleds);
133 return PTR_ERR(bl);
134 }
135
136 bl->props.max_brightness = DA9052_MAX_BRIGHTNESS;
137 bl->props.brightness = 0;
138 platform_set_drvdata(pdev, bl);
139
140 return da9052_adjust_wled_brightness(wleds);
141}
142
143static int da9052_backlight_remove(struct platform_device *pdev)
144{
145 struct backlight_device *bl = platform_get_drvdata(pdev);
146 struct da9052_bl *wleds = bl_get_data(bl);
147
148 wleds->brightness = 0;
149 wleds->state = DA9052_WLEDS_OFF;
150 da9052_adjust_wled_brightness(wleds);
151 backlight_device_unregister(bl);
152 devm_kfree(&pdev->dev, wleds);
153
154 return 0;
155}
156
157static struct platform_device_id da9052_wled_ids[] = {
158 {
159 .name = "da9052-wled1",
160 .driver_data = DA9052_TYPE_WLED1,
161 },
162 {
163 .name = "da9052-wled2",
164 .driver_data = DA9052_TYPE_WLED2,
165 },
166 {
167 .name = "da9052-wled3",
168 .driver_data = DA9052_TYPE_WLED3,
169 },
170};
171
172static struct platform_driver da9052_wled_driver = {
173 .probe = da9052_backlight_probe,
174 .remove = da9052_backlight_remove,
175 .id_table = da9052_wled_ids,
176 .driver = {
177 .name = "da9052-wled",
178 .owner = THIS_MODULE,
179 },
180};
181
182module_platform_driver(da9052_wled_driver);
183
184MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
185MODULE_DESCRIPTION("Backlight driver for DA9052 PMIC");
186MODULE_LICENSE("GPL");
187MODULE_ALIAS("platform:da9052-backlight");
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 21e93605161c..5dfafdd1dbd3 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -33,18 +33,10 @@ static ssize_t default_write_file(struct file *file, const char __user *buf,
33 return count; 33 return count;
34} 34}
35 35
36static int default_open(struct inode *inode, struct file *file)
37{
38 if (inode->i_private)
39 file->private_data = inode->i_private;
40
41 return 0;
42}
43
44const struct file_operations debugfs_file_operations = { 36const struct file_operations debugfs_file_operations = {
45 .read = default_read_file, 37 .read = default_read_file,
46 .write = default_write_file, 38 .write = default_write_file,
47 .open = default_open, 39 .open = simple_open,
48 .llseek = noop_llseek, 40 .llseek = noop_llseek,
49}; 41};
50 42
@@ -447,7 +439,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
447static const struct file_operations fops_bool = { 439static const struct file_operations fops_bool = {
448 .read = read_file_bool, 440 .read = read_file_bool,
449 .write = write_file_bool, 441 .write = write_file_bool,
450 .open = default_open, 442 .open = simple_open,
451 .llseek = default_llseek, 443 .llseek = default_llseek,
452}; 444};
453 445
@@ -492,7 +484,7 @@ static ssize_t read_file_blob(struct file *file, char __user *user_buf,
492 484
493static const struct file_operations fops_blob = { 485static const struct file_operations fops_blob = {
494 .read = read_file_blob, 486 .read = read_file_blob,
495 .open = default_open, 487 .open = simple_open,
496 .llseek = default_llseek, 488 .llseek = default_llseek,
497}; 489};
498 490
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 3dca2b39e83f..1c9b08095f98 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -609,13 +609,6 @@ static const struct file_operations format3_fops = {
609/* 609/*
610 * dump lkb's on the ls_waiters list 610 * dump lkb's on the ls_waiters list
611 */ 611 */
612
613static int waiters_open(struct inode *inode, struct file *file)
614{
615 file->private_data = inode->i_private;
616 return 0;
617}
618
619static ssize_t waiters_read(struct file *file, char __user *userbuf, 612static ssize_t waiters_read(struct file *file, char __user *userbuf,
620 size_t count, loff_t *ppos) 613 size_t count, loff_t *ppos)
621{ 614{
@@ -644,7 +637,7 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf,
644 637
645static const struct file_operations waiters_fops = { 638static const struct file_operations waiters_fops = {
646 .owner = THIS_MODULE, 639 .owner = THIS_MODULE,
647 .open = waiters_open, 640 .open = simple_open,
648 .read = waiters_read, 641 .read = waiters_read,
649 .llseek = default_llseek, 642 .llseek = default_llseek,
650}; 643};
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index ea251749d9d5..28cf06e4ec84 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1031,7 +1031,6 @@ static int __init init_hugetlbfs_fs(void)
1031 } 1031 }
1032 1032
1033 error = PTR_ERR(vfsmount); 1033 error = PTR_ERR(vfsmount);
1034 unregister_filesystem(&hugetlbfs_fs_type);
1035 1034
1036 out: 1035 out:
1037 kmem_cache_destroy(hugetlbfs_inode_cachep); 1036 kmem_cache_destroy(hugetlbfs_inode_cachep);
diff --git a/fs/libfs.c b/fs/libfs.c
index 4a0d1f06da57..358094f0433d 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -264,6 +264,13 @@ Enomem:
264 return ERR_PTR(-ENOMEM); 264 return ERR_PTR(-ENOMEM);
265} 265}
266 266
267int simple_open(struct inode *inode, struct file *file)
268{
269 if (inode->i_private)
270 file->private_data = inode->i_private;
271 return 0;
272}
273
267int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) 274int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
268{ 275{
269 struct inode *inode = old_dentry->d_inode; 276 struct inode *inode = old_dentry->d_inode;
@@ -984,6 +991,7 @@ EXPORT_SYMBOL(simple_dir_operations);
984EXPORT_SYMBOL(simple_empty); 991EXPORT_SYMBOL(simple_empty);
985EXPORT_SYMBOL(simple_fill_super); 992EXPORT_SYMBOL(simple_fill_super);
986EXPORT_SYMBOL(simple_getattr); 993EXPORT_SYMBOL(simple_getattr);
994EXPORT_SYMBOL(simple_open);
987EXPORT_SYMBOL(simple_link); 995EXPORT_SYMBOL(simple_link);
988EXPORT_SYMBOL(simple_lookup); 996EXPORT_SYMBOL(simple_lookup);
989EXPORT_SYMBOL(simple_pin_fs); 997EXPORT_SYMBOL(simple_pin_fs);
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 46a15d8a29ca..eed44bfc85db 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -115,12 +115,13 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
115 if (IS_ERR(sb)) 115 if (IS_ERR(sb))
116 return ERR_CAST(sb); 116 return ERR_CAST(sb);
117 117
118 if (!proc_parse_options(options, ns)) {
119 deactivate_locked_super(sb);
120 return ERR_PTR(-EINVAL);
121 }
122
118 if (!sb->s_root) { 123 if (!sb->s_root) {
119 sb->s_flags = flags; 124 sb->s_flags = flags;
120 if (!proc_parse_options(options, ns)) {
121 deactivate_locked_super(sb);
122 return ERR_PTR(-EINVAL);
123 }
124 err = proc_fill_super(sb); 125 err = proc_fill_super(sb);
125 if (err) { 126 if (err) {
126 deactivate_locked_super(sb); 127 deactivate_locked_super(sb);
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 50952c9bd06c..19507889bb7f 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -52,12 +52,6 @@ struct pstore_private {
52 char data[]; 52 char data[];
53}; 53};
54 54
55static int pstore_file_open(struct inode *inode, struct file *file)
56{
57 file->private_data = inode->i_private;
58 return 0;
59}
60
61static ssize_t pstore_file_read(struct file *file, char __user *userbuf, 55static ssize_t pstore_file_read(struct file *file, char __user *userbuf,
62 size_t count, loff_t *ppos) 56 size_t count, loff_t *ppos)
63{ 57{
@@ -67,7 +61,7 @@ static ssize_t pstore_file_read(struct file *file, char __user *userbuf,
67} 61}
68 62
69static const struct file_operations pstore_file_operations = { 63static const struct file_operations pstore_file_operations = {
70 .open = pstore_file_open, 64 .open = simple_open,
71 .read = pstore_file_read, 65 .read = pstore_file_read,
72 .llseek = default_llseek, 66 .llseek = default_llseek,
73}; 67};
diff --git a/fs/xattr.c b/fs/xattr.c
index d6dfd247bb2f..3c8c1cc333c7 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -19,8 +19,9 @@
19#include <linux/export.h> 19#include <linux/export.h>
20#include <linux/fsnotify.h> 20#include <linux/fsnotify.h>
21#include <linux/audit.h> 21#include <linux/audit.h>
22#include <asm/uaccess.h> 22#include <linux/vmalloc.h>
23 23
24#include <asm/uaccess.h>
24 25
25/* 26/*
26 * Check permissions for extended attribute access. This is a bit complicated 27 * Check permissions for extended attribute access. This is a bit complicated
@@ -320,6 +321,7 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
320{ 321{
321 int error; 322 int error;
322 void *kvalue = NULL; 323 void *kvalue = NULL;
324 void *vvalue = NULL; /* If non-NULL, we used vmalloc() */
323 char kname[XATTR_NAME_MAX + 1]; 325 char kname[XATTR_NAME_MAX + 1];
324 326
325 if (flags & ~(XATTR_CREATE|XATTR_REPLACE)) 327 if (flags & ~(XATTR_CREATE|XATTR_REPLACE))
@@ -334,13 +336,25 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
334 if (size) { 336 if (size) {
335 if (size > XATTR_SIZE_MAX) 337 if (size > XATTR_SIZE_MAX)
336 return -E2BIG; 338 return -E2BIG;
337 kvalue = memdup_user(value, size); 339 kvalue = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
338 if (IS_ERR(kvalue)) 340 if (!kvalue) {
339 return PTR_ERR(kvalue); 341 vvalue = vmalloc(size);
342 if (!vvalue)
343 return -ENOMEM;
344 kvalue = vvalue;
345 }
346 if (copy_from_user(kvalue, value, size)) {
347 error = -EFAULT;
348 goto out;
349 }
340 } 350 }
341 351
342 error = vfs_setxattr(d, kname, kvalue, size, flags); 352 error = vfs_setxattr(d, kname, kvalue, size, flags);
343 kfree(kvalue); 353out:
354 if (vvalue)
355 vfree(vvalue);
356 else
357 kfree(kvalue);
344 return error; 358 return error;
345} 359}
346 360
@@ -492,13 +506,18 @@ listxattr(struct dentry *d, char __user *list, size_t size)
492{ 506{
493 ssize_t error; 507 ssize_t error;
494 char *klist = NULL; 508 char *klist = NULL;
509 char *vlist = NULL; /* If non-NULL, we used vmalloc() */
495 510
496 if (size) { 511 if (size) {
497 if (size > XATTR_LIST_MAX) 512 if (size > XATTR_LIST_MAX)
498 size = XATTR_LIST_MAX; 513 size = XATTR_LIST_MAX;
499 klist = kmalloc(size, GFP_KERNEL); 514 klist = kmalloc(size, __GFP_NOWARN | GFP_KERNEL);
500 if (!klist) 515 if (!klist) {
501 return -ENOMEM; 516 vlist = vmalloc(size);
517 if (!vlist)
518 return -ENOMEM;
519 klist = vlist;
520 }
502 } 521 }
503 522
504 error = vfs_listxattr(d, klist, size); 523 error = vfs_listxattr(d, klist, size);
@@ -510,7 +529,10 @@ listxattr(struct dentry *d, char __user *list, size_t size)
510 than XATTR_LIST_MAX bytes. Not possible. */ 529 than XATTR_LIST_MAX bytes. Not possible. */
511 error = -E2BIG; 530 error = -E2BIG;
512 } 531 }
513 kfree(klist); 532 if (vlist)
533 vfree(vlist);
534 else
535 kfree(klist);
514 return error; 536 return error;
515} 537}
516 538
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 528611843ba0..8de675523e46 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2511,6 +2511,7 @@ extern int dcache_readdir(struct file *, void *, filldir_t);
2511extern int simple_setattr(struct dentry *, struct iattr *); 2511extern int simple_setattr(struct dentry *, struct iattr *);
2512extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2512extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2513extern int simple_statfs(struct dentry *, struct kstatfs *); 2513extern int simple_statfs(struct dentry *, struct kstatfs *);
2514extern int simple_open(struct inode *inode, struct file *file);
2514extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2515extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2515extern int simple_unlink(struct inode *, struct dentry *); 2516extern int simple_unlink(struct inode *, struct dentry *);
2516extern int simple_rmdir(struct inode *, struct dentry *); 2517extern int simple_rmdir(struct inode *, struct dentry *);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 8dc0ea7caf02..b1fd5c7925fe 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -305,6 +305,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
305 return vm_swappiness; 305 return vm_swappiness;
306} 306}
307#endif 307#endif
308#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
309extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
310#else
311static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
312{
313}
314#endif
308#ifdef CONFIG_SWAP 315#ifdef CONFIG_SWAP
309/* linux/mm/page_io.c */ 316/* linux/mm/page_io.c */
310extern int swap_readpage(struct page *); 317extern int swap_readpage(struct page *);
@@ -375,13 +382,6 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
375{ 382{
376} 383}
377#endif 384#endif
378#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
379extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
380#else
381static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
382{
383}
384#endif
385 385
386#else /* CONFIG_SWAP */ 386#else /* CONFIG_SWAP */
387 387
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index cdea7b56b0c9..c0bd0308741c 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -311,13 +311,6 @@ int blk_trace_remove(struct request_queue *q)
311} 311}
312EXPORT_SYMBOL_GPL(blk_trace_remove); 312EXPORT_SYMBOL_GPL(blk_trace_remove);
313 313
314static int blk_dropped_open(struct inode *inode, struct file *filp)
315{
316 filp->private_data = inode->i_private;
317
318 return 0;
319}
320
321static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, 314static ssize_t blk_dropped_read(struct file *filp, char __user *buffer,
322 size_t count, loff_t *ppos) 315 size_t count, loff_t *ppos)
323{ 316{
@@ -331,18 +324,11 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer,
331 324
332static const struct file_operations blk_dropped_fops = { 325static const struct file_operations blk_dropped_fops = {
333 .owner = THIS_MODULE, 326 .owner = THIS_MODULE,
334 .open = blk_dropped_open, 327 .open = simple_open,
335 .read = blk_dropped_read, 328 .read = blk_dropped_read,
336 .llseek = default_llseek, 329 .llseek = default_llseek,
337}; 330};
338 331
339static int blk_msg_open(struct inode *inode, struct file *filp)
340{
341 filp->private_data = inode->i_private;
342
343 return 0;
344}
345
346static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, 332static ssize_t blk_msg_write(struct file *filp, const char __user *buffer,
347 size_t count, loff_t *ppos) 333 size_t count, loff_t *ppos)
348{ 334{
@@ -371,7 +357,7 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer,
371 357
372static const struct file_operations blk_msg_fops = { 358static const struct file_operations blk_msg_fops = {
373 .owner = THIS_MODULE, 359 .owner = THIS_MODULE,
374 .open = blk_msg_open, 360 .open = simple_open,
375 .write = blk_msg_write, 361 .write = blk_msg_write,
376 .llseek = noop_llseek, 362 .llseek = noop_llseek,
377}; 363};
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index cc5b7a6e7e0b..778e5916d7c3 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -15,12 +15,6 @@
15#include "rate.h" 15#include "rate.h"
16#include "debugfs.h" 16#include "debugfs.h"
17 17
18int mac80211_open_file_generic(struct inode *inode, struct file *file)
19{
20 file->private_data = inode->i_private;
21 return 0;
22}
23
24#define DEBUGFS_FORMAT_BUFFER_SIZE 100 18#define DEBUGFS_FORMAT_BUFFER_SIZE 100
25 19
26int mac80211_format_buffer(char __user *userbuf, size_t count, 20int mac80211_format_buffer(char __user *userbuf, size_t count,
@@ -50,7 +44,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
50#define DEBUGFS_READONLY_FILE_OPS(name) \ 44#define DEBUGFS_READONLY_FILE_OPS(name) \
51static const struct file_operations name## _ops = { \ 45static const struct file_operations name## _ops = { \
52 .read = name## _read, \ 46 .read = name## _read, \
53 .open = mac80211_open_file_generic, \ 47 .open = simple_open, \
54 .llseek = generic_file_llseek, \ 48 .llseek = generic_file_llseek, \
55}; 49};
56 50
@@ -93,7 +87,7 @@ static ssize_t reset_write(struct file *file, const char __user *user_buf,
93 87
94static const struct file_operations reset_ops = { 88static const struct file_operations reset_ops = {
95 .write = reset_write, 89 .write = reset_write,
96 .open = mac80211_open_file_generic, 90 .open = simple_open,
97 .llseek = noop_llseek, 91 .llseek = noop_llseek,
98}; 92};
99 93
@@ -254,7 +248,7 @@ static ssize_t stats_ ##name## _read(struct file *file, \
254 \ 248 \
255static const struct file_operations stats_ ##name## _ops = { \ 249static const struct file_operations stats_ ##name## _ops = { \
256 .read = stats_ ##name## _read, \ 250 .read = stats_ ##name## _read, \
257 .open = mac80211_open_file_generic, \ 251 .open = simple_open, \
258 .llseek = generic_file_llseek, \ 252 .llseek = generic_file_llseek, \
259}; 253};
260 254
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h
index 7c87529630f5..9be4e6d71d00 100644
--- a/net/mac80211/debugfs.h
+++ b/net/mac80211/debugfs.h
@@ -3,7 +3,6 @@
3 3
4#ifdef CONFIG_MAC80211_DEBUGFS 4#ifdef CONFIG_MAC80211_DEBUGFS
5extern void debugfs_hw_add(struct ieee80211_local *local); 5extern void debugfs_hw_add(struct ieee80211_local *local);
6extern int mac80211_open_file_generic(struct inode *inode, struct file *file);
7extern int mac80211_format_buffer(char __user *userbuf, size_t count, 6extern int mac80211_format_buffer(char __user *userbuf, size_t count,
8 loff_t *ppos, char *fmt, ...); 7 loff_t *ppos, char *fmt, ...);
9#else 8#else
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 59edcd95a58d..7932767bb482 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -30,7 +30,7 @@ static ssize_t key_##name##_read(struct file *file, \
30#define KEY_OPS(name) \ 30#define KEY_OPS(name) \
31static const struct file_operations key_ ##name## _ops = { \ 31static const struct file_operations key_ ##name## _ops = { \
32 .read = key_##name##_read, \ 32 .read = key_##name##_read, \
33 .open = mac80211_open_file_generic, \ 33 .open = simple_open, \
34 .llseek = generic_file_llseek, \ 34 .llseek = generic_file_llseek, \
35} 35}
36 36
@@ -45,7 +45,7 @@ static const struct file_operations key_ ##name## _ops = { \
45#define KEY_CONF_OPS(name) \ 45#define KEY_CONF_OPS(name) \
46static const struct file_operations key_ ##name## _ops = { \ 46static const struct file_operations key_ ##name## _ops = { \
47 .read = key_conf_##name##_read, \ 47 .read = key_conf_##name##_read, \
48 .open = mac80211_open_file_generic, \ 48 .open = simple_open, \
49 .llseek = generic_file_llseek, \ 49 .llseek = generic_file_llseek, \
50} 50}
51 51
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index a32eeda04aa3..30f99c344847 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -135,7 +135,7 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \
135static const struct file_operations name##_ops = { \ 135static const struct file_operations name##_ops = { \
136 .read = ieee80211_if_read_##name, \ 136 .read = ieee80211_if_read_##name, \
137 .write = (_write), \ 137 .write = (_write), \
138 .open = mac80211_open_file_generic, \ 138 .open = simple_open, \
139 .llseek = generic_file_llseek, \ 139 .llseek = generic_file_llseek, \
140} 140}
141 141
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 6d45804d09bc..832b2da5e4cd 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -33,7 +33,7 @@ static ssize_t sta_ ##name## _read(struct file *file, \
33#define STA_OPS(name) \ 33#define STA_OPS(name) \
34static const struct file_operations sta_ ##name## _ops = { \ 34static const struct file_operations sta_ ##name## _ops = { \
35 .read = sta_##name##_read, \ 35 .read = sta_##name##_read, \
36 .open = mac80211_open_file_generic, \ 36 .open = simple_open, \
37 .llseek = generic_file_llseek, \ 37 .llseek = generic_file_llseek, \
38} 38}
39 39
@@ -41,7 +41,7 @@ static const struct file_operations sta_ ##name## _ops = { \
41static const struct file_operations sta_ ##name## _ops = { \ 41static const struct file_operations sta_ ##name## _ops = { \
42 .read = sta_##name##_read, \ 42 .read = sta_##name##_read, \
43 .write = sta_##name##_write, \ 43 .write = sta_##name##_write, \
44 .open = mac80211_open_file_generic, \ 44 .open = simple_open, \
45 .llseek = generic_file_llseek, \ 45 .llseek = generic_file_llseek, \
46} 46}
47 47
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index b4f7600a3e36..3313c117b322 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -145,7 +145,7 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf,
145 145
146static const struct file_operations rcname_ops = { 146static const struct file_operations rcname_ops = {
147 .read = rcname_read, 147 .read = rcname_read,
148 .open = mac80211_open_file_generic, 148 .open = simple_open,
149 .llseek = default_llseek, 149 .llseek = default_llseek,
150}; 150};
151#endif 151#endif
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 39765bcfb472..920cabe0461b 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -13,12 +13,6 @@
13#include "core.h" 13#include "core.h"
14#include "debugfs.h" 14#include "debugfs.h"
15 15
16static int cfg80211_open_file_generic(struct inode *inode, struct file *file)
17{
18 file->private_data = inode->i_private;
19 return 0;
20}
21
22#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ 16#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \
23static ssize_t name## _read(struct file *file, char __user *userbuf, \ 17static ssize_t name## _read(struct file *file, char __user *userbuf, \
24 size_t count, loff_t *ppos) \ 18 size_t count, loff_t *ppos) \
@@ -33,7 +27,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
33 \ 27 \
34static const struct file_operations name## _ops = { \ 28static const struct file_operations name## _ops = { \
35 .read = name## _read, \ 29 .read = name## _read, \
36 .open = cfg80211_open_file_generic, \ 30 .open = simple_open, \
37 .llseek = generic_file_llseek, \ 31 .llseek = generic_file_llseek, \
38}; 32};
39 33
@@ -102,7 +96,7 @@ static ssize_t ht40allow_map_read(struct file *file,
102 96
103static const struct file_operations ht40allow_map_ops = { 97static const struct file_operations ht40allow_map_ops = {
104 .read = ht40allow_map_read, 98 .read = ht40allow_map_read,
105 .open = cfg80211_open_file_generic, 99 .open = simple_open,
106 .llseek = default_llseek, 100 .llseek = default_llseek,
107}; 101};
108 102
diff --git a/scripts/coccinelle/api/simple_open.cocci b/scripts/coccinelle/api/simple_open.cocci
new file mode 100644
index 000000000000..05962f7be155
--- /dev/null
+++ b/scripts/coccinelle/api/simple_open.cocci
@@ -0,0 +1,70 @@
1/// This removes an open coded simple_open() function
2/// and replaces file operations references to the function
3/// with simple_open() instead.
4///
5// Confidence: High
6// Comments:
7// Options: -no_includes -include_headers
8
9virtual patch
10virtual report
11
12@ open depends on patch @
13identifier open_f != simple_open;
14identifier i, f;
15@@
16-int open_f(struct inode *i, struct file *f)
17-{
18(
19-if (i->i_private)
20-f->private_data = i->i_private;
21|
22-f->private_data = i->i_private;
23)
24-return 0;
25-}
26
27@ has_open depends on open @
28identifier fops;
29identifier open.open_f;
30@@
31struct file_operations fops = {
32...,
33-.open = open_f,
34+.open = simple_open,
35...
36};
37
38@ openr depends on report @
39identifier open_f != simple_open;
40identifier i, f;
41position p;
42@@
43int open_f@p(struct inode *i, struct file *f)
44{
45(
46if (i->i_private)
47f->private_data = i->i_private;
48|
49f->private_data = i->i_private;
50)
51return 0;
52}
53
54@ has_openr depends on openr @
55identifier fops;
56identifier openr.open_f;
57position p;
58@@
59struct file_operations fops = {
60...,
61.open = open_f@p,
62...
63};
64
65@script:python@
66pf << openr.p;
67ps << has_openr.p;
68@@
69
70coccilib.report.print_report(pf[0],"WARNING opportunity for simple_open, see also structure on line %s"%(ps[0].line))
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c
index 601df809a26a..1765a197acb0 100644
--- a/sound/soc/imx/imx-audmux.c
+++ b/sound/soc/imx/imx-audmux.c
@@ -40,12 +40,6 @@ static void __iomem *audmux_base;
40#ifdef CONFIG_DEBUG_FS 40#ifdef CONFIG_DEBUG_FS
41static struct dentry *audmux_debugfs_root; 41static struct dentry *audmux_debugfs_root;
42 42
43static int audmux_open_file(struct inode *inode, struct file *file)
44{
45 file->private_data = inode->i_private;
46 return 0;
47}
48
49/* There is an annoying discontinuity in the SSI numbering with regard 43/* There is an annoying discontinuity in the SSI numbering with regard
50 * to the Linux number of the devices */ 44 * to the Linux number of the devices */
51static const char *audmux_port_string(int port) 45static const char *audmux_port_string(int port)
@@ -142,7 +136,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
142} 136}
143 137
144static const struct file_operations audmux_debugfs_fops = { 138static const struct file_operations audmux_debugfs_fops = {
145 .open = audmux_open_file, 139 .open = simple_open,
146 .read = audmux_read_file, 140 .read = audmux_read_file,
147 .llseek = default_llseek, 141 .llseek = default_llseek,
148}; 142};
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a4deebc0801a..e19c24ade414 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -201,12 +201,6 @@ static ssize_t pmdown_time_set(struct device *dev,
201static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); 201static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set);
202 202
203#ifdef CONFIG_DEBUG_FS 203#ifdef CONFIG_DEBUG_FS
204static int codec_reg_open_file(struct inode *inode, struct file *file)
205{
206 file->private_data = inode->i_private;
207 return 0;
208}
209
210static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf, 204static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf,
211 size_t count, loff_t *ppos) 205 size_t count, loff_t *ppos)
212{ 206{
@@ -264,7 +258,7 @@ static ssize_t codec_reg_write_file(struct file *file,
264} 258}
265 259
266static const struct file_operations codec_reg_fops = { 260static const struct file_operations codec_reg_fops = {
267 .open = codec_reg_open_file, 261 .open = simple_open,
268 .read = codec_reg_read_file, 262 .read = codec_reg_read_file,
269 .write = codec_reg_write_file, 263 .write = codec_reg_write_file,
270 .llseek = default_llseek, 264 .llseek = default_llseek,
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6241490fff30..5cbd2d7623b8 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1544,12 +1544,6 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
1544} 1544}
1545 1545
1546#ifdef CONFIG_DEBUG_FS 1546#ifdef CONFIG_DEBUG_FS
1547static int dapm_widget_power_open_file(struct inode *inode, struct file *file)
1548{
1549 file->private_data = inode->i_private;
1550 return 0;
1551}
1552
1553static ssize_t dapm_widget_power_read_file(struct file *file, 1547static ssize_t dapm_widget_power_read_file(struct file *file,
1554 char __user *user_buf, 1548 char __user *user_buf,
1555 size_t count, loff_t *ppos) 1549 size_t count, loff_t *ppos)
@@ -1613,17 +1607,11 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1613} 1607}
1614 1608
1615static const struct file_operations dapm_widget_power_fops = { 1609static const struct file_operations dapm_widget_power_fops = {
1616 .open = dapm_widget_power_open_file, 1610 .open = simple_open,
1617 .read = dapm_widget_power_read_file, 1611 .read = dapm_widget_power_read_file,
1618 .llseek = default_llseek, 1612 .llseek = default_llseek,
1619}; 1613};
1620 1614
1621static int dapm_bias_open_file(struct inode *inode, struct file *file)
1622{
1623 file->private_data = inode->i_private;
1624 return 0;
1625}
1626
1627static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, 1615static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
1628 size_t count, loff_t *ppos) 1616 size_t count, loff_t *ppos)
1629{ 1617{
@@ -1654,7 +1642,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
1654} 1642}
1655 1643
1656static const struct file_operations dapm_bias_fops = { 1644static const struct file_operations dapm_bias_fops = {
1657 .open = dapm_bias_open_file, 1645 .open = simple_open,
1658 .read = dapm_bias_read_file, 1646 .read = dapm_bias_read_file,
1659 .llseek = default_llseek, 1647 .llseek = default_llseek,
1660}; 1648};