]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
accel/habanalabs: restructure function that checks heartbeat received
authorOhad Sharabi <osharabi@habana.ai>
Sun, 18 Feb 2024 07:38:23 +0000 (09:38 +0200)
committerOfir Bitton <obitton@habana.ai>
Sun, 23 Jun 2024 06:44:25 +0000 (09:44 +0300)
The function returned an error code which isn't propagated up the stack
(nor is it printed).

The return value is only checked for =0 or !=0 which implies bool return
value.

The function signature is updated accordingly, renamed, and slightly
refactored.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Ofir Bitton <obitton@habana.ai>
Signed-off-by: Ofir Bitton <obitton@habana.ai>
drivers/accel/habanalabs/common/device.c

index a381ece2559283b7bf51fe1f36b66fae1ea4e3bc..eee41c367bd1823188ac873da91fbe75b178322c 100644 (file)
@@ -1048,21 +1048,21 @@ static bool is_pci_link_healthy(struct hl_device *hdev)
        return (device_id == hdev->pdev->device);
 }
 
-static int hl_device_eq_heartbeat_check(struct hl_device *hdev)
+static bool hl_device_eq_heartbeat_received(struct hl_device *hdev)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
 
        if (!prop->cpucp_info.eq_health_check_supported)
-               return 0;
+               return true;
 
-       if (hdev->eq_heartbeat_received) {
-               hdev->eq_heartbeat_received = false;
-       } else {
+       if (!hdev->eq_heartbeat_received) {
                dev_err(hdev->dev, "EQ heartbeat event was not received!\n");
-               return -EIO;
+               return false;
        }
 
-       return 0;
+       hdev->eq_heartbeat_received = false;
+
+       return true;
 }
 
 static void hl_device_heartbeat(struct work_struct *work)
@@ -1081,7 +1081,7 @@ static void hl_device_heartbeat(struct work_struct *work)
         * in order to validate the eq is working.
         * Only if both the EQ is healthy and we managed to send the next heartbeat reschedule.
         */
-       if ((!hl_device_eq_heartbeat_check(hdev)) && (!hdev->asic_funcs->send_heartbeat(hdev)))
+       if (hl_device_eq_heartbeat_received(hdev) && (!hdev->asic_funcs->send_heartbeat(hdev)))
                goto reschedule;
 
        if (hl_device_operational(hdev, NULL))