A method, apparatus and computer program product are provided for detecting and
powering off unused I/O slots in a computer system. For each of the I/O slots,
the current slot is checked to determine if the slot is powered on and unlocked.
When the current slot is powered on and unlocked, the current slot is checked to
determine if the current slot is a candidate for being powered off. When the current
slot is determined to be a candidate for being powered off, then the current slot
is powered off and the checking continues with a next one of the I/O slots. Recording
the slot as a candidate for being powered off before the slot is actually powered
off ensures a proper delay to avoid powering off a slot that is about to be locked,
which could cause slot power cycles in quick succession.