2 * QLogic iSCSI Offload Driver
3 * Copyright (c) 2016 Cavium Inc.
5 * This software is available under the terms of the GNU General Public License
6 * (GPL) Version 2, available from the file COPYING in the main directory of
11 #include <linux/vmalloc.h>
14 qedi_dbg_err(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
21 memset(nfunc
, 0, sizeof(nfunc
));
22 memcpy(nfunc
, func
, sizeof(nfunc
) - 1);
29 if (likely(qedi
) && likely(qedi
->pdev
))
30 pr_err("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
31 nfunc
, line
, qedi
->host_no
, &vaf
);
33 pr_err("[0000:00:00.0]:[%s:%d]: %pV", nfunc
, line
, &vaf
);
39 qedi_dbg_warn(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
46 memset(nfunc
, 0, sizeof(nfunc
));
47 memcpy(nfunc
, func
, sizeof(nfunc
) - 1);
54 if (!(qedi_dbg_log
& QEDI_LOG_WARN
))
57 if (likely(qedi
) && likely(qedi
->pdev
))
58 pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
59 nfunc
, line
, qedi
->host_no
, &vaf
);
61 pr_warn("[0000:00:00.0]:[%s:%d]: %pV", nfunc
, line
, &vaf
);
68 qedi_dbg_notice(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
75 memset(nfunc
, 0, sizeof(nfunc
));
76 memcpy(nfunc
, func
, sizeof(nfunc
) - 1);
83 if (!(qedi_dbg_log
& QEDI_LOG_NOTICE
))
86 if (likely(qedi
) && likely(qedi
->pdev
))
87 pr_notice("[%s]:[%s:%d]:%d: %pV",
88 dev_name(&qedi
->pdev
->dev
), nfunc
, line
,
91 pr_notice("[0000:00:00.0]:[%s:%d]: %pV", nfunc
, line
, &vaf
);
98 qedi_dbg_info(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
99 u32 level
, const char *fmt
, ...)
102 struct va_format vaf
;
105 memset(nfunc
, 0, sizeof(nfunc
));
106 memcpy(nfunc
, func
, sizeof(nfunc
) - 1);
113 if (!(qedi_dbg_log
& level
))
116 if (likely(qedi
) && likely(qedi
->pdev
))
117 pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
118 nfunc
, line
, qedi
->host_no
, &vaf
);
120 pr_info("[0000:00:00.0]:[%s:%d]: %pV", nfunc
, line
, &vaf
);
127 qedi_create_sysfs_attr(struct Scsi_Host
*shost
, struct sysfs_bin_attrs
*iter
)
131 for (; iter
->name
; iter
++) {
132 ret
= sysfs_create_bin_file(&shost
->shost_gendev
.kobj
,
135 pr_err("Unable to create sysfs %s attr, err(%d).\n",
142 qedi_remove_sysfs_attr(struct Scsi_Host
*shost
, struct sysfs_bin_attrs
*iter
)
144 for (; iter
->name
; iter
++)
145 sysfs_remove_bin_file(&shost
->shost_gendev
.kobj
, iter
->attr
);