From: Viswas G <Viswas.G@xxxxxxxxxxxxx> Removed the common length and introduce read and write length for IOCTL payload structure. Signed-off-by: Deepak Ukey <deepak.ukey@xxxxxxxxxxxxx> Signed-off-by: Viswas G <Viswas.G@xxxxxxxxxxxxx> Signed-off-by: Radha Ramachandran <radha@xxxxxxxxxx> Acked-by: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx> --- drivers/scsi/pm8001/pm8001_ctl.c | 6 +++--- drivers/scsi/pm8001/pm8001_hwi.c | 22 +++++++++++----------- drivers/scsi/pm8001/pm8001_init.c | 12 ++++++------ drivers/scsi/pm8001/pm8001_sas.h | 3 ++- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 23b8bf27e201..3c9f42779dd0 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c @@ -463,7 +463,7 @@ static ssize_t pm8001_ctl_bios_version_show(struct device *cdev, pm8001_ha->nvmd_completion = &completion; payload.minor_function = 7; payload.offset = 0; - payload.length = 4096; + payload.rd_length = 4096; payload.func_specific = kzalloc(4096, GFP_KERNEL); if (!payload.func_specific) return -ENOMEM; @@ -674,7 +674,7 @@ static int pm8001_set_nvmd(struct pm8001_hba_info *pm8001_ha) payload = (struct pm8001_ioctl_payload *)ioctlbuffer; memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data, pm8001_ha->fw_image->size); - payload->length = pm8001_ha->fw_image->size; + payload->wr_length = pm8001_ha->fw_image->size; payload->id = 0; payload->minor_function = 0x1; pm8001_ha->nvmd_completion = &completion; @@ -720,7 +720,7 @@ static int pm8001_update_flash(struct pm8001_hba_info *pm8001_ha) IOCTL_BUF_SIZE); for (loopNumber = 0; loopNumber < loopcount; loopNumber++) { payload = (struct pm8001_ioctl_payload *)ioctlbuffer; - payload->length = 1024*16; + payload->wr_length = 1024*16; payload->id = 0; fwControl = (struct fw_control_info *)&payload->func_specific; diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 2328ff1349ac..fb9848e1d481 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -4793,7 +4793,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, if (!fw_control_context) return -ENOMEM; fw_control_context->usrAddr = (u8 *)ioctl_payload->func_specific; - fw_control_context->len = ioctl_payload->length; + fw_control_context->len = ioctl_payload->rd_length; circularQ = &pm8001_ha->inbnd_q_tbl[0]; memset(&nvmd_req, 0, sizeof(nvmd_req)); rc = pm8001_tag_alloc(pm8001_ha, &tag); @@ -4814,7 +4814,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | twi_addr << 16 | twi_page_size << 8 | TWI_DEVICE); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); nvmd_req.resp_addr_lo = @@ -4823,7 +4823,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, } case C_SEEPROM: { nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | C_SEEPROM); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); nvmd_req.resp_addr_lo = @@ -4832,7 +4832,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, } case VPD_FLASH: { nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | VPD_FLASH); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); nvmd_req.resp_addr_lo = @@ -4841,7 +4841,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, } case EXPAN_ROM: { nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | EXPAN_ROM); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); nvmd_req.resp_addr_lo = @@ -4850,7 +4850,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, } case IOP_RDUMP: { nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | IOP_RDUMP); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); nvmd_req.vpd_offset = cpu_to_le32(ioctl_payload->offset); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); @@ -4890,7 +4890,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, circularQ = &pm8001_ha->inbnd_q_tbl[0]; memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr, &ioctl_payload->func_specific, - ioctl_payload->length); + ioctl_payload->wr_length); memset(&nvmd_req, 0, sizeof(nvmd_req)); rc = pm8001_tag_alloc(pm8001_ha, &tag); if (rc) { @@ -4909,7 +4909,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, nvmd_req.reserved[0] = cpu_to_le32(0xFEDCBA98); nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | twi_addr << 16 | twi_page_size << 8 | TWI_DEVICE); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); nvmd_req.resp_addr_lo = @@ -4918,7 +4918,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, } case C_SEEPROM: nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | C_SEEPROM); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); nvmd_req.reserved[0] = cpu_to_le32(0xFEDCBA98); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); @@ -4927,7 +4927,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, break; case VPD_FLASH: nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | VPD_FLASH); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); nvmd_req.reserved[0] = cpu_to_le32(0xFEDCBA98); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); @@ -4936,7 +4936,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, break; case EXPAN_ROM: nvmd_req.len_ir_vpdd = cpu_to_le32(IPMode | EXPAN_ROM); - nvmd_req.resp_len = cpu_to_le32(ioctl_payload->length); + nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); nvmd_req.reserved[0] = cpu_to_le32(0xFEDCBA98); nvmd_req.resp_addr_hi = cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 6d496b106531..3823734382b9 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -636,22 +636,22 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha) if (pm8001_ha->chip_id == chip_8001) { if (deviceid == 0x8081 || deviceid == 0x0042) { payload.minor_function = 4; - payload.length = 4096; + payload.rd_length = 4096; } else { payload.minor_function = 0; - payload.length = 128; + payload.rd_length = 128; } } else if ((pm8001_ha->chip_id == chip_8070 || pm8001_ha->chip_id == chip_8072) && pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) { payload.minor_function = 4; - payload.length = 4096; + payload.rd_length = 4096; } else { payload.minor_function = 1; - payload.length = 4096; + payload.rd_length = 4096; } payload.offset = 0; - payload.func_specific = kzalloc(payload.length, GFP_KERNEL); + payload.func_specific = kzalloc(payload.rd_length, GFP_KERNEL); if (!payload.func_specific) { PM8001_INIT_DBG(pm8001_ha, pm8001_printk("mem alloc fail\n")); return; @@ -721,7 +721,7 @@ static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) /* SAS ADDRESS read from flash / EEPROM */ payload.minor_function = 6; payload.offset = 0; - payload.length = 4096; + payload.rd_length = 4096; payload.func_specific = kzalloc(4096, GFP_KERNEL); if (!payload.func_specific) return -ENOMEM; diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 84cb52e82690..ae7ba9b3c4bc 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -137,10 +137,11 @@ struct pm8001_ioctl_payload { u32 signature; u16 major_function; u16 minor_function; - u16 length; u16 status; u16 offset; u16 id; + u32 wr_length; + u32 rd_length; u8 *func_specific; }; -- 2.16.3