]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/scsi/qedi/qedi_dbg.c
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
);
67 qedi_dbg_notice(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
74 memset(nfunc
, 0, sizeof(nfunc
));
75 memcpy(nfunc
, func
, sizeof(nfunc
) - 1);
82 if (!(qedi_dbg_log
& QEDI_LOG_NOTICE
))
85 if (likely(qedi
) && likely(qedi
->pdev
))
86 pr_notice("[%s]:[%s:%d]:%d: %pV",
87 dev_name(&qedi
->pdev
->dev
), nfunc
, line
,
90 pr_notice("[0000:00:00.0]:[%s:%d]: %pV", nfunc
, line
, &vaf
);
96 qedi_dbg_info(struct qedi_dbg_ctx
*qedi
, const char *func
, u32 line
,
97 u32 level
, const char *fmt
, ...)
100 struct va_format vaf
;
103 memset(nfunc
, 0, sizeof(nfunc
));
104 memcpy(nfunc
, func
, sizeof(nfunc
) - 1);
111 if (!(qedi_dbg_log
& level
))
114 if (likely(qedi
) && likely(qedi
->pdev
))
115 pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi
->pdev
->dev
),
116 nfunc
, line
, qedi
->host_no
, &vaf
);
118 pr_info("[0000:00:00.0]:[%s:%d]: %pV", nfunc
, line
, &vaf
);
124 qedi_create_sysfs_attr(struct Scsi_Host
*shost
, struct sysfs_bin_attrs
*iter
)
128 for (; iter
->name
; iter
++) {
129 ret
= sysfs_create_bin_file(&shost
->shost_gendev
.kobj
,
132 pr_err("Unable to create sysfs %s attr, err(%d).\n",
139 qedi_remove_sysfs_attr(struct Scsi_Host
*shost
, struct sysfs_bin_attrs
*iter
)
141 for (; iter
->name
; iter
++)
142 sysfs_remove_bin_file(&shost
->shost_gendev
.kobj
, iter
->attr
);