aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/isci/events.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-03-02 11:49:26 -0800
committerDan Williams <dan.j.williams@intel.com>2011-07-03 03:55:28 -0700
commit7c40a8035815479c7c12ab0cdcea71e0f4c3a9c8 (patch)
tree43290f7b96374f0ff8e80ad5e8620f3dc8242f1a /drivers/scsi/isci/events.c
parent150fc6fc725055b400a8865e6785dc8dd0a2225d (diff)
isci: rework timer api
Prepare the timer api for the arrival of dynamic creation and destruction events from the core. It pretended to do this previously but the core to date only used it in a static init-time only fashion. This is an interim fix until a cleaner event queue can be developed. 1/ make all locking external to the api (add WARN_ONCE to verify) 2/ add a timer_destroy interface (to be used by the core) 3/ use del_timer_sync() prior to deallocating timer data 4/ delete the "timer_list" indirection, we only have timers allocated for the isci_host 5/ fix detection of timer list allocation errors Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/events.c')
-rw-r--r--drivers/scsi/isci/events.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/drivers/scsi/isci/events.c b/drivers/scsi/isci/events.c
index 8872f4ca6aa..c5cbaedac04 100644
--- a/drivers/scsi/isci/events.c
+++ b/drivers/scsi/isci/events.c
@@ -75,35 +75,23 @@
* whenever the timer expires.
* @controller: This parameter specifies the controller with which this timer
* is to be associated.
- * @cookie: This parameter specifies a piece of information that the user must
- * retain. This cookie is to be supplied by the user anytime a timeout
- * occurs for the created timer.
+ * @cb_param: opaque callback parameter
*
* This method returns a handle to a timer object created by the user. The
* handle will be utilized for all further interactions relating to this timer.
*/
-void *isci_event_timer_create(
- struct scic_sds_controller *controller,
- void (*timer_callback)(void *),
- void *cookie)
+void *isci_event_timer_create(struct scic_sds_controller *scic,
+ void (*timer_callback)(void *),
+ void *cb_param)
{
- struct isci_host *isci_host;
- struct isci_timer *timer = NULL;
-
- isci_host = (struct isci_host *)sci_object_get_association(controller);
+ struct isci_host *ihost = sci_object_get_association(scic);
+ struct isci_timer *itimer;
- dev_dbg(&isci_host->pdev->dev,
- "%s: isci_host = %p",
- __func__, isci_host);
-
- timer = isci_timer_create(&isci_host->timer_list_struct,
- isci_host,
- cookie,
- timer_callback);
+ itimer = isci_timer_create(ihost, cb_param, timer_callback);
- dev_dbg(&isci_host->pdev->dev, "%s: timer = %p\n", __func__, timer);
+ dev_dbg(&ihost->pdev->dev, "%s: timer = %p\n", __func__, itimer);
- return (void *)timer;
+ return itimer;
}
@@ -146,14 +134,9 @@ void isci_event_timer_start(
* @timer: This parameter specifies the timer to be stopped.
*
*/
-void isci_event_timer_stop(
- struct scic_sds_controller *controller,
- void *timer)
+void isci_event_timer_stop(struct scic_sds_controller *controller, void *timer)
{
- struct isci_host *isci_host;
-
- isci_host =
- (struct isci_host *)sci_object_get_association(controller);
+ struct isci_host *isci_host = sci_object_get_association(controller);
dev_dbg(&isci_host->pdev->dev,
"%s: isci_host = %p, timer = %p\n",
@@ -162,6 +145,16 @@ void isci_event_timer_stop(
isci_timer_stop((struct isci_timer *)timer);
}
+void isci_event_timer_destroy(struct scic_sds_controller *scic, void *timer)
+{
+ struct isci_host *ihost = sci_object_get_association(scic);
+
+ dev_dbg(&ihost->pdev->dev, "%s: ihost = %p, timer = %p\n",
+ __func__, ihost, timer);
+
+ isci_del_timer(ihost, timer);
+}
+
/**
* isci_event_controller_start_complete() - This user callback will inform the
* user that the controller has finished the start process. The associated