aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /arch/mips/pci
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
Diffstat (limited to 'arch/mips/pci')
-rw-r--r--arch/mips/pci/ops-pmcmsp.c95
1 files changed, 41 insertions, 54 deletions
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index d0b6f8399b07..4eaab6327369 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -53,56 +53,51 @@ static void pci_proc_init(void);
53 53
54/***************************************************************************** 54/*****************************************************************************
55 * 55 *
56 * FUNCTION: read_msp_pci_counts 56 * FUNCTION: show_msp_pci_counts
57 * _________________________________________________________________________ 57 * _________________________________________________________________________
58 * 58 *
59 * DESCRIPTION: Prints the count of how many times each PCI 59 * DESCRIPTION: Prints the count of how many times each PCI
60 * interrupt has asserted. Can be invoked by the 60 * interrupt has asserted. Can be invoked by the
61 * /proc filesystem. 61 * /proc filesystem.
62 * 62 *
63 * INPUTS: page - part of STDOUT calculation 63 * INPUTS: m - synthetic file construction data
64 * off - part of STDOUT calculation 64 * v - iterator
65 * count - part of STDOUT calculation
66 * data - unused
67 * 65 *
68 * OUTPUTS: start - new start location 66 * RETURNS: 0 or error
69 * eof - end of file pointer
70 *
71 * RETURNS: len - STDOUT length
72 * 67 *
73 ****************************************************************************/ 68 ****************************************************************************/
74static int read_msp_pci_counts(char *page, char **start, off_t off, 69static int show_msp_pci_counts(struct seq_file *m, void *v)
75 int count, int *eof, void *data)
76{ 70{
77 int i; 71 int i;
78 int len = 0;
79 unsigned int intcount, total = 0; 72 unsigned int intcount, total = 0;
80 73
81 for (i = 0; i < 32; ++i) { 74 for (i = 0; i < 32; ++i) {
82 intcount = pci_int_count[i]; 75 intcount = pci_int_count[i];
83 if (intcount != 0) { 76 if (intcount != 0) {
84 len += sprintf(page + len, "[%d] = %u\n", i, intcount); 77 seq_printf(m, "[%d] = %u\n", i, intcount);
85 total += intcount; 78 total += intcount;
86 } 79 }
87 } 80 }
88 81
89 len += sprintf(page + len, "total = %u\n", total); 82 seq_printf(m, "total = %u\n", total);
90 if (len <= off+count) 83 return 0;
91 *eof = 1; 84}
92
93 *start = page + off;
94 len -= off;
95 if (len > count)
96 len = count;
97 if (len < 0)
98 len = 0;
99 85
100 return len; 86static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file)
87{
88 return single_open(file, show_msp_pci_counts, NULL);
101} 89}
102 90
91static const struct file_operations msp_pci_rd_cnt_fops = {
92 .open = msp_pci_rd_cnt_open,
93 .read = seq_read,
94 .llseek = seq_lseek,
95 .release = seq_release,
96};
97
103/***************************************************************************** 98/*****************************************************************************
104 * 99 *
105 * FUNCTION: gen_pci_cfg_wr 100 * FUNCTION: gen_pci_cfg_wr_show
106 * _________________________________________________________________________ 101 * _________________________________________________________________________
107 * 102 *
108 * DESCRIPTION: Generates a configuration write cycle for debug purposes. 103 * DESCRIPTION: Generates a configuration write cycle for debug purposes.
@@ -112,37 +107,30 @@ static int read_msp_pci_counts(char *page, char **start, off_t off,
112 * PCI bus. Intent is that this function by invocable from 107 * PCI bus. Intent is that this function by invocable from
113 * the /proc filesystem. 108 * the /proc filesystem.
114 * 109 *
115 * INPUTS: page - part of STDOUT calculation 110 * INPUTS: m - synthetic file construction data
116 * off - part of STDOUT calculation 111 * v - iterator
117 * count - part of STDOUT calculation
118 * data - unused
119 * 112 *
120 * OUTPUTS: start - new start location 113 * RETURNS: 0 or error
121 * eof - end of file pointer
122 *
123 * RETURNS: len - STDOUT length
124 * 114 *
125 ****************************************************************************/ 115 ****************************************************************************/
126static int gen_pci_cfg_wr(char *page, char **start, off_t off, 116static int gen_pci_cfg_wr_show(struct seq_file *m, void *v)
127 int count, int *eof, void *data)
128{ 117{
129 unsigned char where = 0; /* Write to static Device/Vendor ID */ 118 unsigned char where = 0; /* Write to static Device/Vendor ID */
130 unsigned char bus_num = 0; /* Bus 0 */ 119 unsigned char bus_num = 0; /* Bus 0 */
131 unsigned char dev_fn = 0xF; /* Arbitrary device number */ 120 unsigned char dev_fn = 0xF; /* Arbitrary device number */
132 u32 wr_data = 0xFF00AA00; /* Arbitrary data */ 121 u32 wr_data = 0xFF00AA00; /* Arbitrary data */
133 struct msp_pci_regs *preg = (void *)PCI_BASE_REG; 122 struct msp_pci_regs *preg = (void *)PCI_BASE_REG;
134 int len = 0;
135 unsigned long value; 123 unsigned long value;
136 int intr; 124 int intr;
137 125
138 len += sprintf(page + len, "PMC MSP PCI: Beginning\n"); 126 seq_puts(m, "PMC MSP PCI: Beginning\n");
139 127
140 if (proc_init == 0) { 128 if (proc_init == 0) {
141 pci_proc_init(); 129 pci_proc_init();
142 proc_init = ~0; 130 proc_init = ~0;
143 } 131 }
144 132
145 len += sprintf(page + len, "PMC MSP PCI: Before Cfg Wr\n"); 133 seq_puts(m, "PMC MSP PCI: Before Cfg Wr\n");
146 134
147 /* 135 /*
148 * Generate PCI Configuration Write Cycle 136 * Generate PCI Configuration Write Cycle
@@ -168,21 +156,22 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
168 */ 156 */
169 intr = preg->if_status; 157 intr = preg->if_status;
170 158
171 len += sprintf(page + len, "PMC MSP PCI: After Cfg Wr\n"); 159 seq_puts(m, "PMC MSP PCI: After Cfg Wr\n");
172 160 return 0;
173 /* Handle STDOUT calculations */ 161}
174 if (len <= off+count)
175 *eof = 1;
176 *start = page + off;
177 len -= off;
178 if (len > count)
179 len = count;
180 if (len < 0)
181 len = 0;
182 162
183 return len; 163static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file)
164{
165 return single_open(file, gen_pci_cfg_wr_show, NULL);
184} 166}
185 167
168static const struct file_operations gen_pci_cfg_wr_fops = {
169 .open = gen_pci_cfg_wr_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = seq_release,
173};
174
186/***************************************************************************** 175/*****************************************************************************
187 * 176 *
188 * FUNCTION: pci_proc_init 177 * FUNCTION: pci_proc_init
@@ -199,10 +188,8 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
199 ****************************************************************************/ 188 ****************************************************************************/
200static void pci_proc_init(void) 189static void pci_proc_init(void)
201{ 190{
202 create_proc_read_entry("pmc_msp_pci_rd_cnt", 0, NULL, 191 proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops);
203 read_msp_pci_counts, NULL); 192 proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops);
204 create_proc_read_entry("pmc_msp_pci_cfg_wr", 0, NULL,
205 gen_pci_cfg_wr, NULL);
206} 193}
207#endif /* CONFIG_PROC_FS && PCI_COUNTERS */ 194#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
208 195