Skip to content

Commit

Permalink
additional fix for CR-1147090 ASTeR TC 19.02 - v70 - card can (Xilinx…
Browse files Browse the repository at this point in the history
…#7219)

intermittently not initialize after a cold reboot which causes xbmgmt
examine to hang indefinitely

Signed-off-by: David Zhang <[email protected]>

Signed-off-by: David Zhang <[email protected]>
  • Loading branch information
xdavidz authored Dec 13, 2022
1 parent 13f95fd commit 77d5102
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/hwmon_sdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ static int parse_sdr_info(char *in_buf, struct xocl_hwmon_sdm *sdm, bool create_

static int create_hwmon_sysfs(struct platform_device *pdev)
{
struct xocl_hwmon_sdm *sdm;
struct xocl_hwmon_sdm *sdm = NULL;
struct xocl_dev_core *core;
int err;

Expand All @@ -1203,29 +1203,28 @@ static int create_hwmon_sysfs(struct platform_device *pdev)
if (!sdm->supported)
return 0;

err = device_create_file(sdm->hwmon_dev, &name_attr.dev_attr);
if (err) {
xocl_err(&pdev->dev, "create attr name failed: 0x%x", err);
return err;
}

sdm->hwmon_dev = hwmon_device_register(&core->pdev->dev);
if (IS_ERR(sdm->hwmon_dev)) {
err = PTR_ERR(sdm->hwmon_dev);
xocl_err(&pdev->dev, "register sdm hwmon failed: 0x%x", err);
goto hwmon_reg_failed;
sdm->hwmon_dev = NULL;
goto failed;
}

dev_set_drvdata(sdm->hwmon_dev, sdm);

err = device_create_file(sdm->hwmon_dev, &name_attr.dev_attr);
if (err) {
xocl_err(&pdev->dev, "create attr name failed: 0x%x", err);
goto create_name_failed;
}

xocl_dbg(&pdev->dev, "created hwmon sysfs list");
sdm->sysfs_created = true;

return 0;

create_name_failed:
hwmon_device_unregister(sdm->hwmon_dev);
hwmon_reg_failed:
failed:
device_remove_file(sdm->hwmon_dev, &name_attr.dev_attr);
sdm->hwmon_dev = NULL;
return err;
}
Expand Down Expand Up @@ -1410,13 +1409,14 @@ static void destroy_hwmon_sysfs(struct platform_device *pdev)
if (!sdm->supported)
return;

sysfs_remove_group(&pdev->dev.kobj, &hwmon_sdm_bdinfo_attrgroup);

if (sdm->hwmon_dev) {
device_remove_file(sdm->hwmon_dev, &name_attr.dev_attr);
hwmon_device_unregister(sdm->hwmon_dev);
device_remove_file(sdm->hwmon_dev, &name_attr.dev_attr);
sdm->hwmon_dev = NULL;
}

sysfs_remove_group(&pdev->dev.kobj, &hwmon_sdm_bdinfo_attrgroup);
}

static int hwmon_sdm_probe(struct platform_device *pdev)
Expand Down

0 comments on commit 77d5102

Please sign in to comment.