Linux-libre 3.14.34-gnu
[librecmc/linux-libre.git] / drivers / scsi / bnx2fc / bnx2fc_debug.c
1 #include "bnx2fc.h"
2
3 void BNX2FC_IO_DBG(const struct bnx2fc_cmd *io_req, const char *fmt, ...)
4 {
5         struct va_format vaf;
6         va_list args;
7
8         if (likely(!(bnx2fc_debug_level & LOG_IO)))
9                 return;
10
11         va_start(args, fmt);
12
13         vaf.fmt = fmt;
14         vaf.va = &args;
15
16         if (io_req && io_req->port && io_req->port->lport &&
17             io_req->port->lport->host)
18                 shost_printk(KERN_INFO, io_req->port->lport->host,
19                              PFX "xid:0x%x %pV",
20                              io_req->xid, &vaf);
21         else
22                 pr_info("NULL %pV", &vaf);
23
24         va_end(args);
25 }
26
27 void BNX2FC_TGT_DBG(const struct bnx2fc_rport *tgt, const char *fmt, ...)
28 {
29         struct va_format vaf;
30         va_list args;
31
32         if (likely(!(bnx2fc_debug_level & LOG_TGT)))
33                 return;
34
35         va_start(args, fmt);
36
37         vaf.fmt = fmt;
38         vaf.va = &args;
39
40         if (tgt && tgt->port && tgt->port->lport && tgt->port->lport->host &&
41             tgt->rport)
42                 shost_printk(KERN_INFO, tgt->port->lport->host,
43                              PFX "port:%x %pV",
44                              tgt->rport->port_id, &vaf);
45         else
46                 pr_info("NULL %pV", &vaf);
47
48         va_end(args);
49 }
50
51 void BNX2FC_HBA_DBG(const struct fc_lport *lport, const char *fmt, ...)
52 {
53         struct va_format vaf;
54         va_list args;
55
56         if (likely(!(bnx2fc_debug_level & LOG_HBA)))
57                 return;
58
59         va_start(args, fmt);
60
61         vaf.fmt = fmt;
62         vaf.va = &args;
63
64         if (lport && lport->host)
65                 shost_printk(KERN_INFO, lport->host, PFX "%pV", &vaf);
66         else
67                 pr_info("NULL %pV", &vaf);
68
69         va_end(args);
70 }