mei: remove write only need_reset member of struct mei_device
[deliverable/linux.git] / drivers / misc / mei / init.c
index 6c1f1f838d2b31f46c866458e1b4e3be2072437f..2391832bfa6f97fc1d7b6d75a9658364fc13f109 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/mei.h>
 
 #include "mei_dev.h"
-#include "interface.h"
+#include "client.h"
 
 const char *mei_dev_state_str(int state)
 {
@@ -68,7 +68,6 @@ struct mei_device *mei_device_init(struct pci_dev *pdev)
        init_waitqueue_head(&dev->wait_recvd_msg);
        init_waitqueue_head(&dev->wait_stop_wd);
        dev->dev_state = MEI_DEV_INITIALIZING;
-       dev->iamthif_state = MEI_IAMTHIF_IDLE;
 
        mei_io_list_init(&dev->read_list);
        mei_io_list_init(&dev->write_list);
@@ -200,10 +199,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
        struct mei_cl_cb *cb_next = NULL;
        bool unexpected;
 
-       if (dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) {
-               dev->need_reset = true;
+       if (dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET)
                return;
-       }
 
        unexpected = (dev->dev_state != MEI_DEV_INITIALIZING &&
                        dev->dev_state != MEI_DEV_DISABLED &&
@@ -225,8 +222,6 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
        dev_dbg(&dev->pdev->dev, "currently saved host_hw_state = 0x%08x.\n",
            dev->host_hw_state);
 
-       dev->need_reset = false;
-
        if (dev->dev_state != MEI_DEV_INITIALIZING) {
                if (dev->dev_state != MEI_DEV_DISABLED &&
                    dev->dev_state != MEI_DEV_POWER_DOWN)
@@ -241,9 +236,12 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
                }
                /* remove entry if already in list */
                dev_dbg(&dev->pdev->dev, "remove iamthif and wd from the file list.\n");
-               mei_me_cl_unlink(dev, &dev->wd_cl);
-
-               mei_me_cl_unlink(dev, &dev->iamthif_cl);
+               mei_cl_unlink(&dev->wd_cl);
+               if (dev->open_handle_count > 0)
+                       dev->open_handle_count--;
+               mei_cl_unlink(&dev->iamthif_cl);
+               if (dev->open_handle_count > 0)
+                       dev->open_handle_count--;
 
                mei_amthif_reset_params(dev);
                memset(&dev->wr_ext_msg, 0, sizeof(dev->wr_ext_msg));
@@ -279,44 +277,5 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
 }
 
 
-/**
- * allocate_me_clients_storage - allocates storage for me clients
- *
- * @dev: the device structure
- *
- * returns none.
- */
-void mei_allocate_me_clients_storage(struct mei_device *dev)
-{
-       struct mei_me_client *clients;
-       int b;
-
-       /* count how many ME clients we have */
-       for_each_set_bit(b, dev->me_clients_map, MEI_CLIENTS_MAX)
-               dev->me_clients_num++;
-
-       if (dev->me_clients_num <= 0)
-               return ;
-
-
-       if (dev->me_clients != NULL) {
-               kfree(dev->me_clients);
-               dev->me_clients = NULL;
-       }
-       dev_dbg(&dev->pdev->dev, "memory allocation for ME clients size=%zd.\n",
-               dev->me_clients_num * sizeof(struct mei_me_client));
-       /* allocate storage for ME clients representation */
-       clients = kcalloc(dev->me_clients_num,
-                       sizeof(struct mei_me_client), GFP_KERNEL);
-       if (!clients) {
-               dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n");
-               dev->dev_state = MEI_DEV_RESETING;
-               mei_reset(dev, 1);
-               return ;
-       }
-       dev->me_clients = clients;
-       return ;
-}
-
 
 
This page took 0.025646 seconds and 5 git commands to generate.