tree-wide: fix assorted typos all over the place
[safe/jmp/linux-2.6] / drivers / scsi / sym53c8xx_2 / sym_hipd.c
index fe6359d..a7bc8b7 100644 (file)
@@ -602,7 +602,7 @@ sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fa
 /*
  *  Set initial io register bits from burst code.
  */
-static __inline void sym_init_burst(struct sym_hcb *np, u_char bc)
+static inline void sym_init_burst(struct sym_hcb *np, u_char bc)
 {
        np->rv_ctest4   &= ~0x80;
        np->rv_dmode    &= ~(0x3 << 6);
@@ -1896,6 +1896,15 @@ void sym_start_up(struct Scsi_Host *shost, int reason)
                tp->head.sval = 0;
                tp->head.wval = np->rv_scntl3;
                tp->head.uval = 0;
+               if (tp->lun0p)
+                       tp->lun0p->to_clear = 0;
+               if (tp->lunmp) {
+                       int ln;
+
+                       for (ln = 1; ln < SYM_CONF_MAX_LUN; ln++)
+                               if (tp->lunmp[ln])
+                                       tp->lunmp[ln]->to_clear = 0;
+               }
        }
 
        /*
@@ -2039,6 +2048,29 @@ static void sym_settrans(struct sym_hcb *np, int target, u_char opts, u_char ofs
        }
 }
 
+static void sym_announce_transfer_rate(struct sym_tcb *tp)
+{
+       struct scsi_target *starget = tp->starget;
+
+       if (tp->tprint.period != spi_period(starget) ||
+           tp->tprint.offset != spi_offset(starget) ||
+           tp->tprint.width != spi_width(starget) ||
+           tp->tprint.iu != spi_iu(starget) ||
+           tp->tprint.dt != spi_dt(starget) ||
+           tp->tprint.qas != spi_qas(starget) ||
+           !tp->tprint.check_nego) {
+               tp->tprint.period = spi_period(starget);
+               tp->tprint.offset = spi_offset(starget);
+               tp->tprint.width = spi_width(starget);
+               tp->tprint.iu = spi_iu(starget);
+               tp->tprint.dt = spi_dt(starget);
+               tp->tprint.qas = spi_qas(starget);
+               tp->tprint.check_nego = 1;
+
+               spi_display_xfer_agreement(starget);
+       }
+}
+
 /*
  *  We received a WDTR.
  *  Let everything be aware of the changes.
@@ -2064,7 +2096,7 @@ static void sym_setwide(struct sym_hcb *np, int target, u_char wide)
        spi_qas(starget) = 0;
 
        if (sym_verbose >= 3)
-               spi_display_xfer_agreement(starget);
+               sym_announce_transfer_rate(tp);
 }
 
 /*
@@ -2097,7 +2129,7 @@ sym_setsync(struct sym_hcb *np, int target,
                tp->tgoal.check_nego = 0;
        }
 
-       spi_display_xfer_agreement(starget);
+       sym_announce_transfer_rate(tp);
 }
 
 /*
@@ -2125,7 +2157,7 @@ sym_setpprot(struct sym_hcb *np, int target, u_char opts, u_char ofs,
        spi_qas(starget) = tp->tgoal.qas = !!(opts & PPR_OPT_QAS);
        tp->tgoal.check_nego = 0;
 
-       spi_display_xfer_agreement(starget);
+       sym_announce_transfer_rate(tp);
 }
 
 /*
@@ -2289,8 +2321,9 @@ static void sym_int_par (struct sym_hcb *np, u_short sist)
        int phase       = cmd & 7;
        struct sym_ccb *cp      = sym_ccb_from_dsa(np, dsa);
 
-       printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
-               sym_name(np), hsts, dbc, sbcl);
+       if (printk_ratelimit())
+               printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
+                       sym_name(np), hsts, dbc, sbcl);
 
        /*
         *  Check that the chip is connected to the SCSI BUS.
@@ -2659,7 +2692,7 @@ static void sym_int_ma (struct sym_hcb *np)
         *  we force a SIR_NEGO_PROTO interrupt (it is a hack that avoids 
         *  bloat for such a should_not_happen situation).
         *  In all other situation, we reset the BUS.
-        *  Are these assumptions reasonnable ? (Wait and see ...)
+        *  Are these assumptions reasonable ? (Wait and see ...)
         */
 unexpected_phase:
        dsp -= 8;
@@ -4965,7 +4998,7 @@ struct sym_lcb *sym_alloc_lcb (struct sym_hcb *np, u_char tn, u_char ln)
         */
        if (ln && !tp->lunmp) {
                tp->lunmp = kcalloc(SYM_CONF_MAX_LUN, sizeof(struct sym_lcb *),
-                               GFP_KERNEL);
+                               GFP_ATOMIC);
                if (!tp->lunmp)
                        goto fail;
        }
@@ -4985,6 +5018,7 @@ struct sym_lcb *sym_alloc_lcb (struct sym_hcb *np, u_char tn, u_char ln)
                tp->lun0p = lp;
                tp->head.lun0_sa = cpu_to_scr(vtobus(lp));
        }
+       tp->nlcb++;
 
        /*
         *  Let the itl task point to error handling.
@@ -5062,6 +5096,43 @@ fail:
 }
 
 /*
+ *  Lun control block deallocation. Returns the number of valid remaing LCBs
+ *  for the target.
+ */
+int sym_free_lcb(struct sym_hcb *np, u_char tn, u_char ln)
+{
+       struct sym_tcb *tp = &np->target[tn];
+       struct sym_lcb *lp = sym_lp(tp, ln);
+
+       tp->nlcb--;
+
+       if (ln) {
+               if (!tp->nlcb) {
+                       kfree(tp->lunmp);
+                       sym_mfree_dma(tp->luntbl, 256, "LUNTBL");
+                       tp->lunmp = NULL;
+                       tp->luntbl = NULL;
+                       tp->head.luntbl_sa = cpu_to_scr(vtobus(np->badluntbl));
+               } else {
+                       tp->luntbl[ln] = cpu_to_scr(vtobus(&np->badlun_sa));
+                       tp->lunmp[ln] = NULL;
+               }
+       } else {
+               tp->lun0p = NULL;
+               tp->head.lun0_sa = cpu_to_scr(vtobus(&np->badlun_sa));
+       }
+
+       if (lp->itlq_tbl) {
+               sym_mfree_dma(lp->itlq_tbl, SYM_CONF_MAX_TASK*4, "ITLQ_TBL");
+               kfree(lp->cb_tags);
+       }
+
+       sym_mfree_dma(lp, sizeof(*lp), "LCB");
+
+       return tp->nlcb;
+}
+
+/*
  *  Queue a SCSI IO to the controller.
  */
 int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)