/* Each counter is 8-bits, and saturates at 255 (0xFF). They are copied to the EEPROM (aka flash) whenever ipath_update_eeprom_log() is called, but it can only be called in a context that allows sleep. This function can be called even at interrupt level.  */
void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr)
/* Each counter is 8-bits, and saturates at 255 (0xFF). They are copied to the EEPROM (aka flash) whenever ipath_update_eeprom_log() is called, but it can only be called in a context that allows sleep. This function can be called even at interrupt level.  */
void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr)
{
	uint new_val;
	unsigned long flags;
	spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
	new_val = dd->ipath_eep_st_new_errs[eidx] + incr;
	if (new_val > 255)
		new_val = 255;
	dd->ipath_eep_st_new_errs[eidx] = new_val;
	spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
	return;
}