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>
This commit is contained in:
Dan Williams 2011-03-04 11:51:43 -08:00
parent b329aff107
commit 3a97eec6d7
5 changed files with 26 additions and 38 deletions

View File

@ -92,7 +92,7 @@ static void isci_remote_device_deconstruct(
/* Remove all related references to this device and free /* Remove all related references to this device and free
* the cache object. * the cache object.
*/ */
scic_remote_device_destruct(isci_device->sci_device_handle); scic_remote_device_destruct(to_sci_dev(isci_device));
isci_device->domain_dev->lldd_dev = NULL; isci_device->domain_dev->lldd_dev = NULL;
list_del(&isci_device->node); list_del(&isci_device->node);
kmem_cache_free(isci_kmem_cache, isci_device); kmem_cache_free(isci_kmem_cache, isci_device);
@ -117,7 +117,7 @@ static enum sci_status isci_remote_device_construct(
/* let the core do it's common constuction. */ /* let the core do it's common constuction. */
scic_remote_device_construct(port->sci_port_handle, scic_remote_device_construct(port->sci_port_handle,
isci_device->sci_device_handle); to_sci_dev(isci_device));
/* let the core do it's device specific constuction. */ /* let the core do it's device specific constuction. */
if (isci_device->domain_dev->parent && if (isci_device->domain_dev->parent &&
@ -183,15 +183,11 @@ static enum sci_status isci_remote_device_construct(
"%s: parent->dev_type = EDGE_DEV\n", "%s: parent->dev_type = EDGE_DEV\n",
__func__); __func__);
status = scic_remote_device_ea_construct( status = scic_remote_device_ea_construct(to_sci_dev(isci_device),
isci_device->sci_device_handle, (struct smp_response_discover *)&discover_response);
(struct smp_response_discover *)&discover_response
);
} else } else
status = scic_remote_device_da_construct( status = scic_remote_device_da_construct(to_sci_dev(isci_device));
isci_device->sci_device_handle
);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
@ -204,18 +200,13 @@ static enum sci_status isci_remote_device_construct(
return status; return status;
} }
sci_object_set_association( sci_object_set_association(to_sci_dev(isci_device), isci_device);
isci_device->sci_device_handle,
isci_device
);
BUG_ON(port->isci_host == NULL); BUG_ON(port->isci_host == NULL);
/* start the device. */ /* start the device. */
status = scic_remote_device_start( status = scic_remote_device_start(to_sci_dev(isci_device),
isci_device->sci_device_handle, ISCI_REMOTE_DEVICE_START_TIMEOUT);
ISCI_REMOTE_DEVICE_START_TIMEOUT
);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
dev_warn(&port->isci_host->pdev->dev, dev_warn(&port->isci_host->pdev->dev,
@ -266,7 +257,6 @@ static struct isci_remote_device *
isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port) isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port)
{ {
struct isci_remote_device *isci_device; struct isci_remote_device *isci_device;
struct scic_sds_remote_device *sci_dev;
isci_device = kmem_cache_zalloc(isci_kmem_cache, GFP_KERNEL); isci_device = kmem_cache_zalloc(isci_kmem_cache, GFP_KERNEL);
@ -275,8 +265,6 @@ isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port)
return NULL; return NULL;
} }
sci_dev = (struct scic_sds_remote_device *) &isci_device[1];
isci_device->sci_device_handle = sci_dev;
INIT_LIST_HEAD(&isci_device->reqs_in_process); INIT_LIST_HEAD(&isci_device->reqs_in_process);
INIT_LIST_HEAD(&isci_device->node); INIT_LIST_HEAD(&isci_device->node);
isci_device->host_quiesce = false; isci_device->host_quiesce = false;
@ -441,10 +429,7 @@ enum sci_status isci_remote_device_stop(
spin_lock_irqsave(&isci_device->isci_port->isci_host->scic_lock, flags); spin_lock_irqsave(&isci_device->isci_port->isci_host->scic_lock, flags);
status = scic_remote_device_stop( status = scic_remote_device_stop(to_sci_dev(isci_device), 50);
isci_device->sci_device_handle,
50
);
spin_unlock_irqrestore(&isci_device->isci_port->isci_host->scic_lock, flags); spin_unlock_irqrestore(&isci_device->isci_port->isci_host->scic_lock, flags);

View File

@ -60,7 +60,6 @@ struct isci_host;
struct scic_sds_remote_device; struct scic_sds_remote_device;
struct isci_remote_device { struct isci_remote_device {
struct scic_sds_remote_device *sci_device_handle;
enum isci_status status; enum isci_status status;
struct isci_port *isci_port; struct isci_port *isci_port;
struct domain_device *domain_dev; struct domain_device *domain_dev;
@ -73,6 +72,12 @@ struct isci_remote_device {
bool host_quiesce; bool host_quiesce;
}; };
static inline struct scic_sds_remote_device *to_sci_dev(struct isci_remote_device *idev)
{
/* core data is an opaque buffer at the end of the idev */
return (struct scic_sds_remote_device *) &idev[1];
}
#define to_isci_remote_device(p) \ #define to_isci_remote_device(p) \
container_of(p, struct isci_remote_device, sci_remote_device); container_of(p, struct isci_remote_device, sci_remote_device);

View File

@ -179,8 +179,7 @@ static enum sci_status isci_io_request_build(
struct smp_discover_response_protocols dev_protocols; struct smp_discover_response_protocols dev_protocols;
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
struct sas_task *task = isci_request_access_task(request); struct sas_task *task = isci_request_access_task(request);
struct scic_sds_remote_device *sci_device = struct scic_sds_remote_device *sci_device = to_sci_dev(isci_device);
isci_device->sci_device_handle;
dev_dbg(&isci_host->pdev->dev, dev_dbg(&isci_host->pdev->dev,
"%s: isci_device = 0x%p; request = %p, " "%s: isci_device = 0x%p; request = %p, "
@ -408,7 +407,7 @@ int isci_request_execute(
unsigned long flags; unsigned long flags;
isci_device = isci_dev_from_domain_dev(task->dev); isci_device = isci_dev_from_domain_dev(task->dev);
sci_device = isci_device->sci_device_handle; sci_device = to_sci_dev(isci_device);
/* do common allocation and init of request object. */ /* do common allocation and init of request object. */
ret = isci_request_alloc_io( ret = isci_request_alloc_io(
@ -1177,7 +1176,7 @@ void isci_request_io_request_complete(
/* complete the io request to the core. */ /* complete the io request to the core. */
scic_controller_complete_io( scic_controller_complete_io(
isci_host->core_controller, isci_host->core_controller,
isci_device->sci_device_handle, to_sci_dev(isci_device),
request->sci_request_handle request->sci_request_handle
); );
/* NULL the request handle so it cannot be completed or /* NULL the request handle so it cannot be completed or

View File

@ -348,7 +348,7 @@ int isci_task_send_lu_reset_sata(
spin_lock_irqsave(&isci_host->scic_lock, flags); spin_lock_irqsave(&isci_host->scic_lock, flags);
/* Resume the device. */ /* Resume the device. */
scic_sds_remote_device_resume(isci_device->sci_device_handle); scic_sds_remote_device_resume(to_sci_dev(isci_device));
spin_unlock_irqrestore(&isci_host->scic_lock, flags); spin_unlock_irqrestore(&isci_host->scic_lock, flags);

View File

@ -285,7 +285,7 @@ static enum sci_status isci_task_request_build(
"%s: isci_tmf = %p\n", __func__, isci_tmf); "%s: isci_tmf = %p\n", __func__, isci_tmf);
isci_device = isci_tmf->device; isci_device = isci_tmf->device;
sci_device = isci_device->sci_device_handle; sci_device = to_sci_dev(isci_device);
/* do common allocation and init of request object. */ /* do common allocation and init of request object. */
status = isci_request_alloc_tmf( status = isci_request_alloc_tmf(
@ -395,7 +395,7 @@ static void isci_tmf_timeout_cb(void *tmf_request_arg)
/* Terminate the TMF transmit request. */ /* Terminate the TMF transmit request. */
status = scic_controller_terminate_request( status = scic_controller_terminate_request(
request->isci_host->core_controller, request->isci_host->core_controller,
request->isci_device->sci_device_handle, to_sci_dev(request->isci_device),
request->sci_request_handle request->sci_request_handle
); );
@ -456,7 +456,7 @@ int isci_task_execute_tmf(
"%s: isci_device = %p\n", "%s: isci_device = %p\n",
__func__, isci_device); __func__, isci_device);
sci_device = isci_device->sci_device_handle; sci_device = to_sci_dev(isci_device);
/* Assign the pointer to the TMF's completion kernel wait structure. */ /* Assign the pointer to the TMF's completion kernel wait structure. */
tmf->complete = &completion; tmf->complete = &completion;
@ -728,7 +728,7 @@ static void isci_terminate_request_core(
was_terminated = true; was_terminated = true;
status = scic_controller_terminate_request( status = scic_controller_terminate_request(
isci_host->core_controller, isci_host->core_controller,
isci_device->sci_device_handle, to_sci_dev(isci_device),
isci_request->sci_request_handle isci_request->sci_request_handle
); );
} }
@ -1469,7 +1469,7 @@ void isci_task_request_complete(
scic_controller_complete_task( scic_controller_complete_task(
isci_host->core_controller, isci_host->core_controller,
isci_device->sci_device_handle, to_sci_dev(isci_device),
request->sci_request_handle request->sci_request_handle
); );
/* NULL the request handle to make sure it cannot be terminated /* NULL the request handle to make sure it cannot be terminated
@ -1612,7 +1612,7 @@ int isci_bus_reset_handler(struct scsi_cmnd *cmd)
if (isci_host != NULL) if (isci_host != NULL)
spin_lock_irqsave(&isci_host->scic_lock, flags); spin_lock_irqsave(&isci_host->scic_lock, flags);
status = scic_remote_device_reset(isci_dev->sci_device_handle); status = scic_remote_device_reset(to_sci_dev(isci_dev));
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
if (isci_host != NULL) if (isci_host != NULL)
@ -1654,8 +1654,7 @@ int isci_bus_reset_handler(struct scsi_cmnd *cmd)
if (isci_host != NULL) if (isci_host != NULL)
spin_lock_irqsave(&isci_host->scic_lock, flags); spin_lock_irqsave(&isci_host->scic_lock, flags);
status status = scic_remote_device_reset_complete(to_sci_dev(isci_dev));
= scic_remote_device_reset_complete(isci_dev->sci_device_handle);
if (isci_host != NULL) if (isci_host != NULL)
spin_unlock_irqrestore(&isci_host->scic_lock, flags); spin_unlock_irqrestore(&isci_host->scic_lock, flags);