]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/mei/init.c
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mv-sheeva.git] / drivers / staging / mei / init.c
index 8bf34794489c51af1a281d2ca3650d9706f8f48f..eab711fb5fc4e65095003726f894cc019341a009 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *
  * Intel Management Engine Interface (Intel MEI) Linux driver
- * Copyright (c) 2003-2011, Intel Corporation.
+ * Copyright (c) 2003-2012, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -38,7 +38,6 @@ void mei_io_list_init(struct mei_io_list *list)
 {
        /* initialize our queue list */
        INIT_LIST_HEAD(&list->mei_cb.cb_list);
-       list->status = 0;
 }
 
 /**
@@ -49,22 +48,15 @@ void mei_io_list_init(struct mei_io_list *list)
  */
 void mei_io_list_flush(struct mei_io_list *list, struct mei_cl *cl)
 {
-       struct mei_cl_cb *cb_pos = NULL;
-       struct mei_cl_cb *cb_next = NULL;
-
-       if (list->status != 0)
-               return;
-
-       if (list_empty(&list->mei_cb.cb_list))
-               return;
+       struct mei_cl_cb *pos;
+       struct mei_cl_cb *next;
 
-       list_for_each_entry_safe(cb_pos, cb_next,
-                                &list->mei_cb.cb_list, cb_list) {
-               if (cb_pos) {
+       list_for_each_entry_safe(pos, next, &list->mei_cb.cb_list, cb_list) {
+               if (pos->file_private) {
                        struct mei_cl *cl_tmp;
-                       cl_tmp = (struct mei_cl *)cb_pos->file_private;
+                       cl_tmp = (struct mei_cl *)pos->file_private;
                        if (mei_cl_cmp_id(cl, cl_tmp))
-                               list_del(&cb_pos->cb_list);
+                               list_del(&pos->cb_list);
                }
        }
 }
@@ -338,16 +330,10 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
                }
        }
        /* remove all waiting requests */
-       if (dev->write_list.status == 0 &&
-               !list_empty(&dev->write_list.mei_cb.cb_list)) {
-               list_for_each_entry_safe(cb_pos, cb_next,
-                               &dev->write_list.mei_cb.cb_list, cb_list) {
-                       if (cb_pos) {
-                               list_del(&cb_pos->cb_list);
-                               mei_free_cb_private(cb_pos);
-                               cb_pos = NULL;
-                       }
-               }
+       list_for_each_entry_safe(cb_pos, cb_next,
+                       &dev->write_list.mei_cb.cb_list, cb_list) {
+               list_del(&cb_pos->cb_list);
+               mei_free_cb_private(cb_pos);
        }
 }
 
@@ -376,12 +362,11 @@ void mei_host_start_message(struct mei_device *dev)
        host_start_req =
            (struct hbm_host_version_request *) &dev->wr_msg_buf[1];
        memset(host_start_req, 0, sizeof(struct hbm_host_version_request));
-       host_start_req->cmd.cmd = HOST_START_REQ_CMD;
+       host_start_req->hbm_cmd = HOST_START_REQ_CMD;
        host_start_req->host_version.major_version = HBM_MAJOR_VERSION;
        host_start_req->host_version.minor_version = HBM_MINOR_VERSION;
        dev->recvd_msg = false;
-       if (!mei_write_message(dev, mei_hdr,
-                                      (unsigned char *) (host_start_req),
+       if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req,
                                       mei_hdr->length)) {
                dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n");
                dev->mei_state = MEI_RESETING;
@@ -413,9 +398,8 @@ void mei_host_enum_clients_message(struct mei_device *dev)
 
        host_enum_req = (struct hbm_host_enum_request *) &dev->wr_msg_buf[1];
        memset(host_enum_req, 0, sizeof(struct hbm_host_enum_request));
-       host_enum_req->cmd.cmd = HOST_ENUM_REQ_CMD;
-       if (!mei_write_message(dev, mei_hdr,
-                              (unsigned char *) (host_enum_req),
+       host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD;
+       if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req,
                                mei_hdr->length)) {
                dev->mei_state = MEI_RESETING;
                dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n");
@@ -423,7 +407,7 @@ void mei_host_enum_clients_message(struct mei_device *dev)
        }
        dev->init_clients_state = MEI_ENUM_CLIENTS_MESSAGE;
        dev->init_clients_timer = INIT_CLIENTS_TIMEOUT;
-       return ;
+       return;
 }
 
 
@@ -498,10 +482,10 @@ int mei_host_client_properties(struct mei_device *dev)
 
                memset(host_cli_req, 0, sizeof(struct hbm_props_request));
 
-               host_cli_req->cmd.cmd = HOST_CLIENT_PROPERTIES_REQ_CMD;
+               host_cli_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD;
                host_cli_req->address = b;
 
-               if (!mei_write_message(dev, mei_header,
+               if (mei_write_message(dev, mei_header,
                                (unsigned char *)host_cli_req,
                                mei_header->length)) {
                        dev->mei_state = MEI_RESETING;
@@ -605,15 +589,10 @@ void mei_host_init_iamthif(struct mei_device *dev)
                return;
        }
 
-       /* Do not render the system unusable when iamthif_mtu is not equal to
-       the value received from ME.
-       Assign iamthif_mtu to the value received from ME in order to solve the
-       hardware macro incompatibility. */
+       /* Assign iamthif_mtu to the value received from ME  */
 
-       dev_dbg(&dev->pdev->dev, "[DEFAULT] IAMTHIF = %d\n", dev->iamthif_mtu);
        dev->iamthif_mtu = dev->me_clients[i].props.max_msg_length;
-       dev_dbg(&dev->pdev->dev,
-                       "IAMTHIF = %d\n",
+       dev_dbg(&dev->pdev->dev, "IAMTHIF_MTU = %d\n",
                        dev->me_clients[i].props.max_msg_length);
 
        kfree(dev->iamthif_msg_buf);
@@ -629,7 +608,7 @@ void mei_host_init_iamthif(struct mei_device *dev)
 
        dev->iamthif_msg_buf = msg_buf;
 
-       if (!mei_connect(dev, &dev->iamthif_cl)) {
+       if (mei_connect(dev, &dev->iamthif_cl)) {
                dev_dbg(&dev->pdev->dev, "Failed to connect to AMTHI client\n");
                dev->iamthif_cl.state = MEI_FILE_DISCONNECTED;
                dev->iamthif_cl.host_client_id = 0;
@@ -691,14 +670,12 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
        if (dev->mei_host_buffer_is_empty) {
                dev->mei_host_buffer_is_empty = false;
                if (mei_disconnect(dev, cl)) {
-                       mdelay(10); /* Wait for hardware disconnection ready */
-                       list_add_tail(&cb->cb_list,
-                               &dev->ctrl_rd_list.mei_cb.cb_list);
-               } else {
                        rets = -ENODEV;
                        dev_dbg(&dev->pdev->dev, "failed to call mei_disconnect.\n");
                        goto free;
                }
+               mdelay(10); /* Wait for hardware disconnection ready */
+               list_add_tail(&cb->cb_list, &dev->ctrl_rd_list.mei_cb.cb_list);
        } else {
                dev_dbg(&dev->pdev->dev, "add disconnect cb to control write list\n");
                list_add_tail(&cb->cb_list,