/** * mei_wd_ops_start - wd start command from the watchdog core. * * @wd_dev: watchdog device struct * * Return: 0 if success, negative errno code for failure */ static int mei_wd_ops_start(struct watchdog_device *wd_dev) { struct mei_device *dev; struct mei_cl *cl; int err = -ENODEV; dev = watchdog_get_drvdata(wd_dev); if (!dev) return -ENODEV; cl = &dev->wd_cl; mutex_lock(&dev->device_lock); if (dev->dev_state != MEI_DEV_ENABLED) { dev_dbg(dev->dev, "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n", mei_dev_state_str(dev->dev_state)); goto end_unlock; } if (!mei_cl_is_connected(cl)) { cl_dbg(dev, cl, "MEI Driver is not connected to Watchdog Client\n"); goto end_unlock; } mei_wd_set_start_timeout(dev, dev->wd_timeout); err = 0; end_unlock: mutex_unlock(&dev->device_lock); return err; }
/* * mei_wd_ops_start - wd start command from the watchdog core. * * @wd_dev - watchdog device struct * * returns 0 if success, negative errno code for failure */ static int mei_wd_ops_start(struct watchdog_device *wd_dev) { int err = -ENODEV; struct mei_device *dev; dev = pci_get_drvdata(mei_device); if (!dev) return -ENODEV; mutex_lock(&dev->device_lock); if (dev->mei_state != MEI_ENABLED) { dev_dbg(&dev->pdev->dev, "wd: mei_state != MEI_ENABLED mei_state = %d\n", dev->mei_state); goto end_unlock; } if (dev->wd_cl.state != MEI_FILE_CONNECTED) { dev_dbg(&dev->pdev->dev, "MEI Driver is not connected to Watchdog Client\n"); goto end_unlock; } mei_wd_set_start_timeout(dev, dev->wd_timeout); err = 0; end_unlock: mutex_unlock(&dev->device_lock); return err; }
/* * mei_wd_ops_set_timeout - wd set timeout command from the watchdog core. * * @wd_dev - watchdog device struct * @timeout - timeout value to set * * returns 0 if success, negative errno code for failure */ static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout) { struct mei_device *dev; dev = pci_get_drvdata(mei_device); if (!dev) return -ENODEV; /* Check Timeout value */ if (timeout < AMT_WD_MIN_TIMEOUT || timeout > AMT_WD_MAX_TIMEOUT) return -EINVAL; mutex_lock(&dev->device_lock); dev->wd_timeout = timeout; mei_wd_set_start_timeout(dev, dev->wd_timeout); mutex_unlock(&dev->device_lock); return 0; }