/** * mei_wd_host_init - connect to the watchdog client * * @dev: the device structure * @me_cl: me client * * Return: -ENOTTY if wd client cannot be found * -EIO if write has failed * 0 on success */ int mei_wd_host_init(struct mei_device *dev, struct mei_me_client *me_cl) { struct mei_cl *cl = &dev->wd_cl; int ret; mei_cl_init(cl, dev); dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; dev->wd_state = MEI_WD_IDLE; ret = mei_cl_link(cl, MEI_WD_HOST_CLIENT_ID); if (ret < 0) { dev_info(dev->dev, "wd: failed link client\n"); return ret; } ret = mei_cl_connect(cl, me_cl, NULL); if (ret) { dev_err(dev->dev, "wd: failed to connect = %d\n", ret); mei_cl_unlink(cl); return ret; } ret = mei_watchdog_register(dev); if (ret) { mei_cl_disconnect(cl); mei_cl_unlink(cl); } return ret; }
/** * mei_wd_host_init - connect to the watchdog client * * @dev: the device structure * * returns -ENENT if wd client cannot be found * -EIO if write has failed * 0 on success */ int mei_wd_host_init(struct mei_device *dev) { struct mei_cl *cl = &dev->wd_cl; int i; int ret; mei_cl_init(cl, dev); dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; dev->wd_state = MEI_WD_IDLE; /* check for valid client id */ i = mei_me_cl_by_uuid(dev, &mei_wd_guid); if (i < 0) { dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); return -ENOENT; } cl->me_client_id = dev->me_clients[i].client_id; ret = mei_cl_link(cl, MEI_WD_HOST_CLIENT_ID); if (ret < 0) { dev_info(&dev->pdev->dev, "wd: failed link client\n"); return -ENOENT; } cl->state = MEI_FILE_CONNECTING; ret = mei_cl_connect(cl, NULL); if (ret) { dev_err(&dev->pdev->dev, "wd: failed to connect = %d\n", ret); mei_cl_unlink(cl); return ret; } ret = mei_watchdog_register(dev); if (ret) { mei_cl_disconnect(cl); mei_cl_unlink(cl); } return ret; }