aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2012-08-06 17:03:56 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-16 12:43:58 -0400
commitb210d7506f416e7250eb52c314e5ed08928639dd (patch)
treebc5232d3b3b197305a817a65302ba6bad529a322 /drivers/misc
parent6ddf3aea42ba20eadc8ff362926c947ac43c9401 (diff)
mei: name space for mei device state
1. add MEI_DEV_ prefix for mei device state enums 2. rename mei_state to dev_state 3. add constant to string translation for debug purposes Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/init.c54
-rw-r--r--drivers/misc/mei/interrupt.c22
-rw-r--r--drivers/misc/mei/iorw.c4
-rw-r--r--drivers/misc/mei/main.c24
-rw-r--r--drivers/misc/mei/mei_dev.h22
-rw-r--r--drivers/misc/mei/wd.c6
6 files changed, 77 insertions, 55 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 58b3bf47c8eb..cd6a7f1ff916 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -24,6 +24,25 @@
24#include "interface.h" 24#include "interface.h"
25#include <linux/mei.h> 25#include <linux/mei.h>
26 26
27const char *mei_dev_state_str(int state)
28{
29#define MEI_DEV_STATE(state) case MEI_DEV_##state: return #state
30 switch (state) {
31 MEI_DEV_STATE(INITIALIZING);
32 MEI_DEV_STATE(INIT_CLIENTS);
33 MEI_DEV_STATE(ENABLED);
34 MEI_DEV_STATE(RESETING);
35 MEI_DEV_STATE(DISABLED);
36 MEI_DEV_STATE(RECOVERING_FROM_RESET);
37 MEI_DEV_STATE(POWER_DOWN);
38 MEI_DEV_STATE(POWER_UP);
39 default:
40 return "unkown";
41 }
42#undef MEI_DEV_STATE
43}
44
45
27const uuid_le mei_amthi_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, 0xac, 46const uuid_le mei_amthi_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, 0xac,
28 0xa8, 0x46, 0xe0, 0xff, 0x65, 47 0xa8, 0x46, 0xe0, 0xff, 0x65,
29 0x81, 0x4c); 48 0x81, 0x4c);
@@ -123,7 +142,7 @@ struct mei_device *mei_device_init(struct pci_dev *pdev)
123 mutex_init(&dev->device_lock); 142 mutex_init(&dev->device_lock);
124 init_waitqueue_head(&dev->wait_recvd_msg); 143 init_waitqueue_head(&dev->wait_recvd_msg);
125 init_waitqueue_head(&dev->wait_stop_wd); 144 init_waitqueue_head(&dev->wait_stop_wd);
126 dev->mei_state = MEI_INITIALIZING; 145 dev->dev_state = MEI_DEV_INITIALIZING;
127 dev->iamthif_state = MEI_IAMTHIF_IDLE; 146 dev->iamthif_state = MEI_IAMTHIF_IDLE;
128 dev->wd_interface_reg = false; 147 dev->wd_interface_reg = false;
129 148
@@ -182,7 +201,7 @@ int mei_hw_init(struct mei_device *dev)
182 } 201 }
183 202
184 if (err <= 0 && !dev->recvd_msg) { 203 if (err <= 0 && !dev->recvd_msg) {
185 dev->mei_state = MEI_DISABLED; 204 dev->dev_state = MEI_DEV_DISABLED;
186 dev_dbg(&dev->pdev->dev, 205 dev_dbg(&dev->pdev->dev,
187 "wait_event_interruptible_timeout failed" 206 "wait_event_interruptible_timeout failed"
188 "on wait for ME to turn on ME_RDY.\n"); 207 "on wait for ME to turn on ME_RDY.\n");
@@ -192,7 +211,7 @@ int mei_hw_init(struct mei_device *dev)
192 211
193 if (!(((dev->host_hw_state & H_RDY) == H_RDY) && 212 if (!(((dev->host_hw_state & H_RDY) == H_RDY) &&
194 ((dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA))) { 213 ((dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA))) {
195 dev->mei_state = MEI_DISABLED; 214 dev->dev_state = MEI_DEV_DISABLED;
196 dev_dbg(&dev->pdev->dev, 215 dev_dbg(&dev->pdev->dev,
197 "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", 216 "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n",
198 dev->host_hw_state, dev->me_hw_state); 217 dev->host_hw_state, dev->me_hw_state);
@@ -258,15 +277,15 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
258 struct mei_cl_cb *cb_next = NULL; 277 struct mei_cl_cb *cb_next = NULL;
259 bool unexpected; 278 bool unexpected;
260 279
261 if (dev->mei_state == MEI_RECOVERING_FROM_RESET) { 280 if (dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) {
262 dev->need_reset = true; 281 dev->need_reset = true;
263 return; 282 return;
264 } 283 }
265 284
266 unexpected = (dev->mei_state != MEI_INITIALIZING && 285 unexpected = (dev->dev_state != MEI_DEV_INITIALIZING &&
267 dev->mei_state != MEI_DISABLED && 286 dev->dev_state != MEI_DEV_DISABLED &&
268 dev->mei_state != MEI_POWER_DOWN && 287 dev->dev_state != MEI_DEV_POWER_DOWN &&
269 dev->mei_state != MEI_POWER_UP); 288 dev->dev_state != MEI_DEV_POWER_UP);
270 289
271 dev->host_hw_state = mei_hcsr_read(dev); 290 dev->host_hw_state = mei_hcsr_read(dev);
272 291
@@ -285,10 +304,10 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
285 304
286 dev->need_reset = false; 305 dev->need_reset = false;
287 306
288 if (dev->mei_state != MEI_INITIALIZING) { 307 if (dev->dev_state != MEI_DEV_INITIALIZING) {
289 if (dev->mei_state != MEI_DISABLED && 308 if (dev->dev_state != MEI_DEV_DISABLED &&
290 dev->mei_state != MEI_POWER_DOWN) 309 dev->dev_state != MEI_DEV_POWER_DOWN)
291 dev->mei_state = MEI_RESETING; 310 dev->dev_state = MEI_DEV_RESETING;
292 311
293 list_for_each_entry_safe(cl_pos, 312 list_for_each_entry_safe(cl_pos,
294 cl_next, &dev->file_list, link) { 313 cl_next, &dev->file_list, link) {
@@ -322,7 +341,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
322 dev->host_hw_state, dev->me_hw_state); 341 dev->host_hw_state, dev->me_hw_state);
323 342
324 if (unexpected) 343 if (unexpected)
325 dev_warn(&dev->pdev->dev, "unexpected reset.\n"); 344 dev_warn(&dev->pdev->dev, "unexpected reset: dev_state = %s\n",
345 mei_dev_state_str(dev->dev_state));
326 346
327 /* Wake up all readings so they can be interrupted */ 347 /* Wake up all readings so they can be interrupted */
328 list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { 348 list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) {
@@ -371,7 +391,7 @@ void mei_host_start_message(struct mei_device *dev)
371 if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req, 391 if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req,
372 mei_hdr->length)) { 392 mei_hdr->length)) {
373 dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n"); 393 dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n");
374 dev->mei_state = MEI_RESETING; 394 dev->dev_state = MEI_DEV_RESETING;
375 mei_reset(dev, 1); 395 mei_reset(dev, 1);
376 } 396 }
377 dev->init_clients_state = MEI_START_MESSAGE; 397 dev->init_clients_state = MEI_START_MESSAGE;
@@ -403,7 +423,7 @@ void mei_host_enum_clients_message(struct mei_device *dev)
403 host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD; 423 host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD;
404 if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req, 424 if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req,
405 mei_hdr->length)) { 425 mei_hdr->length)) {
406 dev->mei_state = MEI_RESETING; 426 dev->dev_state = MEI_DEV_RESETING;
407 dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); 427 dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
408 mei_reset(dev, 1); 428 mei_reset(dev, 1);
409 } 429 }
@@ -444,7 +464,7 @@ void mei_allocate_me_clients_storage(struct mei_device *dev)
444 sizeof(struct mei_me_client), GFP_KERNEL); 464 sizeof(struct mei_me_client), GFP_KERNEL);
445 if (!clients) { 465 if (!clients) {
446 dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n"); 466 dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n");
447 dev->mei_state = MEI_RESETING; 467 dev->dev_state = MEI_DEV_RESETING;
448 mei_reset(dev, 1); 468 mei_reset(dev, 1);
449 return ; 469 return ;
450 } 470 }
@@ -490,7 +510,7 @@ int mei_host_client_properties(struct mei_device *dev)
490 if (mei_write_message(dev, mei_header, 510 if (mei_write_message(dev, mei_header,
491 (unsigned char *)host_cli_req, 511 (unsigned char *)host_cli_req,
492 mei_header->length)) { 512 mei_header->length)) {
493 dev->mei_state = MEI_RESETING; 513 dev->dev_state = MEI_DEV_RESETING;
494 dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); 514 dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
495 mei_reset(dev, 1); 515 mei_reset(dev, 1);
496 return -EIO; 516 return -EIO;
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index c6ffbbe5a6c0..94370d26ed45 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -633,7 +633,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
633 if (version_res->host_version_supported) { 633 if (version_res->host_version_supported) {
634 dev->version.major_version = HBM_MAJOR_VERSION; 634 dev->version.major_version = HBM_MAJOR_VERSION;
635 dev->version.minor_version = HBM_MINOR_VERSION; 635 dev->version.minor_version = HBM_MINOR_VERSION;
636 if (dev->mei_state == MEI_INIT_CLIENTS && 636 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
637 dev->init_clients_state == MEI_START_MESSAGE) { 637 dev->init_clients_state == MEI_START_MESSAGE) {
638 dev->init_clients_timer = 0; 638 dev->init_clients_timer = 0;
639 mei_host_enum_clients_message(dev); 639 mei_host_enum_clients_message(dev);
@@ -707,7 +707,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
707 dev->me_clients[dev->me_client_presentation_num].props 707 dev->me_clients[dev->me_client_presentation_num].props
708 = props_res->client_properties; 708 = props_res->client_properties;
709 709
710 if (dev->mei_state == MEI_INIT_CLIENTS && 710 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
711 dev->init_clients_state == 711 dev->init_clients_state ==
712 MEI_CLIENT_PROPERTIES_MESSAGE) { 712 MEI_CLIENT_PROPERTIES_MESSAGE) {
713 dev->me_client_index++; 713 dev->me_client_index++;
@@ -734,7 +734,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
734 * Client ID 2 - Reserved for AMTHI 734 * Client ID 2 - Reserved for AMTHI
735 */ 735 */
736 bitmap_set(dev->host_clients_map, 0, 3); 736 bitmap_set(dev->host_clients_map, 0, 3);
737 dev->mei_state = MEI_ENABLED; 737 dev->dev_state = MEI_DEV_ENABLED;
738 738
739 /* if wd initialization fails, initialization the AMTHI client, 739 /* if wd initialization fails, initialization the AMTHI client,
740 * otherwise the AMTHI client will be initialized after the WD client connect response 740 * otherwise the AMTHI client will be initialized after the WD client connect response
@@ -759,7 +759,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
759 case HOST_ENUM_RES_CMD: 759 case HOST_ENUM_RES_CMD:
760 enum_res = (struct hbm_host_enum_response *) mei_msg; 760 enum_res = (struct hbm_host_enum_response *) mei_msg;
761 memcpy(dev->me_clients_map, enum_res->valid_addresses, 32); 761 memcpy(dev->me_clients_map, enum_res->valid_addresses, 32);
762 if (dev->mei_state == MEI_INIT_CLIENTS && 762 if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
763 dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) { 763 dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) {
764 dev->init_clients_timer = 0; 764 dev->init_clients_timer = 0;
765 dev->me_client_presentation_num = 0; 765 dev->me_client_presentation_num = 0;
@@ -776,7 +776,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
776 break; 776 break;
777 777
778 case HOST_STOP_RES_CMD: 778 case HOST_STOP_RES_CMD:
779 dev->mei_state = MEI_DISABLED; 779 dev->dev_state = MEI_DEV_DISABLED;
780 dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n"); 780 dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n");
781 mei_reset(dev, 1); 781 mei_reset(dev, 1);
782 break; 782 break;
@@ -1240,7 +1240,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
1240 *slots -= dev->extra_write_index; 1240 *slots -= dev->extra_write_index;
1241 dev->extra_write_index = 0; 1241 dev->extra_write_index = 0;
1242 } 1242 }
1243 if (dev->mei_state == MEI_ENABLED) { 1243 if (dev->dev_state == MEI_DEV_ENABLED) {
1244 if (dev->wd_pending && 1244 if (dev->wd_pending &&
1245 mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { 1245 mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) {
1246 if (mei_wd_send(dev)) 1246 if (mei_wd_send(dev))
@@ -1361,8 +1361,8 @@ void mei_timer(struct work_struct *work)
1361 1361
1362 1362
1363 mutex_lock(&dev->device_lock); 1363 mutex_lock(&dev->device_lock);
1364 if (dev->mei_state != MEI_ENABLED) { 1364 if (dev->dev_state != MEI_DEV_ENABLED) {
1365 if (dev->mei_state == MEI_INIT_CLIENTS) { 1365 if (dev->dev_state == MEI_DEV_INIT_CLIENTS) {
1366 if (dev->init_clients_timer) { 1366 if (dev->init_clients_timer) {
1367 if (--dev->init_clients_timer == 0) { 1367 if (--dev->init_clients_timer == 0) {
1368 dev_dbg(&dev->pdev->dev, "IMEI reset due to init clients timeout ,init clients state = %d.\n", 1368 dev_dbg(&dev->pdev->dev, "IMEI reset due to init clients timeout ,init clients state = %d.\n",
@@ -1484,8 +1484,8 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
1484 1484
1485 /* check if ME wants a reset */ 1485 /* check if ME wants a reset */
1486 if ((dev->me_hw_state & ME_RDY_HRA) == 0 && 1486 if ((dev->me_hw_state & ME_RDY_HRA) == 0 &&
1487 dev->mei_state != MEI_RESETING && 1487 dev->dev_state != MEI_DEV_RESETING &&
1488 dev->mei_state != MEI_INITIALIZING) { 1488 dev->dev_state != MEI_DEV_INITIALIZING) {
1489 dev_dbg(&dev->pdev->dev, "FW not ready.\n"); 1489 dev_dbg(&dev->pdev->dev, "FW not ready.\n");
1490 mei_reset(dev, 1); 1490 mei_reset(dev, 1);
1491 mutex_unlock(&dev->device_lock); 1491 mutex_unlock(&dev->device_lock);
@@ -1498,7 +1498,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
1498 dev_dbg(&dev->pdev->dev, "we need to start the dev.\n"); 1498 dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
1499 dev->host_hw_state |= (H_IE | H_IG | H_RDY); 1499 dev->host_hw_state |= (H_IE | H_IG | H_RDY);
1500 mei_hcsr_set(dev); 1500 mei_hcsr_set(dev);
1501 dev->mei_state = MEI_INIT_CLIENTS; 1501 dev->dev_state = MEI_DEV_INIT_CLIENTS;
1502 dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n"); 1502 dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n");
1503 /* link is established 1503 /* link is established
1504 * start sending messages. 1504 * start sending messages.
diff --git a/drivers/misc/mei/iorw.c b/drivers/misc/mei/iorw.c
index 9187d852ef9c..fcba98eb892e 100644
--- a/drivers/misc/mei/iorw.c
+++ b/drivers/misc/mei/iorw.c
@@ -108,7 +108,7 @@ int mei_ioctl_connect_client(struct file *file,
108 108
109 cb->major_file_operations = MEI_IOCTL; 109 cb->major_file_operations = MEI_IOCTL;
110 110
111 if (dev->mei_state != MEI_ENABLED) { 111 if (dev->dev_state != MEI_DEV_ENABLED) {
112 rets = -ENODEV; 112 rets = -ENODEV;
113 goto end; 113 goto end;
114 } 114 }
@@ -402,7 +402,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
402 if (cl->state != MEI_FILE_CONNECTED) 402 if (cl->state != MEI_FILE_CONNECTED)
403 return -ENODEV; 403 return -ENODEV;
404 404
405 if (dev->mei_state != MEI_ENABLED) 405 if (dev->dev_state != MEI_DEV_ENABLED)
406 return -ENODEV; 406 return -ENODEV;
407 407
408 dev_dbg(&dev->pdev->dev, "check if read is pending.\n"); 408 dev_dbg(&dev->pdev->dev, "check if read is pending.\n");
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index dea65c2c9203..5c557dd129d6 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -232,9 +232,9 @@ static int mei_open(struct inode *inode, struct file *file)
232 goto out_unlock; 232 goto out_unlock;
233 233
234 err = -ENODEV; 234 err = -ENODEV;
235 if (dev->mei_state != MEI_ENABLED) { 235 if (dev->dev_state != MEI_DEV_ENABLED) {
236 dev_dbg(&dev->pdev->dev, "mei_state != MEI_ENABLED mei_state= %d\n", 236 dev_dbg(&dev->pdev->dev, "dev_state != MEI_ENABLED dev_state = %s\n",
237 dev->mei_state); 237 mei_dev_state_str(dev->dev_state));
238 goto out_unlock; 238 goto out_unlock;
239 } 239 }
240 err = -EMFILE; 240 err = -EMFILE;
@@ -384,7 +384,7 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
384 dev = cl->dev; 384 dev = cl->dev;
385 385
386 mutex_lock(&dev->device_lock); 386 mutex_lock(&dev->device_lock);
387 if (dev->mei_state != MEI_ENABLED) { 387 if (dev->dev_state != MEI_DEV_ENABLED) {
388 rets = -ENODEV; 388 rets = -ENODEV;
389 goto out; 389 goto out;
390 } 390 }
@@ -538,7 +538,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
538 538
539 mutex_lock(&dev->device_lock); 539 mutex_lock(&dev->device_lock);
540 540
541 if (dev->mei_state != MEI_ENABLED) { 541 if (dev->dev_state != MEI_DEV_ENABLED) {
542 mutex_unlock(&dev->device_lock); 542 mutex_unlock(&dev->device_lock);
543 return -ENODEV; 543 return -ENODEV;
544 } 544 }
@@ -613,7 +613,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
613 rets = -ENOMEM; 613 rets = -ENOMEM;
614 goto unlock_dev; 614 goto unlock_dev;
615 } 615 }
616 if (dev->mei_state != MEI_ENABLED) { 616 if (dev->dev_state != MEI_DEV_ENABLED) {
617 rets = -ENODEV; 617 rets = -ENODEV;
618 goto unlock_dev; 618 goto unlock_dev;
619 } 619 }
@@ -769,7 +769,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
769 dev_dbg(&dev->pdev->dev, "IOCTL cmd = 0x%x", cmd); 769 dev_dbg(&dev->pdev->dev, "IOCTL cmd = 0x%x", cmd);
770 770
771 mutex_lock(&dev->device_lock); 771 mutex_lock(&dev->device_lock);
772 if (dev->mei_state != MEI_ENABLED) { 772 if (dev->dev_state != MEI_DEV_ENABLED) {
773 rets = -ENODEV; 773 rets = -ENODEV;
774 goto out; 774 goto out;
775 } 775 }
@@ -848,7 +848,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait)
848 848
849 mutex_lock(&dev->device_lock); 849 mutex_lock(&dev->device_lock);
850 850
851 if (dev->mei_state != MEI_ENABLED) 851 if (dev->dev_state != MEI_DEV_ENABLED)
852 goto out; 852 goto out;
853 853
854 854
@@ -1118,9 +1118,9 @@ static int mei_pci_suspend(struct device *device)
1118 /* Stop watchdog if exists */ 1118 /* Stop watchdog if exists */
1119 err = mei_wd_stop(dev, true); 1119 err = mei_wd_stop(dev, true);
1120 /* Set new mei state */ 1120 /* Set new mei state */
1121 if (dev->mei_state == MEI_ENABLED || 1121 if (dev->dev_state == MEI_DEV_ENABLED ||
1122 dev->mei_state == MEI_RECOVERING_FROM_RESET) { 1122 dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) {
1123 dev->mei_state = MEI_POWER_DOWN; 1123 dev->dev_state = MEI_DEV_POWER_DOWN;
1124 mei_reset(dev, 0); 1124 mei_reset(dev, 0);
1125 } 1125 }
1126 mutex_unlock(&dev->device_lock); 1126 mutex_unlock(&dev->device_lock);
@@ -1162,7 +1162,7 @@ static int mei_pci_resume(struct device *device)
1162 } 1162 }
1163 1163
1164 mutex_lock(&dev->device_lock); 1164 mutex_lock(&dev->device_lock);
1165 dev->mei_state = MEI_POWER_UP; 1165 dev->dev_state = MEI_DEV_POWER_UP;
1166 mei_reset(dev, 1); 1166 mei_reset(dev, 1);
1167 mutex_unlock(&dev->device_lock); 1167 mutex_unlock(&dev->device_lock);
1168 1168
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 1ff1fc678fb3..35d0538a5974 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -78,17 +78,19 @@ enum file_state {
78}; 78};
79 79
80/* MEI device states */ 80/* MEI device states */
81enum mei_states { 81enum mei_dev_state {
82 MEI_INITIALIZING = 0, 82 MEI_DEV_INITIALIZING = 0,
83 MEI_INIT_CLIENTS, 83 MEI_DEV_INIT_CLIENTS,
84 MEI_ENABLED, 84 MEI_DEV_ENABLED,
85 MEI_RESETING, 85 MEI_DEV_RESETING,
86 MEI_DISABLED, 86 MEI_DEV_DISABLED,
87 MEI_RECOVERING_FROM_RESET, 87 MEI_DEV_RECOVERING_FROM_RESET,
88 MEI_POWER_DOWN, 88 MEI_DEV_POWER_DOWN,
89 MEI_POWER_UP 89 MEI_DEV_POWER_UP
90}; 90};
91 91
92const char *mei_dev_state_str(int state);
93
92/* init clients states*/ 94/* init clients states*/
93enum mei_init_clients_states { 95enum mei_init_clients_states {
94 MEI_START_MESSAGE = 0, 96 MEI_START_MESSAGE = 0,
@@ -218,7 +220,7 @@ struct mei_device {
218 /* 220 /*
219 * mei device states 221 * mei device states
220 */ 222 */
221 enum mei_states mei_state; 223 enum mei_dev_state dev_state;
222 enum mei_init_clients_states init_clients_state; 224 enum mei_init_clients_states init_clients_state;
223 u16 init_clients_timer; 225 u16 init_clients_timer;
224 bool stop; 226 bool stop;
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c
index 912319e4fa90..3006cca34b16 100644
--- a/drivers/misc/mei/wd.c
+++ b/drivers/misc/mei/wd.c
@@ -202,10 +202,10 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev)
202 202
203 mutex_lock(&dev->device_lock); 203 mutex_lock(&dev->device_lock);
204 204
205 if (dev->mei_state != MEI_ENABLED) { 205 if (dev->dev_state != MEI_DEV_ENABLED) {
206 dev_dbg(&dev->pdev->dev, 206 dev_dbg(&dev->pdev->dev,
207 "wd: mei_state != MEI_ENABLED mei_state = %d\n", 207 "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n",
208 dev->mei_state); 208 mei_dev_state_str(dev->dev_state));
209 goto end_unlock; 209 goto end_unlock;
210 } 210 }
211 211