Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: mei_wdt: re-register device on event

For Intel SKL platform the ME device can inform the host via
asynchronous notification that the watchdog feature was activated
on the device. The activation doesn't require reboot.
In that case the driver registers the watchdog device with the kernel.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tomas Winkler and committed by
Greg Kroah-Hartman
3a20a5c3 ad1cd720

+26 -2
+26 -2
drivers/watchdog/mei_wdt.c
··· 481 481 complete(&wdt->response); 482 482 } 483 483 484 + /* 485 + * mei_wdt_notify_event - callback for event notification 486 + * 487 + * @cldev: bus device 488 + */ 489 + static void mei_wdt_notify_event(struct mei_cl_device *cldev) 490 + { 491 + struct mei_wdt *wdt = mei_cldev_get_drvdata(cldev); 492 + 493 + if (wdt->state != MEI_WDT_NOT_REQUIRED) 494 + return; 495 + 496 + mei_wdt_register(wdt); 497 + } 498 + 484 499 /** 485 500 * mei_wdt_event - callback for event receive 486 501 * ··· 508 493 { 509 494 if (events & BIT(MEI_CL_EVENT_RX)) 510 495 mei_wdt_event_rx(cldev); 496 + 497 + if (events & BIT(MEI_CL_EVENT_NOTIF)) 498 + mei_wdt_notify_event(cldev); 511 499 } 512 500 513 501 #if IS_ENABLED(CONFIG_DEBUG_FS) ··· 623 605 goto err_out; 624 606 } 625 607 626 - ret = mei_cldev_register_event_cb(wdt->cldev, BIT(MEI_CL_EVENT_RX), 608 + ret = mei_cldev_register_event_cb(wdt->cldev, 609 + BIT(MEI_CL_EVENT_RX) | 610 + BIT(MEI_CL_EVENT_NOTIF), 627 611 mei_wdt_event, NULL); 628 - if (ret) { 612 + 613 + /* on legacy devices notification is not supported 614 + * this doesn't fail the registration for RX event 615 + */ 616 + if (ret && ret != -EOPNOTSUPP) { 629 617 dev_err(&cldev->dev, "Could not register event ret=%d\n", ret); 630 618 goto err_disable; 631 619 }