mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-17 03:58:36 +00:00
habanalabs: re-factor goya_parse_cb_no_ext_queue()
This patch re-factors goya_parse_cb_no_ext_queue() to make it more readable by inverting the check inside the first if statement so the bulk of the function won't be inside an if statement. The patch also fixes a spelling error in the name of the function. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
parent
e00dac3daa
commit
883c2459a5
1 changed files with 21 additions and 22 deletions
|
@ -3858,14 +3858,16 @@ free_userptr:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,
|
static int goya_parse_cb_no_ext_queue(struct hl_device *hdev,
|
||||||
struct hl_cs_parser *parser)
|
struct hl_cs_parser *parser)
|
||||||
{
|
{
|
||||||
struct asic_fixed_properties *asic_prop = &hdev->asic_prop;
|
struct asic_fixed_properties *asic_prop = &hdev->asic_prop;
|
||||||
struct goya_device *goya = hdev->asic_specific;
|
struct goya_device *goya = hdev->asic_specific;
|
||||||
|
|
||||||
if (!(goya->hw_cap_initialized & HW_CAP_MMU)) {
|
if (goya->hw_cap_initialized & HW_CAP_MMU)
|
||||||
/* For internal queue jobs, just check if cb address is valid */
|
return 0;
|
||||||
|
|
||||||
|
/* For internal queue jobs, just check if CB address is valid */
|
||||||
if (hl_mem_area_inside_range(
|
if (hl_mem_area_inside_range(
|
||||||
(u64) (uintptr_t) parser->user_cb,
|
(u64) (uintptr_t) parser->user_cb,
|
||||||
parser->user_cb_size,
|
parser->user_cb_size,
|
||||||
|
@ -3887,15 +3889,12 @@ static int goya_parse_cb_no_ext_quque(struct hl_device *hdev,
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int goya_cs_parser(struct hl_device *hdev, struct hl_cs_parser *parser)
|
int goya_cs_parser(struct hl_device *hdev, struct hl_cs_parser *parser)
|
||||||
{
|
{
|
||||||
struct goya_device *goya = hdev->asic_specific;
|
struct goya_device *goya = hdev->asic_specific;
|
||||||
|
|
||||||
if (!parser->ext_queue)
|
if (!parser->ext_queue)
|
||||||
return goya_parse_cb_no_ext_quque(hdev, parser);
|
return goya_parse_cb_no_ext_queue(hdev, parser);
|
||||||
|
|
||||||
if ((goya->hw_cap_initialized & HW_CAP_MMU) && parser->use_virt_addr)
|
if ((goya->hw_cap_initialized & HW_CAP_MMU) && parser->use_virt_addr)
|
||||||
return goya_parse_cb_mmu(hdev, parser);
|
return goya_parse_cb_mmu(hdev, parser);
|
||||||
|
|
Loading…
Add table
Reference in a new issue