Skip to content

Commit 5692102

Browse files
committed
accel/habanalabs: remove sim code
There were a few places where simulator only code got into the upstream. Remove those places that can confuse other developers. Fixes: 2a0a839 ("habanalabs: extend fatal messages to contain PCI info") Cc: Moti Haimovski <[email protected]> Cc: Dan Carpenter <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent 5d658d0 commit 5692102

File tree

2 files changed

+7
-26
lines changed

2 files changed

+7
-26
lines changed

drivers/accel/habanalabs/common/device.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,13 +2328,9 @@ int hl_device_init(struct hl_device *hdev)
23282328
hdev->disabled = true;
23292329
if (expose_interfaces_on_err)
23302330
cdev_sysfs_debugfs_add(hdev);
2331-
if (hdev->pdev)
2332-
dev_err(&hdev->pdev->dev,
2333-
"Failed to initialize hl%d. Device %s is NOT usable !\n",
2334-
hdev->cdev_idx, dev_name(&(hdev)->pdev->dev));
2335-
else
2336-
pr_err("Failed to initialize hl%d. Device %s is NOT usable !\n",
2337-
hdev->cdev_idx, dev_name(&(hdev)->pdev->dev));
2331+
dev_err(&hdev->pdev->dev,
2332+
"Failed to initialize hl%d. Device %s is NOT usable !\n",
2333+
hdev->cdev_idx, dev_name(&hdev->pdev->dev));
23382334

23392335
return rc;
23402336
}

drivers/accel/habanalabs/common/habanalabs.h

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,12 +2558,7 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
25582558
ktime_t __timeout; \
25592559
u32 __elbi_read; \
25602560
int __rc = 0; \
2561-
if (hdev->pdev) \
2562-
__timeout = ktime_add_us(ktime_get(), timeout_us); \
2563-
else \
2564-
__timeout = ktime_add_us(ktime_get(),\
2565-
min((u64)(timeout_us * 10), \
2566-
(u64) HL_SIM_MAX_TIMEOUT_US)); \
2561+
__timeout = ktime_add_us(ktime_get(), timeout_us); \
25672562
might_sleep_if(sleep_us); \
25682563
for (;;) { \
25692564
if (elbi) { \
@@ -2615,13 +2610,7 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
26152610
u8 __arr_idx; \
26162611
int __rc = 0; \
26172612
\
2618-
if (hdev->pdev) \
2619-
__timeout = ktime_add_us(ktime_get(), timeout_us); \
2620-
else \
2621-
__timeout = ktime_add_us(ktime_get(),\
2622-
min(((u64)timeout_us * 10), \
2623-
(u64) HL_SIM_MAX_TIMEOUT_US)); \
2624-
\
2613+
__timeout = ktime_add_us(ktime_get(), timeout_us); \
26252614
might_sleep_if(sleep_us); \
26262615
if (arr_size >= 64) \
26272616
__rc = -EINVAL; \
@@ -2679,12 +2668,8 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val);
26792668
mem_written_by_device) \
26802669
({ \
26812670
ktime_t __timeout; \
2682-
if (hdev->pdev) \
2683-
__timeout = ktime_add_us(ktime_get(), timeout_us); \
2684-
else \
2685-
__timeout = ktime_add_us(ktime_get(),\
2686-
min((u64)(timeout_us * 100), \
2687-
(u64) HL_SIM_MAX_TIMEOUT_US)); \
2671+
\
2672+
__timeout = ktime_add_us(ktime_get(), timeout_us); \
26882673
might_sleep_if(sleep_us); \
26892674
for (;;) { \
26902675
/* Verify we read updates done by other cores or by device */ \

0 commit comments

Comments
 (0)