From: Greg Kroah-Hartman Date: Mon, 7 Dec 2020 09:08:14 +0000 (+0100) Subject: Merge 5.10-rc7 into char-misc-next X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a3ab07c642b2d75e645b1a07464291e325a496e0;p=linux.git Merge 5.10-rc7 into char-misc-next We want the fixes in here, and this resolves a merge issue with drivers/misc/habanalabs/common/memory.c. Signed-off-by: Greg Kroah-Hartman --- a3ab07c642b2d75e645b1a07464291e325a496e0 diff --cc drivers/misc/habanalabs/common/device.c index c9011541c647,783bbdcb1e61..5871162a8442 --- a/drivers/misc/habanalabs/common/device.c +++ b/drivers/misc/habanalabs/common/device.c @@@ -252,28 -237,12 +248,32 @@@ static void device_cdev_sysfs_del(struc hl_sysfs_fini(hdev); cdev_device_del(&hdev->cdev_ctrl, hdev->dev_ctrl); cdev_device_del(&hdev->cdev, hdev->dev); + + put_devices: + put_device(hdev->dev); + put_device(hdev->dev_ctrl); } +static void device_hard_reset_pending(struct work_struct *work) +{ + struct hl_device_reset_work *device_reset_work = + container_of(work, struct hl_device_reset_work, + reset_work.work); + struct hl_device *hdev = device_reset_work->hdev; + int rc; + + rc = hl_device_reset(hdev, true, true); + if ((rc == -EBUSY) && !hdev->device_fini_pending) { + dev_info(hdev->dev, + "Could not reset device. will try again in %u seconds", + HL_PENDING_RESET_PER_SEC); + + queue_delayed_work(device_reset_work->wq, + &device_reset_work->reset_work, + msecs_to_jiffies(HL_PENDING_RESET_PER_SEC * 1000)); + } +} + /* * device_early_init - do some early initialization for the habanalabs device *