| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /****************************************************************************** |
|---|
| 2 | 3 | * |
|---|
| 3 | | - * GPL LICENSE SUMMARY |
|---|
| 4 | | - * |
|---|
| 5 | 4 | * Copyright(c) 2008 - 2011 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 LICENSE.GPL. |
|---|
| 23 | 5 | * |
|---|
| 24 | 6 | * Contact Information: |
|---|
| 25 | 7 | * Intel Linux Wireless <ilw@linux.intel.com> |
|---|
| .. | .. |
|---|
| 128 | 110 | |
|---|
| 129 | 111 | /* create and remove of files */ |
|---|
| 130 | 112 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
|---|
| 131 | | - if (!debugfs_create_file(#name, mode, parent, il, \ |
|---|
| 132 | | - &il_dbgfs_##name##_ops)) \ |
|---|
| 133 | | - goto err; \ |
|---|
| 113 | + debugfs_create_file(#name, mode, parent, il, \ |
|---|
| 114 | + &il_dbgfs_##name##_ops); \ |
|---|
| 134 | 115 | } while (0) |
|---|
| 135 | 116 | |
|---|
| 136 | 117 | #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ |
|---|
| 137 | | - struct dentry *__tmp; \ |
|---|
| 138 | | - __tmp = debugfs_create_bool(#name, 0600, parent, ptr); \ |
|---|
| 139 | | - if (IS_ERR(__tmp) || !__tmp) \ |
|---|
| 140 | | - goto err; \ |
|---|
| 141 | | -} while (0) |
|---|
| 142 | | - |
|---|
| 143 | | -#define DEBUGFS_ADD_X32(name, parent, ptr) do { \ |
|---|
| 144 | | - struct dentry *__tmp; \ |
|---|
| 145 | | - __tmp = debugfs_create_x32(#name, 0600, parent, ptr); \ |
|---|
| 146 | | - if (IS_ERR(__tmp) || !__tmp) \ |
|---|
| 147 | | - goto err; \ |
|---|
| 118 | + debugfs_create_bool(#name, 0600, parent, ptr); \ |
|---|
| 148 | 119 | } while (0) |
|---|
| 149 | 120 | |
|---|
| 150 | 121 | /* file operation */ |
|---|
| .. | .. |
|---|
| 1341 | 1312 | * Create the debugfs files and directories |
|---|
| 1342 | 1313 | * |
|---|
| 1343 | 1314 | */ |
|---|
| 1344 | | -int |
|---|
| 1315 | +void |
|---|
| 1345 | 1316 | il_dbgfs_register(struct il_priv *il, const char *name) |
|---|
| 1346 | 1317 | { |
|---|
| 1347 | 1318 | struct dentry *phyd = il->hw->wiphy->debugfsdir; |
|---|
| 1348 | 1319 | struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; |
|---|
| 1349 | 1320 | |
|---|
| 1350 | 1321 | dir_drv = debugfs_create_dir(name, phyd); |
|---|
| 1351 | | - if (!dir_drv) |
|---|
| 1352 | | - return -ENOMEM; |
|---|
| 1353 | | - |
|---|
| 1354 | 1322 | il->debugfs_dir = dir_drv; |
|---|
| 1355 | 1323 | |
|---|
| 1356 | 1324 | dir_data = debugfs_create_dir("data", dir_drv); |
|---|
| 1357 | | - if (!dir_data) |
|---|
| 1358 | | - goto err; |
|---|
| 1359 | 1325 | dir_rf = debugfs_create_dir("rf", dir_drv); |
|---|
| 1360 | | - if (!dir_rf) |
|---|
| 1361 | | - goto err; |
|---|
| 1362 | 1326 | dir_debug = debugfs_create_dir("debug", dir_drv); |
|---|
| 1363 | | - if (!dir_debug) |
|---|
| 1364 | | - goto err; |
|---|
| 1365 | 1327 | |
|---|
| 1366 | 1328 | DEBUGFS_ADD_FILE(nvm, dir_data, 0400); |
|---|
| 1367 | 1329 | DEBUGFS_ADD_FILE(sram, dir_data, 0600); |
|---|
| .. | .. |
|---|
| 1399 | 1361 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
|---|
| 1400 | 1362 | &il->disable_chain_noise_cal); |
|---|
| 1401 | 1363 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, &il->disable_tx_power_cal); |
|---|
| 1402 | | - return 0; |
|---|
| 1403 | | - |
|---|
| 1404 | | -err: |
|---|
| 1405 | | - IL_ERR("Can't create the debugfs directory\n"); |
|---|
| 1406 | | - il_dbgfs_unregister(il); |
|---|
| 1407 | | - return -ENOMEM; |
|---|
| 1408 | 1364 | } |
|---|
| 1409 | 1365 | EXPORT_SYMBOL(il_dbgfs_register); |
|---|
| 1410 | 1366 | |
|---|
| 1411 | | -/** |
|---|
| 1367 | +/* |
|---|
| 1412 | 1368 | * Remove the debugfs files and directories |
|---|
| 1413 | | - * |
|---|
| 1414 | 1369 | */ |
|---|
| 1415 | 1370 | void |
|---|
| 1416 | 1371 | il_dbgfs_unregister(struct il_priv *il) |
|---|