diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-01-08 16:07:22 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-08 19:40:46 -0500 |
commit | 781d0d89224bbbc438c2c0360cfd4822bb35d280 (patch) | |
tree | ccda09fa57cd18a9f875bf46d0ce35b925cd9219 /drivers/misc/mei/wd.c | |
parent | 1a1aca42c989051dce34d49b4e04a25dafe01d74 (diff) |
mei: normalize me host client linking routines
In order we can use the same code pattern for in-kernel
and user space host clients we replace mei_cl_link_to_me
with mei_cl_link function.
We then have to keep me client lookupout of the new link function.
The unlinking cannot be yet symetric due to amthif connection
handling
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/wd.c')
-rw-r--r-- | drivers/misc/mei/wd.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c index bfcbcc8c028b..77b3820380b0 100644 --- a/drivers/misc/mei/wd.c +++ b/drivers/misc/mei/wd.c | |||
@@ -64,30 +64,41 @@ static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) | |||
64 | */ | 64 | */ |
65 | int mei_wd_host_init(struct mei_device *dev) | 65 | int mei_wd_host_init(struct mei_device *dev) |
66 | { | 66 | { |
67 | int id; | 67 | struct mei_cl *cl = &dev->wd_cl; |
68 | mei_cl_init(&dev->wd_cl, dev); | 68 | int i; |
69 | int ret; | ||
70 | |||
71 | mei_cl_init(cl, dev); | ||
69 | 72 | ||
70 | /* look for WD client and connect to it */ | ||
71 | dev->wd_cl.state = MEI_FILE_DISCONNECTED; | ||
72 | dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; | 73 | dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; |
73 | dev->wd_state = MEI_WD_IDLE; | 74 | dev->wd_state = MEI_WD_IDLE; |
74 | 75 | ||
75 | /* Connect WD ME client to the host client */ | ||
76 | id = mei_cl_link_me(&dev->wd_cl, | ||
77 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); | ||
78 | 76 | ||
79 | if (id < 0) { | 77 | /* check for valid client id */ |
78 | i = mei_me_cl_by_uuid(dev, &mei_wd_guid); | ||
79 | if (i < 0) { | ||
80 | dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); | 80 | dev_info(&dev->pdev->dev, "wd: failed to find the client\n"); |
81 | return -ENOENT; | 81 | return -ENOENT; |
82 | } | 82 | } |
83 | 83 | ||
84 | if (mei_hbm_cl_connect_req(dev, &dev->wd_cl)) { | 84 | cl->me_client_id = dev->me_clients[i].client_id; |
85 | |||
86 | ret = mei_cl_link(cl, MEI_WD_HOST_CLIENT_ID); | ||
87 | |||
88 | if (ret < 0) { | ||
89 | dev_info(&dev->pdev->dev, "wd: failed link client\n"); | ||
90 | return -ENOENT; | ||
91 | } | ||
92 | |||
93 | cl->state = MEI_FILE_CONNECTING; | ||
94 | |||
95 | if (mei_hbm_cl_connect_req(dev, cl)) { | ||
85 | dev_err(&dev->pdev->dev, "wd: failed to connect to the client\n"); | 96 | dev_err(&dev->pdev->dev, "wd: failed to connect to the client\n"); |
86 | dev->wd_cl.state = MEI_FILE_DISCONNECTED; | 97 | cl->state = MEI_FILE_DISCONNECTED; |
87 | dev->wd_cl.host_client_id = 0; | 98 | cl->host_client_id = 0; |
88 | return -EIO; | 99 | return -EIO; |
89 | } | 100 | } |
90 | dev->wd_cl.timer_count = MEI_CONNECT_TIMEOUT; | 101 | cl->timer_count = MEI_CONNECT_TIMEOUT; |
91 | 102 | ||
92 | return 0; | 103 | return 0; |
93 | } | 104 | } |