From patchwork Mon Dec 15 12:58:04 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inaky Perez-Gonzalez X-Patchwork-Id: 14027 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id A0128DDFCF for ; Tue, 16 Dec 2008 00:27:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751445AbYLON1p (ORCPT ); Mon, 15 Dec 2008 08:27:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751547AbYLON1n (ORCPT ); Mon, 15 Dec 2008 08:27:43 -0500 Received: from 076-076-148-181.pdx.net ([76.76.148.181]:57990 "EHLO gocho" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751511AbYLON1j (ORCPT ); Mon, 15 Dec 2008 08:27:39 -0500 Received: from inaky by gocho with local (Exim 4.69) (envelope-from ) id 1LCD26-0001ew-EH; Mon, 15 Dec 2008 04:58:46 -0800 From: Inaky Perez-Gonzalez To: netdev@vger.kernel.org Cc: wimax@linuxwimax.org, greg@kroah.com Subject: [PATCH 09/29] wimax: debugfs controls Date: Mon, 15 Dec 2008 04:58:04 -0800 Message-Id: <0ffa8ca181e1905ee0e873c1e8c1560542367460.1229345777.git.inaky@linux.intel.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Expose knobs to control the stack's debug output. Signed-off-by: Inaky Perez-Gonzalez --- net/wimax/debugfs.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 90 insertions(+), 0 deletions(-) create mode 100644 net/wimax/debugfs.c diff --git a/net/wimax/debugfs.c b/net/wimax/debugfs.c new file mode 100644 index 0000000..87cf443 --- /dev/null +++ b/net/wimax/debugfs.c @@ -0,0 +1,90 @@ +/* + * Linux WiMAX + * Debugfs support + * + * + * Copyright (C) 2005-2006 Intel Corporation + * Inaky Perez-Gonzalez + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ +#include +#include +#include "wimax-internal.h" + +#define D_SUBMODULE debugfs +#include "debug-levels.h" + + +/* Debug framework control of debug levels */ +struct d_level D_LEVEL[] = { + D_SUBMODULE_DEFINE(debugfs), + D_SUBMODULE_DEFINE(id_table), + D_SUBMODULE_DEFINE(op_msg), + D_SUBMODULE_DEFINE(op_reset), + D_SUBMODULE_DEFINE(op_rfkill), + D_SUBMODULE_DEFINE(stack), +}; +size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); + +#define __debugfs_register(prefix, name, parent) \ +do { \ + result = d_level_register_debugfs(prefix, name, parent); \ + if (result < 0) \ + goto error; \ +} while (0) + + +int wimax_debugfs_add(struct wimax_dev *wimax_dev) +{ + int result; + struct net_device *net_dev = wimax_dev->net_dev; + struct device *dev = net_dev->dev.parent; + struct dentry *dentry; + char buf[128]; + + snprintf(buf, sizeof(buf), "wimax:%s", net_dev->name); + dentry = debugfs_create_dir(buf, NULL); + result = PTR_ERR(dentry); + if (IS_ERR(dentry)) { + if (result == -ENODEV) + result = 0; /* No debugfs support */ + else + dev_err(dev, "Can't create debugfs dentry: %d\n", + result); + goto out; + } + wimax_dev->debugfs_dentry = dentry; + __debugfs_register("wimax_dl_", debugfs, dentry); + __debugfs_register("wimax_dl_", id_table, dentry); + __debugfs_register("wimax_dl_", op_msg, dentry); + __debugfs_register("wimax_dl_", op_reset, dentry); + __debugfs_register("wimax_dl_", op_rfkill, dentry); + __debugfs_register("wimax_dl_", stack, dentry); + result = 0; +out: + return result; + +error: + debugfs_remove_recursive(wimax_dev->debugfs_dentry); + return result; +} + +void wimax_debugfs_rm(struct wimax_dev *wimax_dev) +{ + debugfs_remove_recursive(wimax_dev->debugfs_dentry); +} + +