/* A table driven interrupt handler that applies a set of masks to an interrupt status word and performs the corresponding actions if the interrupts described by the mask have occured. The actions include optionally printing a warning or alert message, and optionally incrementing a stat counter. The table is terminated by an entry specifying mask 0. Returns the number of fatal interrupt conditions.  */
static int t3_handle_intr_status(struct adapter *adapter, unsigned int reg, unsigned int mask, const struct intr_info *acts, unsigned long *stats)
/* A table driven interrupt handler that applies a set of masks to an interrupt status word and performs the corresponding actions if the interrupts described by the mask have occured. The actions include optionally printing a warning or alert message, and optionally incrementing a stat counter. The table is terminated by an entry specifying mask 0. Returns the number of fatal interrupt conditions.  */
static int t3_handle_intr_status(struct adapter *adapter, unsigned int reg, unsigned int mask, const struct intr_info *acts, unsigned long *stats)
{
	int fatal = 0;
	unsigned int status = t3_read_reg(adapter, reg) & mask;
	for (; acts->mask; ++acts) {
		if (!(status & acts->mask))
			continue;
		if (acts->fatal) {
			fatal++;
			CH_ALERT(adapter, "%s (0x%x)\n",
				 acts->msg, status & acts->mask);
		} else if (acts->msg)
			CH_WARN(adapter, "%s (0x%x)\n",
				acts->msg, status & acts->mask);
		if (acts->stat_idx >= 0)
			stats[acts->stat_idx]++;
	}
	if (status)
		t3_write_reg(adapter, reg, status);
	return fatal;
}