| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2012-2017, 2019-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2012-2017, 2019-2022 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 |
|---|
| .. | .. |
|---|
| 24 | 24 | #if IS_ENABLED(CONFIG_DEBUG_FS) |
|---|
| 25 | 25 | |
|---|
| 26 | 26 | /** |
|---|
| 27 | | - * Show callback for the @c mem_profile debugfs file. |
|---|
| 28 | | - * |
|---|
| 29 | | - * This function is called to get the contents of the @c mem_profile debugfs |
|---|
| 30 | | - * file. This is a report of current memory usage and distribution in userspace. |
|---|
| 27 | + * kbasep_mem_profile_seq_show - Show callback for the @c mem_profile debugfs file. |
|---|
| 31 | 28 | * |
|---|
| 32 | 29 | * @sfile: The debugfs entry |
|---|
| 33 | 30 | * @data: Data associated with the entry |
|---|
| 31 | + * |
|---|
| 32 | + * This function is called to get the contents of the @c mem_profile debugfs |
|---|
| 33 | + * file. This is a report of current memory usage and distribution in userspace. |
|---|
| 34 | 34 | * |
|---|
| 35 | 35 | * Return: 0 if it successfully prints data in debugfs entry file, non-zero |
|---|
| 36 | 36 | * otherwise |
|---|
| .. | .. |
|---|
| 69 | 69 | int kbasep_mem_profile_debugfs_insert(struct kbase_context *kctx, char *data, |
|---|
| 70 | 70 | size_t size) |
|---|
| 71 | 71 | { |
|---|
| 72 | | -#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) |
|---|
| 73 | 72 | const mode_t mode = 0444; |
|---|
| 74 | | -#else |
|---|
| 75 | | - const mode_t mode = 0400; |
|---|
| 76 | | -#endif |
|---|
| 77 | 73 | int err = 0; |
|---|
| 78 | 74 | |
|---|
| 79 | 75 | mutex_lock(&kctx->mem_profile_lock); |
|---|
| .. | .. |
|---|
| 84 | 80 | if (!kbase_ctx_flag(kctx, KCTX_MEM_PROFILE_INITIALIZED)) { |
|---|
| 85 | 81 | if (IS_ERR_OR_NULL(kctx->kctx_dentry)) { |
|---|
| 86 | 82 | err = -ENOMEM; |
|---|
| 87 | | - } else if (!debugfs_create_file("mem_profile", mode, |
|---|
| 88 | | - kctx->kctx_dentry, kctx, |
|---|
| 89 | | - &kbasep_mem_profile_debugfs_fops)) { |
|---|
| 83 | + } else if (IS_ERR_OR_NULL(debugfs_create_file("mem_profile", |
|---|
| 84 | + mode, kctx->kctx_dentry, kctx, |
|---|
| 85 | + &kbasep_mem_profile_debugfs_fops))) { |
|---|
| 90 | 86 | err = -EAGAIN; |
|---|
| 91 | 87 | } else { |
|---|
| 92 | 88 | kbase_ctx_flag_set(kctx, |
|---|