1 // SPDX-License-Identifier: GPL-2.0-only
3 * QLogic iSCSI Offload Driver
4 * Copyright (c) 2016 Cavium Inc.
8 #include <linux/vmalloc.h>
11 qedi_dbg_err(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
22 if (likely(qedi
) && likely(qedi
->pdev
))
23 pr_err("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
24 func
, line
, qedi
->host_no
, &vaf
);
26 pr_err("[0000:00:00.0]:[%s:%d]: %pV", func
, line
, &vaf
);
32 qedi_dbg_warn(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
43 if (!(qedi_dbg_log
& QEDI_LOG_WARN
))
46 if (likely(qedi
) && likely(qedi
->pdev
))
47 pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
48 func
, line
, qedi
->host_no
, &vaf
);
50 pr_warn("[0000:00:00.0]:[%s:%d]: %pV", func
, line
, &vaf
);
57 qedi_dbg_notice(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
68 if (!(qedi_dbg_log
& QEDI_LOG_NOTICE
))
71 if (likely(qedi
) && likely(qedi
->pdev
))
72 pr_notice("[%s]:[%s:%d]:%d: %pV",
73 dev_name(&qedi
->pdev
->dev
), func
, line
,
76 pr_notice("[0000:00:00.0]:[%s:%d]: %pV", func
, line
, &vaf
);
83 qedi_dbg_info(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
84 u32 level
, const char *fmt
, ...)
94 if (!(qedi_dbg_log
& level
))
97 if (likely(qedi
) && likely(qedi
->pdev
))
98 pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
99 func
, line
, qedi
->host_no
, &vaf
);
101 pr_info("[0000:00:00.0]:[%s:%d]: %pV", func
, line
, &vaf
);
108 qedi_create_sysfs_attr(struct Scsi_Host
*shost
, struct sysfs_bin_attrs
*iter
)
112 for (; iter
->name
; iter
++) {
113 ret
= sysfs_create_bin_file(&shost
->shost_gendev
.kobj
,
116 pr_err("Unable to create sysfs %s attr, err(%d).\n",
123 qedi_remove_sysfs_attr(struct Scsi_Host
*shost
, struct sysfs_bin_attrs
*iter
)
125 for (; iter
->name
; iter
++)
126 sysfs_remove_bin_file(&shost
->shost_gendev
.kobj
, iter
->attr
);