> +#define scmd_format_header(b, l, d, t) \ > + sdev_format_header(b, l, (d) ? (d)->disk_name : NULL, t) I'd rather have a static inline const char *scmd_name(struct scsi_cmnd *scmd) { return scmd->request->rq_disk ? scmd->request->rq_disk->disk_name : NULL; } helper and use that directlu, which also gets rid of all the local gendisk variables. > + if (scsi_sense_is_deferred(sshdr)) > + off += scnprintf(buffer + off, buf_len - off, "[deferred] "); > + else > + off += scnprintf(buffer + off, buf_len - off, "[current] "); off += scnprintf(buffer + off, buf_len - off, scsi_sense_is_deferred(sshdr) ? "[deferred] " : "[current] "); > +{ > + struct scsi_sense_hdr sshdr; > + > + if (!scsi_normalize_sense(sense_buffer, sense_len, &sshdr)) { > + int i; > + > + for (i = 0; i < sense_len; i += 16) { > + char *logbuf; > + int len = min(sense_len - i, 16); > + size_t off, logbuf_len; > + > + logbuf = scsi_log_reserve_buffer(&logbuf_len); > + if (!logbuf) > + break; > + off = sdev_format_header(logbuf, logbuf_len, > + name, tag); > + hex_dump_to_buffer(&sense_buffer[i], len, 16, 1, > + logbuf + off, logbuf_len - off, > + false); > + dev_printk(KERN_INFO, &sdev->sdev_gendev, logbuf); > + scsi_log_release_buffer(logbuf); > + } > + return; Keeping the code inside the if in a separate helper would probably be a lot more readable. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html