.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
---|
2 | 2 | /* |
---|
3 | 3 | * |
---|
4 | | - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. |
---|
| 4 | + * (C) COPYRIGHT 2019-2023 ARM Limited. All rights reserved. |
---|
5 | 5 | * |
---|
6 | 6 | * This program is free software and is provided to you under the terms of the |
---|
7 | 7 | * GNU General Public License version 2 as published by the Free Software |
---|
.. | .. |
---|
34 | 34 | /** |
---|
35 | 35 | * set_attr_from_string - Parse a string to set elements of an array |
---|
36 | 36 | * |
---|
37 | | - * This is the core of the implementation of |
---|
38 | | - * kbase_debugfs_helper_set_attr_from_string. The only difference between the |
---|
39 | | - * two functions is that this one requires the input string to be writable. |
---|
40 | | - * |
---|
41 | 37 | * @buf: Input string to parse. Must be nul-terminated! |
---|
42 | 38 | * @array: Address of an object that can be accessed like an array. |
---|
43 | 39 | * @nelems: Number of elements in the array. |
---|
44 | 40 | * @set_attr_fn: Function to be called back for each array element. |
---|
45 | 41 | * |
---|
| 42 | + * This is the core of the implementation of |
---|
| 43 | + * kbase_debugfs_helper_set_attr_from_string. The only difference between the |
---|
| 44 | + * two functions is that this one requires the input string to be writable. |
---|
| 45 | + * |
---|
46 | 46 | * Return: 0 if success, negative error code otherwise. |
---|
47 | 47 | */ |
---|
48 | 48 | static int |
---|
49 | 49 | set_attr_from_string(char *const buf, void *const array, size_t const nelems, |
---|
50 | | - kbase_debugfs_helper_set_attr_fn *const set_attr_fn) |
---|
| 50 | + kbase_debugfs_helper_set_attr_fn * const set_attr_fn) |
---|
51 | 51 | { |
---|
52 | 52 | size_t index, err = 0; |
---|
53 | 53 | char *ptr = buf; |
---|
.. | .. |
---|
90 | 90 | |
---|
91 | 91 | int kbase_debugfs_string_validator(char *const buf) |
---|
92 | 92 | { |
---|
93 | | - size_t index; |
---|
94 | 93 | int err = 0; |
---|
95 | 94 | char *ptr = buf; |
---|
96 | 95 | |
---|
97 | | - for (index = 0; *ptr; ++index) { |
---|
| 96 | + while (*ptr) { |
---|
98 | 97 | unsigned long test_number; |
---|
99 | 98 | size_t len; |
---|
100 | 99 | |
---|
.. | .. |
---|
143 | 142 | |
---|
144 | 143 | int kbase_debugfs_helper_set_attr_from_string( |
---|
145 | 144 | const char *const buf, void *const array, size_t const nelems, |
---|
146 | | - kbase_debugfs_helper_set_attr_fn *const set_attr_fn) |
---|
| 145 | + kbase_debugfs_helper_set_attr_fn * const set_attr_fn) |
---|
147 | 146 | { |
---|
148 | 147 | char *const wbuf = kstrdup(buf, GFP_KERNEL); |
---|
149 | 148 | int err = 0; |
---|
.. | .. |
---|
168 | 167 | ssize_t kbase_debugfs_helper_get_attr_to_string( |
---|
169 | 168 | char *const buf, size_t const size, void *const array, |
---|
170 | 169 | size_t const nelems, |
---|
171 | | - kbase_debugfs_helper_get_attr_fn *const get_attr_fn) |
---|
| 170 | + kbase_debugfs_helper_get_attr_fn * const get_attr_fn) |
---|
172 | 171 | { |
---|
173 | 172 | ssize_t total = 0; |
---|
174 | 173 | size_t index; |
---|
.. | .. |
---|
189 | 188 | int kbase_debugfs_helper_seq_write( |
---|
190 | 189 | struct file *const file, const char __user *const ubuf, |
---|
191 | 190 | size_t const count, size_t const nelems, |
---|
192 | | - kbase_debugfs_helper_set_attr_fn *const set_attr_fn) |
---|
| 191 | + kbase_debugfs_helper_set_attr_fn * const set_attr_fn) |
---|
193 | 192 | { |
---|
194 | 193 | const struct seq_file *const sfile = file->private_data; |
---|
195 | 194 | void *const array = sfile->private; |
---|
.. | .. |
---|
228 | 227 | } |
---|
229 | 228 | |
---|
230 | 229 | int kbase_debugfs_helper_seq_read( |
---|
231 | | - struct seq_file *const sfile, size_t const nelems, |
---|
232 | | - kbase_debugfs_helper_get_attr_fn *const get_attr_fn) |
---|
| 230 | + struct seq_file * const sfile, size_t const nelems, |
---|
| 231 | + kbase_debugfs_helper_get_attr_fn * const get_attr_fn) |
---|
233 | 232 | { |
---|
234 | 233 | void *const array = sfile->private; |
---|
235 | 234 | size_t index; |
---|