/* Check whether any MFGPTs are available for the kernel to use. In most cases, firmware that uses AMD's VSA code will claim all timers during bootup; we certainly don't want to take them if they're already in use. In other cases (such as with VSAless OpenFirmware), the system firmware leaves timers available for us to use.  */
static int __init scan_timers(struct cs5535_mfgpt_chip *mfgpt)
/* Check whether any MFGPTs are available for the kernel to use. In most cases, firmware that uses AMD's VSA code will claim all timers during bootup; we certainly don't want to take them if they're already in use. In other cases (such as with VSAless OpenFirmware), the system firmware leaves timers available for us to use.  */
static int __init scan_timers(struct cs5535_mfgpt_chip *mfgpt)
{
	struct cs5535_mfgpt_timer timer = { .chip = mfgpt };
	unsigned long flags;
	int timers = 0;
	uint16_t val;
	int i;
	if (mfgpt_reset_timers)
		reset_all_timers();
	spin_lock_irqsave(&mfgpt->lock, flags);
	for (i = 0; i < MFGPT_MAX_TIMERS; i++) {
		timer.nr = i;
		val = cs5535_mfgpt_read(&timer, MFGPT_REG_SETUP);
		if (!(val & MFGPT_SETUP_SETUP)) {
			__set_bit(i, mfgpt->avail);
			timers++;
		}
	}
	spin_unlock_irqrestore(&mfgpt->lock, flags);
	return timers;
}