hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/gpu/arm/bifrost/mali_kbase_debugfs_helper.c
....@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22 /*
33 *
4
- * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2019-2023 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -34,20 +34,20 @@
3434 /**
3535 * set_attr_from_string - Parse a string to set elements of an array
3636 *
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
- *
4137 * @buf: Input string to parse. Must be nul-terminated!
4238 * @array: Address of an object that can be accessed like an array.
4339 * @nelems: Number of elements in the array.
4440 * @set_attr_fn: Function to be called back for each array element.
4541 *
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
+ *
4646 * Return: 0 if success, negative error code otherwise.
4747 */
4848 static int
4949 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)
5151 {
5252 size_t index, err = 0;
5353 char *ptr = buf;
....@@ -90,11 +90,10 @@
9090
9191 int kbase_debugfs_string_validator(char *const buf)
9292 {
93
- size_t index;
9493 int err = 0;
9594 char *ptr = buf;
9695
97
- for (index = 0; *ptr; ++index) {
96
+ while (*ptr) {
9897 unsigned long test_number;
9998 size_t len;
10099
....@@ -143,7 +142,7 @@
143142
144143 int kbase_debugfs_helper_set_attr_from_string(
145144 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)
147146 {
148147 char *const wbuf = kstrdup(buf, GFP_KERNEL);
149148 int err = 0;
....@@ -168,7 +167,7 @@
168167 ssize_t kbase_debugfs_helper_get_attr_to_string(
169168 char *const buf, size_t const size, void *const array,
170169 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)
172171 {
173172 ssize_t total = 0;
174173 size_t index;
....@@ -189,7 +188,7 @@
189188 int kbase_debugfs_helper_seq_write(
190189 struct file *const file, const char __user *const ubuf,
191190 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)
193192 {
194193 const struct seq_file *const sfile = file->private_data;
195194 void *const array = sfile->private;
....@@ -228,8 +227,8 @@
228227 }
229228
230229 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)
233232 {
234233 void *const array = sfile->private;
235234 size_t index;