#define VLDC_DEBUG_MSG 2 /* Prints all request/response buffers */
#define VLDC_DEBUG_STATES 4 /* Verbose look at state changes */
#define VLDC_RESET_RETRY_STIME (15 * HZ) /* 15 seconds retry time */
-#define VLDC_RESET_RETRY_LTIME (60 * HZ) /* 30 seconds retry time */
+#define VLDC_RESET_RETRY_LTIME (60 * HZ) /* 60 seconds retry time */
#define VLDC_RESET_RETRY_SCOUNT 25
#define INVALID_IPMI_DEV -1
v->state = VLDC_STATE_IDLE;
v->vldc_handle = INVALID_IPMI_DEV;
- vldc_reset_wq = alloc_workqueue("ipmi-vldc-reset-wq", WQ_UNBOUND, 1);
- if (vldc_reset_wq == NULL) {
- pr_err("%s: Reset workqueue creation failed\n", __func__);
- return -ENOMEM;
- }
- INIT_WORK(&(v->reset_work), vldc_reset_work);
- init_waitqueue_head(&v->cleanup_waitq);
return 0;
}
static void vldc_cleanup(struct si_sm_data *v)
{
+ if (!v)
+ return;
+
+ v->state = VLDC_STATE_CLEANUP;
if (vldc_reset_wq) {
- v->state = VLDC_STATE_CLEANUP;
wake_up(&v->cleanup_waitq);
flush_workqueue(vldc_reset_wq);
destroy_workqueue(vldc_reset_wq);
+ vldc_reset_wq = NULL;
}
vldc_close(v->vldc_handle);
v->vldc_handle = INVALID_IPMI_DEV;
int dev_handle;
if (v->vldc_handle >= 0) {
- pr_warn("%s: Whaaa, vldc_flip already set = %d\n",
+ pr_warn("%s: vldc_handle already present = %d\n",
__func__, v->vldc_handle);
+ vldc_close(v->vldc_handle);
+ v->vldc_handle = INVALID_IPMI_DEV;
}
dev_handle = vldc_open(VLDC_IPMI_DEV, VLDC_MODE_STREAM);
v->vldc_handle = dev_handle;
pr_info("%s: Successfully opened %s\n", __func__, VLDC_IPMI_DEV);
+
+ if (vldc_reset_wq)
+ return 0;
+ vldc_reset_wq = alloc_workqueue("ipmi-vldc-reset-wq", WQ_UNBOUND, 1);
+ if (vldc_reset_wq == NULL) {
+ pr_err("%s: Reset workqueue creation failed\n", __func__);
+ return -ENOMEM;
+ }
+ INIT_WORK(&(v->reset_work), vldc_reset_work);
+ init_waitqueue_head(&v->cleanup_waitq);
+
return 0;
}
return;
}
- /* Try in each 10 seconds for reconnection for 25 times.
+ /* Try in each 15 seconds for reconnection for 25 times.
* If it is unsuccessful, then there is a good chance that something is
* horribly wrong with the ILOM. Increase the timeout to 1 minute
* afterwards.