[SCSI] sym2: Report disabled devices and LUNs more attractively
authorMatthew Wilcox <matthew@wil.cx>
Wed, 30 Nov 2005 04:08:46 +0000 (23:08 -0500)
committerJames Bottomley <jejb@mulgrave.(none)>
Wed, 14 Dec 2005 01:11:47 +0000 (18:11 -0700)
Rather than print a list of targets at driver init time, print each
disabled target as we attempt to scan it.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/scsi/sym53c8xx_2/sym_hipd.c

index cb3d195bdb941e36218d93e74b060d27dc69934f..1fffd2b3c654d93da2ef9f49d1b4ac929dd3d5a0 100644 (file)
@@ -1018,6 +1018,7 @@ static int sym53c8xx_slave_alloc(struct scsi_device *sdev)
        if (sdev->id >= SYM_CONF_MAX_TARGET || sdev->lun >= SYM_CONF_MAX_LUN)
                return -ENXIO;
 
+       tp->starget = sdev->sdev_target;
        /*
         * Fail the device init if the device is flagged NOSCAN at BOOT in
         * the NVRAM.  This may speed up boot and maintain coherency with
@@ -1027,17 +1028,24 @@ static int sym53c8xx_slave_alloc(struct scsi_device *sdev)
         * lun devices behave badly when asked for a non zero LUN.
         */
 
-       if ((tp->usrflags & SYM_SCAN_BOOT_DISABLED) ||
-           ((tp->usrflags & SYM_SCAN_LUNS_DISABLED) && sdev->lun != 0)) {
+       if (tp->usrflags & SYM_SCAN_BOOT_DISABLED) {
                tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED;
+               starget_printk(KERN_INFO, tp->starget,
+                               "Scan at boot disabled in NVRAM\n");
                return -ENXIO;
        }
 
+       if (tp->usrflags & SYM_SCAN_LUNS_DISABLED) {
+               if (sdev->lun != 0)
+                       return -ENXIO;
+               starget_printk(KERN_INFO, tp->starget,
+                               "Multiple LUNs disabled in NVRAM\n");
+       }
+
        lp = sym_alloc_lcb(np, sdev->id, sdev->lun);
        if (!lp)
                return -ENOMEM;
 
-       tp->starget = sdev->sdev_target;
        spi_min_period(tp->starget) = tp->usr_period;
        spi_max_width(tp->starget) = tp->usr_width;
 
index 0b0cba0d0bbe2307ce5180fdd40ba05b141bf151..7a3c807dcfcaa69645c7e7dd831ce4fa78ca6f11 100644 (file)
@@ -616,29 +616,6 @@ static __inline void sym_init_burst(struct sym_hcb *np, u_char bc)
        }
 }
 
-
-/*
- * Print out the list of targets that have some flag disabled by user.
- */
-static void sym_print_targets_flag(struct sym_hcb *np, int mask, char *msg)
-{
-       int cnt;
-       int i;
-
-       for (cnt = 0, i = 0 ; i < SYM_CONF_MAX_TARGET ; i++) {
-               if (i == np->myaddr)
-                       continue;
-               if (np->target[i].usrflags & mask) {
-                       if (!cnt++)
-                               printf("%s: %s disabled for targets",
-                                       sym_name(np), msg);
-                       printf(" %d", i);
-               }
-       }
-       if (cnt)
-               printf(".\n");
-}
-
 /*
  *  Save initial settings of some IO registers.
  *  Assumed to have been set by BIOS.
@@ -986,13 +963,6 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
                        sym_name(np), np->rv_scntl3, np->rv_dmode, np->rv_dcntl,
                        np->rv_ctest3, np->rv_ctest4, np->rv_ctest5);
        }
-       /*
-        *  Let user be aware of targets that have some disable flags set.
-        */
-       sym_print_targets_flag(np, SYM_SCAN_BOOT_DISABLED, "SCAN AT BOOT");
-       if (sym_verbose)
-               sym_print_targets_flag(np, SYM_SCAN_LUNS_DISABLED,
-                                      "SCAN FOR LUNS");
 
        return 0;
 }