ACPI / PM: Check device state before refcounting power resources