Skip to content

Commit c5f2e64

Browse files
akpm@osdl.orgJames Bottomley
authored andcommitted
[SCSI] scsi_scan.c: fix compile warnings
drivers/scsi/scsi_scan.c: In function `scsi_probe_and_add_lun': drivers/scsi/scsi_scan.c:926: warning: unused variable `vend' drivers/scsi/scsi_scan.c:926: warning: unused variable `mod' drivers/scsi/scsi_scan.c: At top level: drivers/scsi/scsi_scan.c:829: warning: `scsi_inq_str' defined but not used Fix those, tighten up the (somewhat poorly-designed) logging macro and fix some coding-style warts. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent cdb8c2a commit c5f2e64

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

drivers/scsi/scsi_logging.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ extern unsigned int scsi_logging_level;
4545
((scsi_logging_level >> (SHIFT)) & ((1 << (BITS)) - 1))
4646

4747
#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD) \
48-
{ \
48+
do { \
4949
if (unlikely((SCSI_LOG_LEVEL(SHIFT, BITS)) > (LEVEL))) \
50-
(CMD); \
51-
}
50+
do { \
51+
CMD; \
52+
} while (0); \
53+
} while (0)
5254
#else
5355
#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)
5456
#endif /* CONFIG_SCSI_LOGGING */

drivers/scsi/scsi_scan.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
816816
put_device(&sdev->sdev_gendev);
817817
}
818818

819+
#ifdef CONFIG_SCSI_LOGGING
819820
/**
820821
* scsi_inq_str - print INQUIRY data from min to max index,
821822
* strip trailing whitespace
@@ -824,12 +825,13 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
824825
* @first: Offset of string into inq
825826
* @end: Index after last character in inq
826827
*/
827-
static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
828+
static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq,
828829
unsigned first, unsigned end)
829830
{
830831
unsigned term = 0, idx;
831-
for (idx = 0; idx+first < end && idx+first < inq[4]+5; ++idx) {
832-
if (inq[idx+first] > 0x20) {
832+
833+
for (idx = 0; idx + first < end && idx + first < inq[4] + 5; idx++) {
834+
if (inq[idx+first] > ' ') {
833835
buf[idx] = inq[idx+first];
834836
term = idx+1;
835837
} else {
@@ -839,6 +841,7 @@ static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
839841
buf[term] = 0;
840842
return buf;
841843
}
844+
#endif
842845

843846
/**
844847
* scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
@@ -923,12 +926,16 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
923926
" peripheral qualifier of 3, device not"
924927
" added\n"))
925928
if (lun == 0) {
926-
unsigned char vend[9], mod[17];
927-
SCSI_LOG_SCAN_BUS(1, sdev_printk(KERN_INFO, sdev,
929+
SCSI_LOG_SCAN_BUS(1, {
930+
unsigned char vend[9];
931+
unsigned char mod[17];
932+
933+
sdev_printk(KERN_INFO, sdev,
928934
"scsi scan: consider passing scsi_mod."
929935
"dev_flags=%s:%s:0x240 or 0x800240\n",
930936
scsi_inq_str(vend, result, 8, 16),
931-
scsi_inq_str(mod, result, 16, 32)));
937+
scsi_inq_str(mod, result, 16, 32));
938+
});
932939
}
933940

934941
res = SCSI_SCAN_TARGET_PRESENT;

0 commit comments

Comments
 (0)