diff options
author | David Howells <dhowells@redhat.com> | 2013-04-10 19:21:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-29 15:41:58 -0400 |
commit | 24270156ac94a54cfaa7326375ed44d0902f58c5 (patch) | |
tree | 00478acb62b8a7bfb04d4212e499fe16c6ecf429 /arch/mips/pci | |
parent | 28ff11882a2ec50916b2b52016d80ec52461e5f9 (diff) |
mips: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Ralf Baechle <ralf@linux-mips.org>
cc: linux-mips@linux-mips.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/mips/pci')
-rw-r--r-- | arch/mips/pci/ops-pmcmsp.c | 95 |
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 | ****************************************************************************/ |
74 | static int read_msp_pci_counts(char *page, char **start, off_t off, | 69 | static 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; | 86 | static 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 | ||
91 | static 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 | ****************************************************************************/ |
126 | static int gen_pci_cfg_wr(char *page, char **start, off_t off, | 116 | static 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; | 163 | static 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 | ||
168 | static 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 | ****************************************************************************/ |
200 | static void pci_proc_init(void) | 189 | static 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 | ||