| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /****************************************************************************** |
|---|
| 2 | 3 | * |
|---|
| 3 | | - * GPL LICENSE SUMMARY |
|---|
| 4 | | - * |
|---|
| 5 | 4 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of version 2 of the GNU General Public License as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 12 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | | - * General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
|---|
| 19 | | - * USA |
|---|
| 20 | | - * |
|---|
| 21 | | - * The full GNU General Public License is included in this distribution |
|---|
| 22 | | - * in the file called COPYING. |
|---|
| 5 | + * Copyright (C) 2018 Intel Corporation |
|---|
| 23 | 6 | * |
|---|
| 24 | 7 | * Contact Information: |
|---|
| 25 | 8 | * Intel Linux Wireless <linuxwifi@intel.com> |
|---|
| .. | .. |
|---|
| 41 | 24 | |
|---|
| 42 | 25 | /* create and remove of files */ |
|---|
| 43 | 26 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
|---|
| 44 | | - if (!debugfs_create_file(#name, mode, parent, priv, \ |
|---|
| 45 | | - &iwl_dbgfs_##name##_ops)) \ |
|---|
| 46 | | - goto err; \ |
|---|
| 47 | | -} while (0) |
|---|
| 48 | | - |
|---|
| 49 | | -#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ |
|---|
| 50 | | - struct dentry *__tmp; \ |
|---|
| 51 | | - __tmp = debugfs_create_bool(#name, 0600, parent, ptr); \ |
|---|
| 52 | | - if (IS_ERR(__tmp) || !__tmp) \ |
|---|
| 53 | | - goto err; \ |
|---|
| 54 | | -} while (0) |
|---|
| 55 | | - |
|---|
| 56 | | -#define DEBUGFS_ADD_X32(name, parent, ptr) do { \ |
|---|
| 57 | | - struct dentry *__tmp; \ |
|---|
| 58 | | - __tmp = debugfs_create_x32(#name, 0600, parent, ptr); \ |
|---|
| 59 | | - if (IS_ERR(__tmp) || !__tmp) \ |
|---|
| 60 | | - goto err; \ |
|---|
| 61 | | -} while (0) |
|---|
| 62 | | - |
|---|
| 63 | | -#define DEBUGFS_ADD_U32(name, parent, ptr, mode) do { \ |
|---|
| 64 | | - struct dentry *__tmp; \ |
|---|
| 65 | | - __tmp = debugfs_create_u32(#name, mode, \ |
|---|
| 66 | | - parent, ptr); \ |
|---|
| 67 | | - if (IS_ERR(__tmp) || !__tmp) \ |
|---|
| 68 | | - goto err; \ |
|---|
| 27 | + debugfs_create_file(#name, mode, parent, priv, \ |
|---|
| 28 | + &iwl_dbgfs_##name##_ops); \ |
|---|
| 69 | 29 | } while (0) |
|---|
| 70 | 30 | |
|---|
| 71 | 31 | /* file operation */ |
|---|
| .. | .. |
|---|
| 2243 | 2203 | buf_size = min(count, sizeof(buf) - 1); |
|---|
| 2244 | 2204 | if (copy_from_user(buf, user_buf, buf_size)) |
|---|
| 2245 | 2205 | return -EFAULT; |
|---|
| 2246 | | - if (sscanf(buf, "%d", &event_log_flag) != 1) |
|---|
| 2206 | + if (sscanf(buf, "%u", &event_log_flag) != 1) |
|---|
| 2247 | 2207 | return -EFAULT; |
|---|
| 2248 | 2208 | if (event_log_flag == 1) |
|---|
| 2249 | 2209 | iwl_dump_nic_event_log(priv, true, NULL); |
|---|
| .. | .. |
|---|
| 2352 | 2312 | * Create the debugfs files and directories |
|---|
| 2353 | 2313 | * |
|---|
| 2354 | 2314 | */ |
|---|
| 2355 | | -int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir) |
|---|
| 2315 | +void iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir) |
|---|
| 2356 | 2316 | { |
|---|
| 2357 | 2317 | struct dentry *dir_data, *dir_rf, *dir_debug; |
|---|
| 2358 | 2318 | |
|---|
| 2359 | 2319 | priv->debugfs_dir = dbgfs_dir; |
|---|
| 2360 | 2320 | |
|---|
| 2361 | 2321 | dir_data = debugfs_create_dir("data", dbgfs_dir); |
|---|
| 2362 | | - if (!dir_data) |
|---|
| 2363 | | - goto err; |
|---|
| 2364 | 2322 | dir_rf = debugfs_create_dir("rf", dbgfs_dir); |
|---|
| 2365 | | - if (!dir_rf) |
|---|
| 2366 | | - goto err; |
|---|
| 2367 | 2323 | dir_debug = debugfs_create_dir("debug", dbgfs_dir); |
|---|
| 2368 | | - if (!dir_debug) |
|---|
| 2369 | | - goto err; |
|---|
| 2370 | 2324 | |
|---|
| 2371 | 2325 | DEBUGFS_ADD_FILE(nvm, dir_data, 0400); |
|---|
| 2372 | 2326 | DEBUGFS_ADD_FILE(sram, dir_data, 0600); |
|---|
| .. | .. |
|---|
| 2426 | 2380 | |
|---|
| 2427 | 2381 | snprintf(buf, 100, "../../%pd2", dev_dir); |
|---|
| 2428 | 2382 | |
|---|
| 2429 | | - if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf)) |
|---|
| 2430 | | - goto err; |
|---|
| 2383 | + debugfs_create_symlink("iwlwifi", mac80211_dir, buf); |
|---|
| 2431 | 2384 | } |
|---|
| 2432 | | - |
|---|
| 2433 | | - return 0; |
|---|
| 2434 | | - |
|---|
| 2435 | | -err: |
|---|
| 2436 | | - IWL_ERR(priv, "failed to create the dvm debugfs entries\n"); |
|---|
| 2437 | | - return -ENOMEM; |
|---|
| 2438 | 2385 | } |
|---|