Commit 0c3de38f authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by James Bottomley

scsi: remove SPRINTF macro

The macro SPRINTF doesn't save a lot of typing or make the code more
readable, and depending on a specific identifier (m) in the
surrounding scope is generally frowned upon. Nuke it.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5af2e382
......@@ -716,8 +716,6 @@ static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
}
#endif
#undef SPRINTF
#define SPRINTF(args...) seq_printf(m, ## args)
static
void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m);
static
......@@ -734,19 +732,19 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
hostdata = (struct NCR5380_hostdata *) instance->hostdata;
#ifdef PSEUDO_DMA
SPRINTF("Highwater I/O busy spin counts: write %d, read %d\n",
seq_printf(m, "Highwater I/O busy spin counts: write %d, read %d\n",
hostdata->spin_max_w, hostdata->spin_max_r);
#endif
spin_lock_irq(instance->host_lock);
if (!hostdata->connected)
SPRINTF("scsi%d: no currently connected command\n", instance->host_no);
seq_printf(m, "scsi%d: no currently connected command\n", instance->host_no);
else
lprint_Scsi_Cmnd((struct scsi_cmnd *) hostdata->connected, m);
SPRINTF("scsi%d: issue_queue\n", instance->host_no);
seq_printf(m, "scsi%d: issue_queue\n", instance->host_no);
for (ptr = (struct scsi_cmnd *) hostdata->issue_queue; ptr; ptr = (struct scsi_cmnd *) ptr->host_scribble)
lprint_Scsi_Cmnd(ptr, m);
SPRINTF("scsi%d: disconnected_queue\n", instance->host_no);
seq_printf(m, "scsi%d: disconnected_queue\n", instance->host_no);
for (ptr = (struct scsi_cmnd *) hostdata->disconnected_queue; ptr; ptr = (struct scsi_cmnd *) ptr->host_scribble)
lprint_Scsi_Cmnd(ptr, m);
spin_unlock_irq(instance->host_lock);
......@@ -755,8 +753,8 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
{
SPRINTF("scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
SPRINTF(" command = ");
seq_printf(m, "scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
seq_printf(m, " command = ");
lprint_command(cmd->cmnd, m);
}
......@@ -765,13 +763,13 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
int i, s;
lprint_opcode(command[0], m);
for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
SPRINTF("%02x ", command[i]);
SPRINTF("\n");
seq_printf(m, "%02x ", command[i]);
seq_printf(m, "\n");
}
static void lprint_opcode(int opcode, struct seq_file *m)
{
SPRINTF("%2d (0x%02x)", opcode, opcode);
seq_printf(m, "%2d (0x%02x)", opcode, opcode);
}
......
This diff is collapsed.
......@@ -4610,13 +4610,10 @@ static void adapter_uninit(struct AdapterCtlBlk *acb)
}
#undef SPRINTF
#define SPRINTF(args...) seq_printf(m,##args)
#undef YESNO
#define YESNO(YN) \
if (YN) SPRINTF(" Yes ");\
else SPRINTF(" No ")
if (YN) seq_printf(m, " Yes ");\
else seq_printf(m, " No ")
static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
{
......@@ -4626,47 +4623,44 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
unsigned long flags;
int dev;
SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n");
SPRINTF(" Driver Version " DC395X_VERSION "\n");
seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
seq_printf(m, " Driver Version " DC395X_VERSION "\n");
DC395x_LOCK_IO(acb->scsi_host, flags);
SPRINTF("SCSI Host Nr %i, ", host->host_no);
SPRINTF("DC395U/UW/F DC315/U %s\n",
seq_printf(m, "SCSI Host Nr %i, ", host->host_no);
seq_printf(m, "DC395U/UW/F DC315/U %s\n",
(acb->config & HCC_WIDE_CARD) ? "Wide" : "");
SPRINTF("io_port_base 0x%04lx, ", acb->io_port_base);
SPRINTF("irq_level 0x%04x, ", acb->irq_level);
SPRINTF(" SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
seq_printf(m, "io_port_base 0x%04lx, ", acb->io_port_base);
seq_printf(m, "irq_level 0x%04x, ", acb->irq_level);
seq_printf(m, " SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
SPRINTF("MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
SPRINTF("AdapterID %i\n", host->this_id);
seq_printf(m, "MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
seq_printf(m, "AdapterID %i\n", host->this_id);
SPRINTF("tag_max_num %i", acb->tag_max_num);
/*SPRINTF(", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
SPRINTF(", FilterCfg 0x%02x",
seq_printf(m, "tag_max_num %i", acb->tag_max_num);
/*seq_printf(m, ", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
seq_printf(m, ", FilterCfg 0x%02x",
DC395x_read8(acb, TRM_S1040_SCSI_CONFIG1));
SPRINTF(", DelayReset %is\n", acb->eeprom.delay_time);
/*SPRINTF("\n"); */
seq_printf(m, ", DelayReset %is\n", acb->eeprom.delay_time);
/*seq_printf(m, "\n"); */
SPRINTF("Nr of DCBs: %i\n", list_size(&acb->dcb_list));
SPRINTF
("Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
seq_printf(m, "Nr of DCBs: %i\n", list_size(&acb->dcb_list));
seq_printf(m, "Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
acb->dcb_map[0], acb->dcb_map[1], acb->dcb_map[2],
acb->dcb_map[3], acb->dcb_map[4], acb->dcb_map[5],
acb->dcb_map[6], acb->dcb_map[7]);
SPRINTF
(" %02x %02x %02x %02x %02x %02x %02x %02x\n",
seq_printf(m, " %02x %02x %02x %02x %02x %02x %02x %02x\n",
acb->dcb_map[8], acb->dcb_map[9], acb->dcb_map[10],
acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
acb->dcb_map[14], acb->dcb_map[15]);
SPRINTF
("Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
dev = 0;
list_for_each_entry(dcb, &acb->dcb_list, list) {
int nego_period;
SPRINTF("%02i %02i %02i ", dev, dcb->target_id,
seq_printf(m, "%02i %02i %02i ", dev, dcb->target_id,
dcb->target_lun);
YESNO(dcb->dev_mode & NTC_DO_PARITY_CHK);
YESNO(dcb->sync_offset);
......@@ -4676,53 +4670,53 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
YESNO(dcb->sync_mode & EN_TAG_QUEUEING);
nego_period = clock_period[dcb->sync_period & 0x07] << 2;
if (dcb->sync_offset)
SPRINTF(" %03i ns ", nego_period);
seq_printf(m, " %03i ns ", nego_period);
else
SPRINTF(" (%03i ns)", (dcb->min_nego_period << 2));
seq_printf(m, " (%03i ns)", (dcb->min_nego_period << 2));
if (dcb->sync_offset & 0x0f) {
spd = 1000 / (nego_period);
spd1 = 1000 % (nego_period);
spd1 = (spd1 * 10 + nego_period / 2) / (nego_period);
SPRINTF(" %2i.%1i M %02i ", spd, spd1,
seq_printf(m, " %2i.%1i M %02i ", spd, spd1,
(dcb->sync_offset & 0x0f));
} else
SPRINTF(" ");
seq_printf(m, " ");
/* Add more info ... */
SPRINTF(" %02i\n", dcb->max_command);
seq_printf(m, " %02i\n", dcb->max_command);
dev++;
}
if (timer_pending(&acb->waiting_timer))
SPRINTF("Waiting queue timer running\n");
seq_printf(m, "Waiting queue timer running\n");
else
SPRINTF("\n");
seq_printf(m, "\n");
list_for_each_entry(dcb, &acb->dcb_list, list) {
struct ScsiReqBlk *srb;
if (!list_empty(&dcb->srb_waiting_list))
SPRINTF("DCB (%02i-%i): Waiting: %i:",
seq_printf(m, "DCB (%02i-%i): Waiting: %i:",
dcb->target_id, dcb->target_lun,
list_size(&dcb->srb_waiting_list));
list_for_each_entry(srb, &dcb->srb_waiting_list, list)
SPRINTF(" %p", srb->cmd);
seq_printf(m, " %p", srb->cmd);
if (!list_empty(&dcb->srb_going_list))
SPRINTF("\nDCB (%02i-%i): Going : %i:",
seq_printf(m, "\nDCB (%02i-%i): Going : %i:",
dcb->target_id, dcb->target_lun,
list_size(&dcb->srb_going_list));
list_for_each_entry(srb, &dcb->srb_going_list, list)
SPRINTF(" %p", srb->cmd);
seq_printf(m, " %p", srb->cmd);
if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
SPRINTF("\n");
seq_printf(m, "\n");
}
if (debug_enabled(DBG_1)) {
SPRINTF("DCB list for ACB %p:\n", acb);
seq_printf(m, "DCB list for ACB %p:\n", acb);
list_for_each_entry(dcb, &acb->dcb_list, list) {
SPRINTF("%p -> ", dcb);
seq_printf(m, "%p -> ", dcb);
}
SPRINTF("END\n");
seq_printf(m, "END\n");
}
DC395x_UNLOCK_IO(acb->scsi_host, flags);
......
......@@ -1441,8 +1441,6 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
return IRQ_RETVAL(handled);
}
#undef SPRINTF
#define SPRINTF(args...) seq_printf(m, ##args)
static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
{
......@@ -1458,64 +1456,63 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
data = (nsp32_hw_data *)host->hostdata;
base = host->io_port;
SPRINTF("NinjaSCSI-32 status\n\n");
SPRINTF("Driver version: %s, $Revision: 1.33 $\n", nsp32_release_version);
SPRINTF("SCSI host No.: %d\n", hostno);
SPRINTF("IRQ: %d\n", host->irq);
SPRINTF("IO: 0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
SPRINTF("sg_tablesize: %d\n", host->sg_tablesize);
SPRINTF("Chip revision: 0x%x\n", (nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
seq_printf(m, "NinjaSCSI-32 status\n\n");
seq_printf(m, "Driver version: %s, $Revision: 1.33 $\n", nsp32_release_version);
seq_printf(m, "SCSI host No.: %d\n", hostno);
seq_printf(m, "IRQ: %d\n", host->irq);
seq_printf(m, "IO: 0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
seq_printf(m, "sg_tablesize: %d\n", host->sg_tablesize);
seq_printf(m, "Chip revision: 0x%x\n", (nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
mode_reg = nsp32_index_read1(base, CHIP_MODE);
model = data->pci_devid->driver_data;
#ifdef CONFIG_PM
SPRINTF("Power Management: %s\n", (mode_reg & OPTF) ? "yes" : "no");
seq_printf(m, "Power Management: %s\n", (mode_reg & OPTF) ? "yes" : "no");
#endif
SPRINTF("OEM: %ld, %s\n", (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
seq_printf(m, "OEM: %ld, %s\n", (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
spin_lock_irqsave(&(data->Lock), flags);
SPRINTF("CurrentSC: 0x%p\n\n", data->CurrentSC);
seq_printf(m, "CurrentSC: 0x%p\n\n", data->CurrentSC);
spin_unlock_irqrestore(&(data->Lock), flags);
SPRINTF("SDTR status\n");
seq_printf(m, "SDTR status\n");
for (id = 0; id < ARRAY_SIZE(data->target); id++) {
SPRINTF("id %d: ", id);
seq_printf(m, "id %d: ", id);
if (id == host->this_id) {
SPRINTF("----- NinjaSCSI-32 host adapter\n");
seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
continue;
}
if (data->target[id].sync_flag == SDTR_DONE) {
if (data->target[id].period == 0 &&
data->target[id].offset == ASYNC_OFFSET ) {
SPRINTF("async");
seq_printf(m, "async");
} else {
SPRINTF(" sync");
seq_printf(m, " sync");
}
} else {
SPRINTF(" none");
seq_printf(m, " none");
}
if (data->target[id].period != 0) {
speed = 1000000 / (data->target[id].period * 4);
SPRINTF(" transfer %d.%dMB/s, offset %d",
seq_printf(m, " transfer %d.%dMB/s, offset %d",
speed / 1000,
speed % 1000,
data->target[id].offset
);
}
SPRINTF("\n");
seq_printf(m, "\n");
}
return 0;
}
#undef SPRINTF
......
......@@ -1364,9 +1364,6 @@ static const char *nsp_info(struct Scsi_Host *shpnt)
return data->nspinfo;
}
#undef SPRINTF
#define SPRINTF(args...) seq_printf(m, ##args)
static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
{
int id;
......@@ -1378,75 +1375,74 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
hostno = host->host_no;
data = (nsp_hw_data *)host->hostdata;
SPRINTF("NinjaSCSI status\n\n");
SPRINTF("Driver version: $Revision: 1.23 $\n");
SPRINTF("SCSI host No.: %d\n", hostno);
SPRINTF("IRQ: %d\n", host->irq);
SPRINTF("IO: 0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
SPRINTF("sg_tablesize: %d\n", host->sg_tablesize);
seq_printf(m, "NinjaSCSI status\n\n");
seq_printf(m, "Driver version: $Revision: 1.23 $\n");
seq_printf(m, "SCSI host No.: %d\n", hostno);
seq_printf(m, "IRQ: %d\n", host->irq);
seq_printf(m, "IO: 0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
seq_printf(m, "sg_tablesize: %d\n", host->sg_tablesize);
SPRINTF("burst transfer mode: ");
seq_printf(m, "burst transfer mode: ");
switch (nsp_burst_mode) {
case BURST_IO8:
SPRINTF("io8");
seq_printf(m, "io8");
break;
case BURST_IO32:
SPRINTF("io32");
seq_printf(m, "io32");
break;
case BURST_MEM32:
SPRINTF("mem32");
seq_printf(m, "mem32");
break;
default:
SPRINTF("???");
seq_printf(m, "???");
break;
}
SPRINTF("\n");
seq_printf(m, "\n");
spin_lock_irqsave(&(data->Lock), flags);
SPRINTF("CurrentSC: 0x%p\n\n", data->CurrentSC);
seq_printf(m, "CurrentSC: 0x%p\n\n", data->CurrentSC);
spin_unlock_irqrestore(&(data->Lock), flags);
SPRINTF("SDTR status\n");
seq_printf(m, "SDTR status\n");
for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
SPRINTF("id %d: ", id);
seq_printf(m, "id %d: ", id);
if (id == host->this_id) {
SPRINTF("----- NinjaSCSI-3 host adapter\n");
seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
continue;
}
switch(data->Sync[id].SyncNegotiation) {
case SYNC_OK:
SPRINTF(" sync");
seq_printf(m, " sync");
break;
case SYNC_NG:
SPRINTF("async");
seq_printf(m, "async");
break;
case SYNC_NOT_YET:
SPRINTF(" none");
seq_printf(m, " none");
break;
default:
SPRINTF("?????");
seq_printf(m, "?????");
break;
}
if (data->Sync[id].SyncPeriod != 0) {
speed = 1000000 / (data->Sync[id].SyncPeriod * 4);
SPRINTF(" transfer %d.%dMB/s, offset %d",
seq_printf(m, " transfer %d.%dMB/s, offset %d",
speed / 1000,
speed % 1000,
data->Sync[id].SyncOffset
);
}
SPRINTF("\n");
seq_printf(m, "\n");
}
return 0;
}
#undef SPRINTF
/*---------------------------------------------------------------*/
/* error handler */
......
......@@ -1295,9 +1295,6 @@ static void wd7000_revision(Adapter * host)
}
#undef SPRINTF
#define SPRINTF(args...) { seq_printf(m, ## args); }
static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length)
{
dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length);
......@@ -1320,43 +1317,43 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
#endif
spin_lock_irqsave(host->host_lock, flags);
SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
SPRINTF(" IO base: 0x%x\n", adapter->iobase);
SPRINTF(" IRQ: %d\n", adapter->irq);
SPRINTF(" DMA channel: %d\n", adapter->dma);
SPRINTF(" Interrupts: %d\n", adapter->int_counter);
SPRINTF(" BUS_ON time: %d nanoseconds\n", adapter->bus_on * 125);
SPRINTF(" BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
seq_printf(m, "Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
seq_printf(m, " IO base: 0x%x\n", adapter->iobase);
seq_printf(m, " IRQ: %d\n", adapter->irq);
seq_printf(m, " DMA channel: %d\n", adapter->dma);
seq_printf(m, " Interrupts: %d\n", adapter->int_counter);
seq_printf(m, " BUS_ON time: %d nanoseconds\n", adapter->bus_on * 125);
seq_printf(m, " BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
#ifdef WD7000_DEBUG
ogmbs = adapter->mb.ogmb;
icmbs = adapter->mb.icmb;
SPRINTF("\nControl port value: 0x%x\n", adapter->control);
SPRINTF("Incoming mailbox:\n");
SPRINTF(" size: %d\n", ICMB_CNT);
SPRINTF(" queued messages: ");
seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
seq_printf(m, "Incoming mailbox:\n");
seq_printf(m, " size: %d\n", ICMB_CNT);
seq_printf(m, " queued messages: ");
for (i = count = 0; i < ICMB_CNT; i++)
if (icmbs[i].status) {
count++;
SPRINTF("0x%x ", i);
seq_printf(m, "0x%x ", i);
}
SPRINTF(count ? "\n" : "none\n");
seq_printf(m, count ? "\n" : "none\n");
SPRINTF("Outgoing mailbox:\n");
SPRINTF(" size: %d\n", OGMB_CNT);
SPRINTF(" next message: 0x%x\n", adapter->next_ogmb);
SPRINTF(" queued messages: ");
seq_printf(m, "Outgoing mailbox:\n");
seq_printf(m, " size: %d\n", OGMB_CNT);
seq_printf(m, " next message: 0x%x\n", adapter->next_ogmb);
seq_printf(m, " queued messages: ");
for (i = count = 0; i < OGMB_CNT; i++)
if (ogmbs[i].status) {
count++;
SPRINTF("0x%x ", i);
seq_printf(m, "0x%x ", i);
}
SPRINTF(count ? "\n" : "none\n");
seq_printf(m, count ? "\n" : "none\n");
#endif
spin_unlock_irqrestore(host->host_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment