diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-03-04 14:51:43 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 06:55:29 -0400 |
commit | 3a97eec6d7876c541950e23811efd40e0bcd04a0 (patch) | |
tree | 543e52abd6d41df724374fbdd6fe852ac611ca50 /drivers | |
parent | b329aff107543c3c4db26c1572405034c3baf906 (diff) |
isci: remove sci_device_handle
It belies the fact that isci_remote_device and scic_sds_remote_device
are one in same object with the same lifetime rules.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 33 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.h | 7 | ||||
-rw-r--r-- | drivers/scsi/isci/request.c | 7 | ||||
-rw-r--r-- | drivers/scsi/isci/sata.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/task.c | 15 |
5 files changed, 26 insertions, 38 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index e684a053189e..0eb5c7330fac 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -92,7 +92,7 @@ static void isci_remote_device_deconstruct( | |||
92 | /* Remove all related references to this device and free | 92 | /* Remove all related references to this device and free |
93 | * the cache object. | 93 | * the cache object. |
94 | */ | 94 | */ |
95 | scic_remote_device_destruct(isci_device->sci_device_handle); | 95 | scic_remote_device_destruct(to_sci_dev(isci_device)); |
96 | isci_device->domain_dev->lldd_dev = NULL; | 96 | isci_device->domain_dev->lldd_dev = NULL; |
97 | list_del(&isci_device->node); | 97 | list_del(&isci_device->node); |
98 | kmem_cache_free(isci_kmem_cache, isci_device); | 98 | kmem_cache_free(isci_kmem_cache, isci_device); |
@@ -117,7 +117,7 @@ static enum sci_status isci_remote_device_construct( | |||
117 | 117 | ||
118 | /* let the core do it's common constuction. */ | 118 | /* let the core do it's common constuction. */ |
119 | scic_remote_device_construct(port->sci_port_handle, | 119 | scic_remote_device_construct(port->sci_port_handle, |
120 | isci_device->sci_device_handle); | 120 | to_sci_dev(isci_device)); |
121 | 121 | ||
122 | /* let the core do it's device specific constuction. */ | 122 | /* let the core do it's device specific constuction. */ |
123 | if (isci_device->domain_dev->parent && | 123 | if (isci_device->domain_dev->parent && |
@@ -183,15 +183,11 @@ static enum sci_status isci_remote_device_construct( | |||
183 | "%s: parent->dev_type = EDGE_DEV\n", | 183 | "%s: parent->dev_type = EDGE_DEV\n", |
184 | __func__); | 184 | __func__); |
185 | 185 | ||
186 | status = scic_remote_device_ea_construct( | 186 | status = scic_remote_device_ea_construct(to_sci_dev(isci_device), |
187 | isci_device->sci_device_handle, | 187 | (struct smp_response_discover *)&discover_response); |
188 | (struct smp_response_discover *)&discover_response | ||
189 | ); | ||
190 | 188 | ||
191 | } else | 189 | } else |
192 | status = scic_remote_device_da_construct( | 190 | status = scic_remote_device_da_construct(to_sci_dev(isci_device)); |
193 | isci_device->sci_device_handle | ||
194 | ); | ||
195 | 191 | ||
196 | 192 | ||
197 | if (status != SCI_SUCCESS) { | 193 | if (status != SCI_SUCCESS) { |
@@ -204,18 +200,13 @@ static enum sci_status isci_remote_device_construct( | |||
204 | return status; | 200 | return status; |
205 | } | 201 | } |
206 | 202 | ||
207 | sci_object_set_association( | 203 | sci_object_set_association(to_sci_dev(isci_device), isci_device); |
208 | isci_device->sci_device_handle, | ||
209 | isci_device | ||
210 | ); | ||
211 | 204 | ||
212 | BUG_ON(port->isci_host == NULL); | 205 | BUG_ON(port->isci_host == NULL); |
213 | 206 | ||
214 | /* start the device. */ | 207 | /* start the device. */ |
215 | status = scic_remote_device_start( | 208 | status = scic_remote_device_start(to_sci_dev(isci_device), |
216 | isci_device->sci_device_handle, | 209 | ISCI_REMOTE_DEVICE_START_TIMEOUT); |
217 | ISCI_REMOTE_DEVICE_START_TIMEOUT | ||
218 | ); | ||
219 | 210 | ||
220 | if (status != SCI_SUCCESS) { | 211 | if (status != SCI_SUCCESS) { |
221 | dev_warn(&port->isci_host->pdev->dev, | 212 | dev_warn(&port->isci_host->pdev->dev, |
@@ -266,7 +257,6 @@ static struct isci_remote_device * | |||
266 | isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port) | 257 | isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port) |
267 | { | 258 | { |
268 | struct isci_remote_device *isci_device; | 259 | struct isci_remote_device *isci_device; |
269 | struct scic_sds_remote_device *sci_dev; | ||
270 | 260 | ||
271 | isci_device = kmem_cache_zalloc(isci_kmem_cache, GFP_KERNEL); | 261 | isci_device = kmem_cache_zalloc(isci_kmem_cache, GFP_KERNEL); |
272 | 262 | ||
@@ -275,8 +265,6 @@ isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port) | |||
275 | return NULL; | 265 | return NULL; |
276 | } | 266 | } |
277 | 267 | ||
278 | sci_dev = (struct scic_sds_remote_device *) &isci_device[1]; | ||
279 | isci_device->sci_device_handle = sci_dev; | ||
280 | INIT_LIST_HEAD(&isci_device->reqs_in_process); | 268 | INIT_LIST_HEAD(&isci_device->reqs_in_process); |
281 | INIT_LIST_HEAD(&isci_device->node); | 269 | INIT_LIST_HEAD(&isci_device->node); |
282 | isci_device->host_quiesce = false; | 270 | isci_device->host_quiesce = false; |
@@ -441,10 +429,7 @@ enum sci_status isci_remote_device_stop( | |||
441 | 429 | ||
442 | spin_lock_irqsave(&isci_device->isci_port->isci_host->scic_lock, flags); | 430 | spin_lock_irqsave(&isci_device->isci_port->isci_host->scic_lock, flags); |
443 | 431 | ||
444 | status = scic_remote_device_stop( | 432 | status = scic_remote_device_stop(to_sci_dev(isci_device), 50); |
445 | isci_device->sci_device_handle, | ||
446 | 50 | ||
447 | ); | ||
448 | 433 | ||
449 | spin_unlock_irqrestore(&isci_device->isci_port->isci_host->scic_lock, flags); | 434 | spin_unlock_irqrestore(&isci_device->isci_port->isci_host->scic_lock, flags); |
450 | 435 | ||
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h index 48e37cfef6fb..cd43c15f009d 100644 --- a/drivers/scsi/isci/remote_device.h +++ b/drivers/scsi/isci/remote_device.h | |||
@@ -60,7 +60,6 @@ struct isci_host; | |||
60 | struct scic_sds_remote_device; | 60 | struct scic_sds_remote_device; |
61 | 61 | ||
62 | struct isci_remote_device { | 62 | struct isci_remote_device { |
63 | struct scic_sds_remote_device *sci_device_handle; | ||
64 | enum isci_status status; | 63 | enum isci_status status; |
65 | struct isci_port *isci_port; | 64 | struct isci_port *isci_port; |
66 | struct domain_device *domain_dev; | 65 | struct domain_device *domain_dev; |
@@ -73,6 +72,12 @@ struct isci_remote_device { | |||
73 | bool host_quiesce; | 72 | bool host_quiesce; |
74 | }; | 73 | }; |
75 | 74 | ||
75 | static inline struct scic_sds_remote_device *to_sci_dev(struct isci_remote_device *idev) | ||
76 | { | ||
77 | /* core data is an opaque buffer at the end of the idev */ | ||
78 | return (struct scic_sds_remote_device *) &idev[1]; | ||
79 | } | ||
80 | |||
76 | #define to_isci_remote_device(p) \ | 81 | #define to_isci_remote_device(p) \ |
77 | container_of(p, struct isci_remote_device, sci_remote_device); | 82 | container_of(p, struct isci_remote_device, sci_remote_device); |
78 | 83 | ||
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 81a77335fdb3..6b0863e73f22 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -179,8 +179,7 @@ static enum sci_status isci_io_request_build( | |||
179 | struct smp_discover_response_protocols dev_protocols; | 179 | struct smp_discover_response_protocols dev_protocols; |
180 | enum sci_status status = SCI_SUCCESS; | 180 | enum sci_status status = SCI_SUCCESS; |
181 | struct sas_task *task = isci_request_access_task(request); | 181 | struct sas_task *task = isci_request_access_task(request); |
182 | struct scic_sds_remote_device *sci_device = | 182 | struct scic_sds_remote_device *sci_device = to_sci_dev(isci_device); |
183 | isci_device->sci_device_handle; | ||
184 | 183 | ||
185 | dev_dbg(&isci_host->pdev->dev, | 184 | dev_dbg(&isci_host->pdev->dev, |
186 | "%s: isci_device = 0x%p; request = %p, " | 185 | "%s: isci_device = 0x%p; request = %p, " |
@@ -408,7 +407,7 @@ int isci_request_execute( | |||
408 | unsigned long flags; | 407 | unsigned long flags; |
409 | 408 | ||
410 | isci_device = isci_dev_from_domain_dev(task->dev); | 409 | isci_device = isci_dev_from_domain_dev(task->dev); |
411 | sci_device = isci_device->sci_device_handle; | 410 | sci_device = to_sci_dev(isci_device); |
412 | 411 | ||
413 | /* do common allocation and init of request object. */ | 412 | /* do common allocation and init of request object. */ |
414 | ret = isci_request_alloc_io( | 413 | ret = isci_request_alloc_io( |
@@ -1177,7 +1176,7 @@ void isci_request_io_request_complete( | |||
1177 | /* complete the io request to the core. */ | 1176 | /* complete the io request to the core. */ |
1178 | scic_controller_complete_io( | 1177 | scic_controller_complete_io( |
1179 | isci_host->core_controller, | 1178 | isci_host->core_controller, |
1180 | isci_device->sci_device_handle, | 1179 | to_sci_dev(isci_device), |
1181 | request->sci_request_handle | 1180 | request->sci_request_handle |
1182 | ); | 1181 | ); |
1183 | /* NULL the request handle so it cannot be completed or | 1182 | /* NULL the request handle so it cannot be completed or |
diff --git a/drivers/scsi/isci/sata.c b/drivers/scsi/isci/sata.c index 6fbf15944b21..7a1b58600ca0 100644 --- a/drivers/scsi/isci/sata.c +++ b/drivers/scsi/isci/sata.c | |||
@@ -348,7 +348,7 @@ int isci_task_send_lu_reset_sata( | |||
348 | spin_lock_irqsave(&isci_host->scic_lock, flags); | 348 | spin_lock_irqsave(&isci_host->scic_lock, flags); |
349 | 349 | ||
350 | /* Resume the device. */ | 350 | /* Resume the device. */ |
351 | scic_sds_remote_device_resume(isci_device->sci_device_handle); | 351 | scic_sds_remote_device_resume(to_sci_dev(isci_device)); |
352 | 352 | ||
353 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); | 353 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); |
354 | 354 | ||
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 232125eab523..c637bbc215c6 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -285,7 +285,7 @@ static enum sci_status isci_task_request_build( | |||
285 | "%s: isci_tmf = %p\n", __func__, isci_tmf); | 285 | "%s: isci_tmf = %p\n", __func__, isci_tmf); |
286 | 286 | ||
287 | isci_device = isci_tmf->device; | 287 | isci_device = isci_tmf->device; |
288 | sci_device = isci_device->sci_device_handle; | 288 | sci_device = to_sci_dev(isci_device); |
289 | 289 | ||
290 | /* do common allocation and init of request object. */ | 290 | /* do common allocation and init of request object. */ |
291 | status = isci_request_alloc_tmf( | 291 | status = isci_request_alloc_tmf( |
@@ -395,7 +395,7 @@ static void isci_tmf_timeout_cb(void *tmf_request_arg) | |||
395 | /* Terminate the TMF transmit request. */ | 395 | /* Terminate the TMF transmit request. */ |
396 | status = scic_controller_terminate_request( | 396 | status = scic_controller_terminate_request( |
397 | request->isci_host->core_controller, | 397 | request->isci_host->core_controller, |
398 | request->isci_device->sci_device_handle, | 398 | to_sci_dev(request->isci_device), |
399 | request->sci_request_handle | 399 | request->sci_request_handle |
400 | ); | 400 | ); |
401 | 401 | ||
@@ -456,7 +456,7 @@ int isci_task_execute_tmf( | |||
456 | "%s: isci_device = %p\n", | 456 | "%s: isci_device = %p\n", |
457 | __func__, isci_device); | 457 | __func__, isci_device); |
458 | 458 | ||
459 | sci_device = isci_device->sci_device_handle; | 459 | sci_device = to_sci_dev(isci_device); |
460 | 460 | ||
461 | /* Assign the pointer to the TMF's completion kernel wait structure. */ | 461 | /* Assign the pointer to the TMF's completion kernel wait structure. */ |
462 | tmf->complete = &completion; | 462 | tmf->complete = &completion; |
@@ -728,7 +728,7 @@ static void isci_terminate_request_core( | |||
728 | was_terminated = true; | 728 | was_terminated = true; |
729 | status = scic_controller_terminate_request( | 729 | status = scic_controller_terminate_request( |
730 | isci_host->core_controller, | 730 | isci_host->core_controller, |
731 | isci_device->sci_device_handle, | 731 | to_sci_dev(isci_device), |
732 | isci_request->sci_request_handle | 732 | isci_request->sci_request_handle |
733 | ); | 733 | ); |
734 | } | 734 | } |
@@ -1469,7 +1469,7 @@ void isci_task_request_complete( | |||
1469 | 1469 | ||
1470 | scic_controller_complete_task( | 1470 | scic_controller_complete_task( |
1471 | isci_host->core_controller, | 1471 | isci_host->core_controller, |
1472 | isci_device->sci_device_handle, | 1472 | to_sci_dev(isci_device), |
1473 | request->sci_request_handle | 1473 | request->sci_request_handle |
1474 | ); | 1474 | ); |
1475 | /* NULL the request handle to make sure it cannot be terminated | 1475 | /* NULL the request handle to make sure it cannot be terminated |
@@ -1612,7 +1612,7 @@ int isci_bus_reset_handler(struct scsi_cmnd *cmd) | |||
1612 | if (isci_host != NULL) | 1612 | if (isci_host != NULL) |
1613 | spin_lock_irqsave(&isci_host->scic_lock, flags); | 1613 | spin_lock_irqsave(&isci_host->scic_lock, flags); |
1614 | 1614 | ||
1615 | status = scic_remote_device_reset(isci_dev->sci_device_handle); | 1615 | status = scic_remote_device_reset(to_sci_dev(isci_dev)); |
1616 | if (status != SCI_SUCCESS) { | 1616 | if (status != SCI_SUCCESS) { |
1617 | 1617 | ||
1618 | if (isci_host != NULL) | 1618 | if (isci_host != NULL) |
@@ -1654,8 +1654,7 @@ int isci_bus_reset_handler(struct scsi_cmnd *cmd) | |||
1654 | 1654 | ||
1655 | if (isci_host != NULL) | 1655 | if (isci_host != NULL) |
1656 | spin_lock_irqsave(&isci_host->scic_lock, flags); | 1656 | spin_lock_irqsave(&isci_host->scic_lock, flags); |
1657 | status | 1657 | status = scic_remote_device_reset_complete(to_sci_dev(isci_dev)); |
1658 | = scic_remote_device_reset_complete(isci_dev->sci_device_handle); | ||
1659 | 1658 | ||
1660 | if (isci_host != NULL) | 1659 | if (isci_host != NULL) |
1661 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); | 1660 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); |