Commit cf90098d authored by Sergey Ryazanov's avatar Sergey Ryazanov Committed by Jakub Kicinski

net: wwan: iosm: move debugfs knobs into a subdir

The modem traces collection is a device (and so driver) specific option.
Therefore, move the related debugfs files into a driver-specific
subdirectory under the common per WWAN device directory.
Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Acked-by: default avatarM Chetan Kumar <m.chetan.kumar@intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 13b94fba
...@@ -22,6 +22,7 @@ iosm-y = \ ...@@ -22,6 +22,7 @@ iosm-y = \
iosm_ipc_devlink.o \ iosm_ipc_devlink.o \
iosm_ipc_flash.o \ iosm_ipc_flash.o \
iosm_ipc_coredump.o \ iosm_ipc_coredump.o \
iosm_ipc_debugfs.o \
iosm_ipc_trace.o iosm_ipc_trace.o
obj-$(CONFIG_IOSM) := iosm.o obj-$(CONFIG_IOSM) := iosm.o
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2020-2021 Intel Corporation.
*/
#include <linux/debugfs.h>
#include <linux/wwan.h>
#include "iosm_ipc_imem.h"
#include "iosm_ipc_trace.h"
#include "iosm_ipc_debugfs.h"
void ipc_debugfs_init(struct iosm_imem *ipc_imem)
{
struct dentry *debugfs_pdev = wwan_get_debugfs_dir(ipc_imem->dev);
ipc_imem->debugfs_dir = debugfs_create_dir(KBUILD_MODNAME,
debugfs_pdev);
ipc_imem->trace = ipc_trace_init(ipc_imem);
if (!ipc_imem->trace)
dev_warn(ipc_imem->dev, "trace channel init failed");
}
void ipc_debugfs_deinit(struct iosm_imem *ipc_imem)
{
ipc_trace_deinit(ipc_imem->trace);
debugfs_remove_recursive(ipc_imem->debugfs_dir);
}
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (C) 2020-2021 Intel Corporation.
*/
#ifndef IOSM_IPC_DEBUGFS_H
#define IOSM_IPC_DEBUGFS_H
void ipc_debugfs_init(struct iosm_imem *ipc_imem);
void ipc_debugfs_deinit(struct iosm_imem *ipc_imem);
#endif
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "iosm_ipc_imem.h" #include "iosm_ipc_imem.h"
#include "iosm_ipc_port.h" #include "iosm_ipc_port.h"
#include "iosm_ipc_trace.h" #include "iosm_ipc_trace.h"
#include "iosm_ipc_debugfs.h"
/* Check the wwan ips if it is valid with Channel as input. */ /* Check the wwan ips if it is valid with Channel as input. */
static int ipc_imem_check_wwan_ips(struct ipc_mem_channel *chnl) static int ipc_imem_check_wwan_ips(struct ipc_mem_channel *chnl)
...@@ -554,9 +555,7 @@ static void ipc_imem_run_state_worker(struct work_struct *instance) ...@@ -554,9 +555,7 @@ static void ipc_imem_run_state_worker(struct work_struct *instance)
ctrl_chl_idx++; ctrl_chl_idx++;
} }
ipc_imem->trace = ipc_trace_init(ipc_imem); ipc_debugfs_init(ipc_imem);
if (!ipc_imem->trace)
dev_warn(ipc_imem->dev, "trace channel init failed");
ipc_task_queue_send_task(ipc_imem, ipc_imem_send_mdm_rdy_cb, 0, NULL, 0, ipc_task_queue_send_task(ipc_imem, ipc_imem_send_mdm_rdy_cb, 0, NULL, 0,
false); false);
...@@ -1173,7 +1172,7 @@ void ipc_imem_cleanup(struct iosm_imem *ipc_imem) ...@@ -1173,7 +1172,7 @@ void ipc_imem_cleanup(struct iosm_imem *ipc_imem)
if (test_and_clear_bit(FULLY_FUNCTIONAL, &ipc_imem->flag)) { if (test_and_clear_bit(FULLY_FUNCTIONAL, &ipc_imem->flag)) {
ipc_mux_deinit(ipc_imem->mux); ipc_mux_deinit(ipc_imem->mux);
ipc_trace_deinit(ipc_imem->trace); ipc_debugfs_deinit(ipc_imem);
ipc_wwan_deinit(ipc_imem->wwan); ipc_wwan_deinit(ipc_imem->wwan);
ipc_port_deinit(ipc_imem->ipc_port); ipc_port_deinit(ipc_imem->ipc_port);
} }
......
...@@ -341,6 +341,7 @@ enum ipc_phase { ...@@ -341,6 +341,7 @@ enum ipc_phase {
* @ev_mux_net_transmit_pending:0 means inform the IPC tasklet to pass * @ev_mux_net_transmit_pending:0 means inform the IPC tasklet to pass
* @reset_det_n: Reset detect flag * @reset_det_n: Reset detect flag
* @pcie_wake_n: Pcie wake flag * @pcie_wake_n: Pcie wake flag
* @debugfs_dir: Debug FS directory for driver-specific entries
*/ */
struct iosm_imem { struct iosm_imem {
struct iosm_mmio *mmio; struct iosm_mmio *mmio;
...@@ -380,6 +381,7 @@ struct iosm_imem { ...@@ -380,6 +381,7 @@ struct iosm_imem {
ev_mux_net_transmit_pending:1, ev_mux_net_transmit_pending:1,
reset_det_n:1, reset_det_n:1,
pcie_wake_n:1; pcie_wake_n:1;
struct dentry *debugfs_dir;
}; };
/** /**
......
...@@ -134,7 +134,6 @@ struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem) ...@@ -134,7 +134,6 @@ struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem)
{ {
struct ipc_chnl_cfg chnl_cfg = { 0 }; struct ipc_chnl_cfg chnl_cfg = { 0 };
struct iosm_trace *ipc_trace; struct iosm_trace *ipc_trace;
struct dentry *debugfs_pdev;
ipc_chnl_cfg_get(&chnl_cfg, IPC_MEM_CTRL_CHL_ID_3); ipc_chnl_cfg_get(&chnl_cfg, IPC_MEM_CTRL_CHL_ID_3);
ipc_imem_channel_init(ipc_imem, IPC_CTYPE_CTRL, chnl_cfg, ipc_imem_channel_init(ipc_imem, IPC_CTYPE_CTRL, chnl_cfg,
...@@ -150,15 +149,14 @@ struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem) ...@@ -150,15 +149,14 @@ struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem)
ipc_trace->chl_id = IPC_MEM_CTRL_CHL_ID_3; ipc_trace->chl_id = IPC_MEM_CTRL_CHL_ID_3;
mutex_init(&ipc_trace->trc_mutex); mutex_init(&ipc_trace->trc_mutex);
debugfs_pdev = wwan_get_debugfs_dir(ipc_imem->dev);
ipc_trace->ctrl_file = debugfs_create_file(IOSM_TRC_DEBUGFS_TRACE_CTRL, ipc_trace->ctrl_file = debugfs_create_file(IOSM_TRC_DEBUGFS_TRACE_CTRL,
IOSM_TRC_FILE_PERM, IOSM_TRC_FILE_PERM,
debugfs_pdev, ipc_imem->debugfs_dir,
ipc_trace, &ipc_trace_fops); ipc_trace, &ipc_trace_fops);
ipc_trace->ipc_rchan = relay_open(IOSM_TRC_DEBUGFS_TRACE, ipc_trace->ipc_rchan = relay_open(IOSM_TRC_DEBUGFS_TRACE,
debugfs_pdev, ipc_imem->debugfs_dir,
IOSM_TRC_SUB_BUFF_SIZE, IOSM_TRC_SUB_BUFF_SIZE,
IOSM_TRC_N_SUB_BUFF, IOSM_TRC_N_SUB_BUFF,
&relay_callbacks, NULL); &relay_callbacks, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment