Staging: heci: fix typos and add wait after disconnect
authorDongxiao Xu <dongxiao.xu@intel.com>
Sun, 31 May 2009 06:43:51 +0000 (14:43 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 19 Jun 2009 18:00:55 +0000 (11:00 -0700)
- Fix typo for enum HECI_WRITE.
 - Fix timeout issue. If the time period is greater or equal 15s, it's timeout.
 - Add 10ms wait time after disconnect, to ensure that hardware is ready.
   Otherwise in the next time connection, hardware resource may be busy.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/heci/heci_init.c
drivers/staging/heci/heci_main.c
drivers/staging/heci/interrupt.c

index a8a0da9..06ea196 100644 (file)
@@ -1012,6 +1012,7 @@ int heci_disconnect_host_client(struct iamt_heci_device *dev,
        if (dev->host_buffer_is_empty) {
                dev->host_buffer_is_empty = 0;
                if (heci_disconnect(dev, file_ext)) {
+                       mdelay(10); /* Wait for hardware disconnection ready */
                        list_add_tail(&priv_cb->cb_list,
                                &dev->ctrl_rd_list.heci_cb.cb_list);
                } else {
index 4b02641..1197803 100644 (file)
@@ -1088,7 +1088,7 @@ static ssize_t heci_write(struct file *file, const char __user *ubuf,
        if (file_ext == &dev->iamthif_file_ext) {
                priv_write_cb = find_pthi_read_list_entry(dev, file);
                if ((priv_write_cb != NULL) &&
-                    (((currtime - priv_write_cb->read_time) >
+                    (((currtime - priv_write_cb->read_time) >=
                            IAMTHIF_READ_TIMER) ||
                      (file_ext->reading_state == HECI_READ_COMPLETE))) {
                        (*offset) = 0;
index 2db1851..b7ce73b 100644 (file)
@@ -1054,7 +1054,7 @@ static int heci_bh_write_handler(struct io_heci_list *cmpl_list,
                                list_del(&priv_cb_pos->cb_list);
                                if ((HECI_WRITING == file_ext->writing_state) &&
                                        (priv_cb_pos->major_file_operations ==
-                                               HECI_WRITING) &&
+                                               HECI_WRITE) &&
                                        (file_ext != &dev->iamthif_file_ext)) {
                                        DBG("HECI WRITE COMPLETE\n");
                                        file_ext->writing_state =