aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi/ibmvscsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvscsi.c')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 12cb743d0ce5..944fc1203ebd 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -738,7 +738,8 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
738{ 738{
739 struct viosrp_adapter_info *req; 739 struct viosrp_adapter_info *req;
740 struct srp_event_struct *evt_struct; 740 struct srp_event_struct *evt_struct;
741 741 dma_addr_t addr;
742
742 evt_struct = get_event_struct(&hostdata->pool); 743 evt_struct = get_event_struct(&hostdata->pool);
743 if (!evt_struct) { 744 if (!evt_struct) {
744 printk(KERN_ERR "ibmvscsi: couldn't allocate an event " 745 printk(KERN_ERR "ibmvscsi: couldn't allocate an event "
@@ -756,10 +757,10 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
756 757
757 req->common.type = VIOSRP_ADAPTER_INFO_TYPE; 758 req->common.type = VIOSRP_ADAPTER_INFO_TYPE;
758 req->common.length = sizeof(hostdata->madapter_info); 759 req->common.length = sizeof(hostdata->madapter_info);
759 req->buffer = dma_map_single(hostdata->dev, 760 req->buffer = addr = dma_map_single(hostdata->dev,
760 &hostdata->madapter_info, 761 &hostdata->madapter_info,
761 sizeof(hostdata->madapter_info), 762 sizeof(hostdata->madapter_info),
762 DMA_BIDIRECTIONAL); 763 DMA_BIDIRECTIONAL);
763 764
764 if (dma_mapping_error(req->buffer)) { 765 if (dma_mapping_error(req->buffer)) {
765 printk(KERN_ERR 766 printk(KERN_ERR
@@ -769,8 +770,13 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
769 return; 770 return;
770 } 771 }
771 772
772 if (ibmvscsi_send_srp_event(evt_struct, hostdata)) 773 if (ibmvscsi_send_srp_event(evt_struct, hostdata)) {
773 printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n"); 774 printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n");
775 dma_unmap_single(hostdata->dev,
776 addr,
777 sizeof(hostdata->madapter_info),
778 DMA_BIDIRECTIONAL);
779 }
774}; 780};
775 781
776/** 782/**
@@ -1258,6 +1264,7 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1258{ 1264{
1259 struct viosrp_host_config *host_config; 1265 struct viosrp_host_config *host_config;
1260 struct srp_event_struct *evt_struct; 1266 struct srp_event_struct *evt_struct;
1267 dma_addr_t addr;
1261 int rc; 1268 int rc;
1262 1269
1263 evt_struct = get_event_struct(&hostdata->pool); 1270 evt_struct = get_event_struct(&hostdata->pool);
@@ -1278,8 +1285,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1278 memset(host_config, 0x00, sizeof(*host_config)); 1285 memset(host_config, 0x00, sizeof(*host_config));
1279 host_config->common.type = VIOSRP_HOST_CONFIG_TYPE; 1286 host_config->common.type = VIOSRP_HOST_CONFIG_TYPE;
1280 host_config->common.length = length; 1287 host_config->common.length = length;
1281 host_config->buffer = dma_map_single(hostdata->dev, buffer, length, 1288 host_config->buffer = addr = dma_map_single(hostdata->dev, buffer,
1282 DMA_BIDIRECTIONAL); 1289 length,
1290 DMA_BIDIRECTIONAL);
1283 1291
1284 if (dma_mapping_error(host_config->buffer)) { 1292 if (dma_mapping_error(host_config->buffer)) {
1285 printk(KERN_ERR 1293 printk(KERN_ERR
@@ -1290,11 +1298,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1290 1298
1291 init_completion(&evt_struct->comp); 1299 init_completion(&evt_struct->comp);
1292 rc = ibmvscsi_send_srp_event(evt_struct, hostdata); 1300 rc = ibmvscsi_send_srp_event(evt_struct, hostdata);
1293 if (rc == 0) { 1301 if (rc == 0)
1294 wait_for_completion(&evt_struct->comp); 1302 wait_for_completion(&evt_struct->comp);
1295 dma_unmap_single(hostdata->dev, host_config->buffer, 1303 dma_unmap_single(hostdata->dev, addr, length, DMA_BIDIRECTIONAL);
1296 length, DMA_BIDIRECTIONAL);
1297 }
1298 1304
1299 return rc; 1305 return rc;
1300} 1306}