/* Remove all related references to this device and free
* 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;
list_del(&isci_device->node);
kmem_cache_free(isci_kmem_cache, isci_device);
/* let the core do it's common constuction. */
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. */
if (isci_device->domain_dev->parent &&
"%s: parent->dev_type = EDGE_DEV\n",
__func__);
- status = scic_remote_device_ea_construct(
- isci_device->sci_device_handle,
- (struct smp_response_discover *)&discover_response
- );
+ status = scic_remote_device_ea_construct(to_sci_dev(isci_device),
+ (struct smp_response_discover *)&discover_response);
} else
- status = scic_remote_device_da_construct(
- isci_device->sci_device_handle
- );
+ status = scic_remote_device_da_construct(to_sci_dev(isci_device));
if (status != SCI_SUCCESS) {
return status;
}
- sci_object_set_association(
- isci_device->sci_device_handle,
- isci_device
- );
+ sci_object_set_association(to_sci_dev(isci_device), isci_device);
BUG_ON(port->isci_host == NULL);
/* start the device. */
- status = scic_remote_device_start(
- isci_device->sci_device_handle,
- ISCI_REMOTE_DEVICE_START_TIMEOUT
- );
+ status = scic_remote_device_start(to_sci_dev(isci_device),
+ ISCI_REMOTE_DEVICE_START_TIMEOUT);
if (status != SCI_SUCCESS) {
dev_warn(&port->isci_host->pdev->dev,
isci_remote_device_alloc(struct isci_host *isci_host, struct isci_port *port)
{
struct isci_remote_device *isci_device;
- struct scic_sds_remote_device *sci_dev;
isci_device = kmem_cache_zalloc(isci_kmem_cache, GFP_KERNEL);
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->node);
isci_device->host_quiesce = false;
spin_lock_irqsave(&isci_device->isci_port->isci_host->scic_lock, flags);
- status = scic_remote_device_stop(
- isci_device->sci_device_handle,
- 50
- );
+ status = scic_remote_device_stop(to_sci_dev(isci_device), 50);
spin_unlock_irqrestore(&isci_device->isci_port->isci_host->scic_lock, flags);
struct scic_sds_remote_device;
struct isci_remote_device {
- struct scic_sds_remote_device *sci_device_handle;
enum isci_status status;
struct isci_port *isci_port;
struct domain_device *domain_dev;
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) \
container_of(p, struct isci_remote_device, sci_remote_device);
struct smp_discover_response_protocols dev_protocols;
enum sci_status status = SCI_SUCCESS;
struct sas_task *task = isci_request_access_task(request);
- struct scic_sds_remote_device *sci_device =
- isci_device->sci_device_handle;
+ struct scic_sds_remote_device *sci_device = to_sci_dev(isci_device);
dev_dbg(&isci_host->pdev->dev,
"%s: isci_device = 0x%p; request = %p, "
unsigned long flags;
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. */
ret = isci_request_alloc_io(
/* complete the io request to the core. */
scic_controller_complete_io(
isci_host->core_controller,
- isci_device->sci_device_handle,
+ to_sci_dev(isci_device),
request->sci_request_handle
);
/* NULL the request handle so it cannot be completed or
spin_lock_irqsave(&isci_host->scic_lock, flags);
/* 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);
"%s: isci_tmf = %p\n", __func__, isci_tmf);
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. */
status = isci_request_alloc_tmf(
/* Terminate the TMF transmit request. */
status = scic_controller_terminate_request(
request->isci_host->core_controller,
- request->isci_device->sci_device_handle,
+ to_sci_dev(request->isci_device),
request->sci_request_handle
);
"%s: isci_device = %p\n",
__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. */
tmf->complete = &completion;
was_terminated = true;
status = scic_controller_terminate_request(
isci_host->core_controller,
- isci_device->sci_device_handle,
+ to_sci_dev(isci_device),
isci_request->sci_request_handle
);
}
scic_controller_complete_task(
isci_host->core_controller,
- isci_device->sci_device_handle,
+ to_sci_dev(isci_device),
request->sci_request_handle
);
/* NULL the request handle to make sure it cannot be terminated
if (isci_host != NULL)
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 (isci_host != NULL)
if (isci_host != NULL)
spin_lock_irqsave(&isci_host->scic_lock, flags);
- status
- = scic_remote_device_reset_complete(isci_dev->sci_device_handle);
+ status = scic_remote_device_reset_complete(to_sci_dev(isci_dev));
if (isci_host != NULL)
spin_unlock_irqrestore(&isci_host->scic_lock, flags);