Commit f50332ff authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by James Bottomley

scsi: print single-character strings with seq_putc

Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.
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 3d30079c
......@@ -764,7 +764,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
lprint_opcode(command[0], m);
for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
seq_printf(m, "%02x ", command[i]);
seq_puts(m, "\n");
seq_putc(m, '\n');
}
static void lprint_opcode(int opcode, struct seq_file *m)
......
......@@ -3088,7 +3088,7 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
for (i = 0; i <= ASC_MAX_TID; i++)
seq_printf(m, " %c",
(ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
#ifdef CONFIG_ISA
if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
......@@ -3203,7 +3203,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
seq_puts(m, " Target ID: ");
for (i = 0; i <= ADV_MAX_TID; i++)
seq_printf(m, " %X", i);
seq_puts(m, "\n");
seq_putc(m, '\n');
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
word = ep_3550->disc_enable;
......@@ -3216,7 +3216,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
for (i = 0; i <= ADV_MAX_TID; i++)
seq_printf(m, " %c",
(word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
word = ep_3550->tagqng_able;
......@@ -3229,7 +3229,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
for (i = 0; i <= ADV_MAX_TID; i++)
seq_printf(m, " %c",
(word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
word = ep_3550->start_motor;
......@@ -3242,7 +3242,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
for (i = 0; i <= ADV_MAX_TID; i++)
seq_printf(m, " %c",
(word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
seq_puts(m, " Synchronous Transfer:");
......@@ -3250,7 +3250,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
seq_printf(m, " %c",
(ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
}
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
......@@ -3259,7 +3259,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
seq_printf(m, " %c",
(ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
? 'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
}
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
......@@ -3273,7 +3273,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
for (i = 0; i <= ADV_MAX_TID; i++)
seq_printf(m, " %c",
(word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
seq_puts(m, "\n");
seq_putc(m, '\n');
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
......@@ -3318,7 +3318,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
seq_puts(m, "\n ");
sdtr_speed >>= 4;
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
}
......@@ -3448,7 +3448,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
i,
(v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
for (i = 0; i <= ASC_MAX_TID; i++) {
uchar syn_period_ix;
......@@ -3483,7 +3483,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
seq_puts(m, "*\n");
renegotiate = 1;
} else {
seq_puts(m, "\n");
seq_putc(m, '\n');
}
}
......@@ -3570,7 +3570,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
seq_printf(m, " %X:%d", i, lrambyte);
}
seq_puts(m, "\n");
seq_putc(m, '\n');
AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
seq_puts(m, " Wide Enabled:");
......@@ -3584,7 +3584,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
i,
(wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
seq_puts(m, " Transfer Bit Width:");
......@@ -3603,11 +3603,11 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
(wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
seq_puts(m, "*");
seq_putc(m, '*');
renegotiate = 1;
}
}
seq_puts(m, "\n");
seq_putc(m, '\n');
AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
seq_puts(m, " Synchronous Enabled:");
......@@ -3621,7 +3621,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
i,
(sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
for (i = 0; i <= ADV_MAX_TID; i++) {
......@@ -3670,7 +3670,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
seq_puts(m, "*\n");
renegotiate = 1;
} else {
seq_puts(m, "\n");
seq_putc(m, '\n');
}
}
......
......@@ -148,9 +148,9 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
}
seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
} else if (freq != 0) {
seq_puts(m, ")");
seq_putc(m, ')');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
static void
......@@ -294,14 +294,14 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
seq_puts(m, "Serial EEPROM:\n");
for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
if (((i % 8) == 0) && (i != 0)) {
seq_puts(m, "\n");
seq_putc(m, '\n');
}
seq_printf(m, "0x%.4x ",
((uint16_t*)ahd->seep_config)[i]);
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
if ((ahd->features & AHD_WIDE) == 0)
max_targ = 8;
......
......@@ -125,9 +125,9 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
}
seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
} else if (freq != 0) {
seq_puts(m, ")");
seq_putc(m, ')');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
static void
......@@ -308,14 +308,14 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
seq_puts(m, "Serial EEPROM:\n");
for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
if (((i % 8) == 0) && (i != 0)) {
seq_puts(m, "\n");
seq_putc(m, '\n');
}
seq_printf(m, "0x%.4x ",
((uint16_t*)ahc->seep_config)[i]);
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
seq_puts(m, "\n");
seq_putc(m, '\n');
max_targ = 16;
if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
......
......@@ -716,7 +716,7 @@ static void show_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
seq_printf(m, " %02x", command[i]);
seq_puts(m, "\n");
seq_putc(m, '\n');
}
static int __maybe_unused NCR5380_show_info(struct seq_file *m,
......
......@@ -4692,7 +4692,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
if (timer_pending(&acb->waiting_timer))
seq_puts(m, "Waiting queue timer running\n");
else
seq_puts(m, "\n");
seq_putc(m, '\n');
list_for_each_entry(dcb, &acb->dcb_list, list) {
struct ScsiReqBlk *srb;
......@@ -4709,7 +4709,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
list_for_each_entry(srb, &dcb->srb_going_list, list)
seq_printf(m, " %p", srb->cmd);
if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
seq_puts(m, "\n");
seq_putc(m, '\n');
}
if (debug_enabled(DBG_1)) {
......
......@@ -749,7 +749,7 @@ int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh)
if (dev_count == 0)
seq_puts(m, "none\n");
seq_puts(m, "\n");
seq_putc(m, '\n');
return 0;
}
......
......@@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
if (hd->proc & PR_TEST) {
; /* insert your own custom function here */
}
seq_puts(m, "\n");
seq_putc(m, '\n');
spin_unlock_irqrestore(instance->host_lock, flags);
#endif /* PROC_INTERFACE */
return 0;
......
......@@ -2137,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
seq_printf(m, "\tCurrent Active PT Commands : %d\n",
ha->num_ioctl);
seq_puts(m, "\n");
seq_putc(m, '\n');
return 0;
}
......
......@@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
data->target[id].offset
);
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
return 0;
}
......
......@@ -1398,7 +1398,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
seq_puts(m, "???");
break;
}
seq_puts(m, "\n");
seq_putc(m, '\n');
spin_lock_irqsave(&(data->Lock), flags);
......@@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
data->Sync[id].SyncOffset
);
}
seq_puts(m, "\n");
seq_putc(m, '\n');
}
return 0;
}
......
......@@ -38,7 +38,7 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
seq_printf(s, "\n%llx: ",
(unsigned long long)((cnt * 4) + fce_start));
else
seq_puts(s, " ");
seq_putc(s, ' ');
seq_printf(s, "%08x", *fce++);
}
......
......@@ -191,7 +191,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
if (sdev->vendor[i] >= 0x20)
seq_putc(s, sdev->vendor[i]);
else
seq_puts(s, " ");
seq_putc(s, ' ');
}
seq_puts(s, " Model: ");
......@@ -199,7 +199,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
if (sdev->model[i] >= 0x20)
seq_putc(s, sdev->model[i]);
else
seq_puts(s, " ");
seq_putc(s, ' ');
}
seq_puts(s, " Rev: ");
......@@ -207,10 +207,10 @@ static int proc_print_scsidevice(struct device *dev, void *data)
if (sdev->rev[i] >= 0x20)
seq_putc(s, sdev->rev[i]);
else
seq_puts(s, " ");
seq_putc(s, ' ');
}
seq_puts(s, "\n");
seq_putc(s, '\n');
seq_printf(s, " Type: %s ", scsi_device_type(sdev->type));
seq_printf(s, " ANSI SCSI revision: %02x",
......@@ -218,7 +218,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
if (sdev->scsi_level == 2)
seq_puts(s, " CCS\n");
else
seq_puts(s, "\n");
seq_putc(s, '\n');
out:
return 0;
......
......@@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
{
const char *ret = trace_seq_buffer_ptr(p);
trace_seq_puts(p, "-");
trace_seq_putc(p, '-');
trace_seq_putc(p, 0);
return ret;
......
......@@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
cmd = (struct scsi_cmnd *) cmd->host_scribble;
}
}
seq_puts(m, "\n");
seq_putc(m, '\n');
spin_unlock_irq(&hd->lock);
#endif /* PROC_INTERFACE */
return 0;
......
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