提交 c76876e5 编写于 作者: L Luo Jiaxing 提交者: Xie XiuQi

scsi: hisi_sas: Add DFX Feature: Create root directory and device directory

This patch create root directory at hisi_sas_init() and generate
device directory when we probe device driver.

And we remove the root directory at hisi_sas_exit(),
but recursively delete device directory when we remove device driver.
Signed-off-by: NLuo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: NJohn Garry <john.garry@huawei.com>
上级 722970b5
......@@ -14,6 +14,7 @@
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/dmapool.h>
#include <linux/iopoll.h>
#include <linux/lcm.h>
......@@ -333,6 +334,8 @@ struct hisi_hba {
u32 intr_coal_ticks; /* time of interrupt coalesce, unit:1us */
u32 intr_coal_count; /* count of interrupt coalesce */
int enable_dix_dif;
struct dentry *debugfs_dir;
};
/* Generic HW DMA host memory structures */
......@@ -471,6 +474,8 @@ struct hisi_sas_slot_dif_buf_table {
struct hisi_sas_sge_dif_page sge_dif_page;
};
extern bool hisi_sas_debugfs_enable;
extern struct dentry *hisi_sas_dbg_dir;
extern struct scsi_transport_template *hisi_sas_stt;
extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba);
extern int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost);
......@@ -504,4 +509,6 @@ extern void hisi_sas_release_tasks(struct hisi_hba *hisi_hba);
extern u8 hisi_sas_get_prog_phy_linkrate_mask(enum sas_linkrate max);
extern void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba);
extern void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba);
extern void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba);
extern void hisi_sas_debugfs_exit(struct hisi_hba *hisi_hba);
#endif
......@@ -2572,6 +2572,23 @@ int hisi_sas_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(hisi_sas_probe);
struct dentry *hisi_sas_dbg_dir;
void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba)
{
struct device *dev = hisi_hba->dev;
hisi_hba->debugfs_dir = debugfs_create_dir(dev_name(dev),
hisi_sas_dbg_dir);
}
EXPORT_SYMBOL_GPL(hisi_sas_debugfs_init);
void hisi_sas_debugfs_exit(struct hisi_hba *hisi_hba)
{
debugfs_remove_recursive(hisi_hba->debugfs_dir);
}
EXPORT_SYMBOL_GPL(hisi_sas_debugfs_exit);
int hisi_sas_remove(struct platform_device *pdev)
{
struct sas_ha_struct *sha = platform_get_drvdata(pdev);
......@@ -2590,18 +2607,29 @@ int hisi_sas_remove(struct platform_device *pdev)
}
EXPORT_SYMBOL_GPL(hisi_sas_remove);
bool hisi_sas_debugfs_enable;
EXPORT_SYMBOL_GPL(hisi_sas_debugfs_enable);
module_param_named(debugfs_enable, hisi_sas_debugfs_enable, bool, 0444);
MODULE_PARM_DESC(hisi_sas_debugfs_enable, "Enable debugfs services");
static __init int hisi_sas_init(void)
{
hisi_sas_stt = sas_domain_attach_transport(&hisi_sas_transport_ops);
if (!hisi_sas_stt)
return -ENOMEM;
if (hisi_sas_debugfs_enable)
hisi_sas_dbg_dir = debugfs_create_dir("hisi_sas", NULL);
return 0;
}
static __exit void hisi_sas_exit(void)
{
sas_release_transport(hisi_sas_stt);
if (hisi_sas_debugfs_enable)
debugfs_remove(hisi_sas_dbg_dir);
}
module_init(hisi_sas_init);
......
......@@ -2584,6 +2584,9 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
sha->sas_port[i] = &hisi_hba->port[i].sas_port;
}
if (hisi_sas_debugfs_enable)
hisi_sas_debugfs_init(hisi_hba);
rc = scsi_add_host(shost, dev);
if (rc)
goto err_out_ha;
......@@ -2643,6 +2646,9 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
struct hisi_hba *hisi_hba = sha->lldd_ha;
struct Scsi_Host *shost = sha->core.shost;
if (hisi_sas_debugfs_enable)
hisi_sas_debugfs_exit(hisi_hba);
if (timer_pending(&hisi_hba->timer))
del_timer(&hisi_hba->timer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册