monitor: Tie fan FRU functional state with `set_func_on_present`

Only update the fan FRU to functional when the fan FRU has been replaced
or a poweroff->poweron has occured while `set_func_on_present`
configuration is set.

Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I814b29c7d773a403ccf25b8edb9a196528bfb139
diff --git a/docs/monitor/set_func_on_present.md b/docs/monitor/set_func_on_present.md
index 0837c4f..c9df66e 100644
--- a/docs/monitor/set_func_on_present.md
+++ b/docs/monitor/set_func_on_present.md
@@ -1,11 +1,18 @@
 # set_func_on_present
 
 ## Description
-If the fan FRU and contained rotors should be set to functional immediately on
-presence being detected.  Any faults will be re-detected.  This attribute is
-optional and defaults to false, meaning a newly inserted fan will need to spin
-up before being set back to functional, and if it never spins up, there won't
-be additional errors.
+Immediately set the fan FRU's contained rotors to functional when the fan's
+presence has been detected and **only** allow the fan FRU to be set to
+functional when presence is detected. Using this configuration option
+essentially latches a nonfunctional fan FRU to nonfunctional until it has been
+replaced (i.e. removed and replugged). It does still allow the functional state
+of the rotors to continue to be updated to reflect their current functional
+state(s). After a fan's presence has been detected, any faults will be
+re-detected for that fan FRU and its contained rotors.
+
+This attribute is optional and defaults to false, meaning a newly inserted fan
+will need to spin up before being set back to functional, and if it never spins
+up, there won't be additional errors.
 
 ## Attribute Value(s)
 bool (default = false)
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index 09af6cd..a8efc4c 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -399,8 +399,10 @@
     {
         auto numNonFuncSensors = countNonFunctionalSensors();
         // If the fan was nonfunctional and enough sensors are now OK,
-        // the fan can be set to functional
-        if (!_functional && !(numNonFuncSensors >= _numSensorFailsForNonFunc))
+        // the fan can be set to functional as long as `set_func_on_present` was
+        // not set
+        if (!_setFuncOnPresent && !_functional &&
+            !(numNonFuncSensors >= _numSensorFailsForNonFunc))
         {
             getLogger().log(fmt::format("Setting fan {} to functional, number "
                                         "of nonfunctional sensors = {}",