[PATCH] target: Change return type to vm_fault_t

2018-04-14 Thread Souptick Joarder
Use new return type vm_fault_t for fault handler
in struct vm_operations_struct.

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
Reviewed-by: Matthew Wilcox <mawil...@microsoft.com>
---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index 4ad89ea..d6af292 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1382,7 +1382,7 @@ static struct page *tcmu_try_get_block_page(struct 
tcmu_dev *udev, uint32_t dbi)
return page;
 }

-static int tcmu_vma_fault(struct vm_fault *vmf)
+static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)
 {
struct tcmu_dev *udev = vmf->vma->vm_private_data;
struct uio_info *info = >uio_info;
--
1.9.1



[PATCH] scsi: Change return type to vm_fault_t

2018-04-14 Thread Souptick Joarder
Use new return type vm_fault_t for fault handler
in struct vm_operations_struct.

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
Reviewed-by: Matthew Wilcox <mawil...@microsoft.com>
---
 drivers/scsi/sg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index c198b963..c2b7d34 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1192,7 +1192,7 @@ static long sg_compat_ioctl(struct file *filp, unsigned 
int cmd_in, unsigned lon
return fasync_helper(fd, filp, mode, >async_qp);
 }

-static int
+static vm_fault_t
 sg_vma_fault(struct vm_fault *vmf)
 {
struct vm_area_struct *vma = vmf->vma;
--
1.9.1



Re: [PATCH] scsi: aic94xx: Use dma_pool_zalloc()

2018-03-14 Thread Souptick Joarder
On Thu, Mar 15, 2018 at 10:20 AM, Martin K. Petersen
 wrote:
>
> Souptick,
>
>> Any comment for this patch ?
>
> -ENOREVIEWS
>
> Also, you have not provided potential reviewers with a compelling reason
> why dma_pool_zalloc() is superior to alloc+memset.
>

dma_pool_zalloc() is the API which can replace dma_pool_alloc + memeset.
I have identified all the possible areas in kernel and send patches
for the same.
This patch is part of same change.

As there is no separate maintainer for /scsi/ aic94xx in Maintainer file, send
this patch to scsi mailing list.

Shall I request Andrew Morton to review this patch in case noone is
reviewing this patch?

> --
> Martin K. Petersen  Oracle Linux Engineering

-Souptick


Re: [PATCH] scsi: pmcraid: Use dma_pool_zalloc()

2018-03-14 Thread Souptick Joarder
Hi Martin,

Any comment for this patch ?

On Tue, Mar 6, 2018 at 1:31 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Any comment for this patch.
>
> On Thu, Feb 15, 2018 at 8:44 PM, Souptick Joarder <jrdr.li...@gmail.com> 
> wrote:
>> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>>
>> Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
>> ---
>>  drivers/scsi/pmcraid.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
>> index 201c8de..7535161 100644
>> --- a/drivers/scsi/pmcraid.c
>> +++ b/drivers/scsi/pmcraid.c
>> @@ -4716,7 +4716,7 @@ static int pmcraid_allocate_control_blocks(struct 
>> pmcraid_instance *pinstance)
>>
>> for (i = 0; i < PMCRAID_MAX_CMD; i++) {
>> pinstance->cmd_list[i]->ioa_cb =
>> -   dma_pool_alloc(
>> +   dma_pool_zalloc(
>> pinstance->control_pool,
>> GFP_KERNEL,
>> &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
>> @@ -4725,8 +4725,6 @@ static int pmcraid_allocate_control_blocks(struct 
>> pmcraid_instance *pinstance)
>> pmcraid_release_control_blocks(pinstance, i);
>> return -ENOMEM;
>> }
>> -   memset(pinstance->cmd_list[i]->ioa_cb, 0,
>> -   sizeof(struct pmcraid_control_block));
>> }
>> return 0;
>>  }
>> --
>> 1.9.1
>>

-Souptick


Re: [PATCH] scsi: mvsas: Use dma_pool_zalloc()

2018-03-14 Thread Souptick Joarder
Hi Martin,

Any comment for this patch ?

On Tue, Mar 6, 2018 at 1:31 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Any comment for this patch.
>
> On Thu, Feb 15, 2018 at 9:28 PM, Souptick Joarder <jrdr.li...@gmail.com> 
> wrote:
>> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>>
>> Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
>> ---
>>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>> index cff43bd..d00d37d 100644
>> --- a/drivers/scsi/mvsas/mv_sas.c
>> +++ b/drivers/scsi/mvsas/mv_sas.c
>> @@ -790,12 +790,11 @@ static int mvs_task_prep(struct sas_task *task, struct 
>> mvs_info *mvi, int is_tmf
>> slot->n_elem = n_elem;
>> slot->slot_tag = tag;
>>
>> -   slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, 
>> >buf_dma);
>> +   slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, 
>> >buf_dma);
>> if (!slot->buf) {
>> rc = -ENOMEM;
>> goto err_out_tag;
>> }
>> -   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>>
>> tei.task = task;
>> tei.hdr = >slot[tag];
>> --
>> 1.9.1
>>

-Souptick


Re: [PATCH] scsi: aic94xx: Use dma_pool_zalloc()

2018-03-14 Thread Souptick Joarder
Hi Martin,

Any comment for this patch ?

On Wed, Mar 7, 2018 at 2:25 AM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Any comment for this patch.
>
> On Thu, Feb 15, 2018 at 10:09 PM, Souptick Joarder <jrdr.li...@gmail.com> 
> wrote:
>> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>>
>> Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
>> ---
>>  drivers/scsi/aic94xx/aic94xx_hwi.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c 
>> b/drivers/scsi/aic94xx/aic94xx_hwi.c
>> index 2dbc833..1b13133 100644
>> --- a/drivers/scsi/aic94xx/aic94xx_hwi.c
>> +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
>> @@ -1055,14 +1055,13 @@ static struct asd_ascb *asd_ascb_alloc(struct 
>> asd_ha_struct *asd_ha,
>>
>> if (ascb) {
>> ascb->dma_scb.size = sizeof(struct scb);
>> -   ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
>> +   ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool,
>>  gfp_flags,
>> 
>> >dma_scb.dma_handle);
>> if (!ascb->dma_scb.vaddr) {
>> kmem_cache_free(asd_ascb_cache, ascb);
>> return NULL;
>> }
>> -   memset(ascb->dma_scb.vaddr, 0, sizeof(struct scb));
>> asd_init_ascb(asd_ha, ascb);
>>
>> spin_lock_irqsave(>tc_index_lock, flags);
>> --
>> 1.9.1
>>

-Souptick


[PATCH] scsi: ipr: Use dma_pool_zalloc()

2018-03-08 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/ipr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e07dd99..97387be 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9684,14 +9684,14 @@ static int ipr_alloc_cmd_blks(struct ipr_ioa_cfg 
*ioa_cfg)
}

for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
-   ipr_cmd = dma_pool_alloc(ioa_cfg->ipr_cmd_pool, GFP_KERNEL, 
_addr);
+   ipr_cmd = dma_pool_zalloc(ioa_cfg->ipr_cmd_pool,
+   GFP_KERNEL, _addr);

if (!ipr_cmd) {
ipr_free_cmd_blks(ioa_cfg);
return -ENOMEM;
}

-   memset(ipr_cmd, 0, sizeof(*ipr_cmd));
ioa_cfg->ipr_cmnd_list[i] = ipr_cmd;
ioa_cfg->ipr_cmnd_list_dma[i] = dma_addr;

--
1.9.1



Re: [PATCH] scsi: ipr: Use dma_pool_zalloc()

2018-03-07 Thread Souptick Joarder
On Wed, Mar 7, 2018 at 8:45 AM, Martin K. Petersen
 wrote:
>
> Brian,
>
>> Thanks!
>>
>> Acked-by: Brian King 
>
> Not sure where this patch was sent but it's not in my mailbox, nor the
> list archives.
>
> Souptick: Please resubmit to linux-scsi with Brian's Acked-by.

Ok, I will resubmit.

>
> --
> Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: aic94xx: Use dma_pool_zalloc()

2018-03-06 Thread Souptick Joarder
Any comment for this patch.

On Thu, Feb 15, 2018 at 10:09 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
> Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
> ---
>  drivers/scsi/aic94xx/aic94xx_hwi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c 
> b/drivers/scsi/aic94xx/aic94xx_hwi.c
> index 2dbc833..1b13133 100644
> --- a/drivers/scsi/aic94xx/aic94xx_hwi.c
> +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
> @@ -1055,14 +1055,13 @@ static struct asd_ascb *asd_ascb_alloc(struct 
> asd_ha_struct *asd_ha,
>
> if (ascb) {
> ascb->dma_scb.size = sizeof(struct scb);
> -   ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
> +   ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool,
>  gfp_flags,
> 
> >dma_scb.dma_handle);
> if (!ascb->dma_scb.vaddr) {
> kmem_cache_free(asd_ascb_cache, ascb);
> return NULL;
> }
> -   memset(ascb->dma_scb.vaddr, 0, sizeof(struct scb));
> asd_init_ascb(asd_ha, ascb);
>
> spin_lock_irqsave(>tc_index_lock, flags);
> --
> 1.9.1
>


Re: [PATCH] scsi: mvsas: Use dma_pool_zalloc()

2018-03-06 Thread Souptick Joarder
Any comment for this patch.

On Thu, Feb 15, 2018 at 9:28 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
> Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
> ---
>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
> index cff43bd..d00d37d 100644
> --- a/drivers/scsi/mvsas/mv_sas.c
> +++ b/drivers/scsi/mvsas/mv_sas.c
> @@ -790,12 +790,11 @@ static int mvs_task_prep(struct sas_task *task, struct 
> mvs_info *mvi, int is_tmf
> slot->n_elem = n_elem;
> slot->slot_tag = tag;
>
> -   slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
> +   slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, 
> >buf_dma);
> if (!slot->buf) {
> rc = -ENOMEM;
> goto err_out_tag;
> }
> -   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>
> tei.task = task;
> tei.hdr = >slot[tag];
> --
> 1.9.1
>


Re: [PATCH] scsi: pmcraid: Use dma_pool_zalloc()

2018-03-06 Thread Souptick Joarder
Any comment for this patch.

On Thu, Feb 15, 2018 at 8:44 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
> Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
> ---
>  drivers/scsi/pmcraid.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index 201c8de..7535161 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -4716,7 +4716,7 @@ static int pmcraid_allocate_control_blocks(struct 
> pmcraid_instance *pinstance)
>
> for (i = 0; i < PMCRAID_MAX_CMD; i++) {
> pinstance->cmd_list[i]->ioa_cb =
> -   dma_pool_alloc(
> +   dma_pool_zalloc(
> pinstance->control_pool,
> GFP_KERNEL,
> &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
> @@ -4725,8 +4725,6 @@ static int pmcraid_allocate_control_blocks(struct 
> pmcraid_instance *pinstance)
> pmcraid_release_control_blocks(pinstance, i);
> return -ENOMEM;
> }
> -   memset(pinstance->cmd_list[i]->ioa_cb, 0,
> -   sizeof(struct pmcraid_control_block));
> }
> return 0;
>  }
> --
> 1.9.1
>


[PATCH] scsi: aic94xx: Use dma_pool_zalloc()

2018-02-15 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/aic94xx/aic94xx_hwi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c 
b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 2dbc833..1b13133 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -1055,14 +1055,13 @@ static struct asd_ascb *asd_ascb_alloc(struct 
asd_ha_struct *asd_ha,

if (ascb) {
ascb->dma_scb.size = sizeof(struct scb);
-   ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
+   ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool,
 gfp_flags,
>dma_scb.dma_handle);
if (!ascb->dma_scb.vaddr) {
kmem_cache_free(asd_ascb_cache, ascb);
return NULL;
}
-   memset(ascb->dma_scb.vaddr, 0, sizeof(struct scb));
asd_init_ascb(asd_ha, ascb);

spin_lock_irqsave(>tc_index_lock, flags);
--
1.9.1



[PATCH] scsi: megaraid: Use dma_pool_zalloc()

2018-02-15 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index a71ee67..905ea36 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4022,7 +4022,7 @@ static int megasas_create_frame_pool(struct 
megasas_instance *instance)

cmd = instance->cmd_list[i];

-   cmd->frame = dma_pool_alloc(instance->frame_dma_pool,
+   cmd->frame = dma_pool_zalloc(instance->frame_dma_pool,
GFP_KERNEL, >frame_phys_addr);

cmd->sense = dma_pool_alloc(instance->sense_dma_pool,
@@ -4038,7 +4038,6 @@ static int megasas_create_frame_pool(struct 
megasas_instance *instance)
return -ENOMEM;
}

-   memset(cmd->frame, 0, instance->mfi_frame_size);
cmd->frame->io.context = cpu_to_le32(cmd->index);
cmd->frame->io.pad_0 = 0;
if ((instance->adapter_type == MFI_SERIES) && reset_devices)
--
1.9.1



[PATCH] scsi: mvsas: Use dma_pool_zalloc()

2018-02-15 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/mvsas/mv_sas.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index cff43bd..d00d37d 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -790,12 +790,11 @@ static int mvs_task_prep(struct sas_task *task, struct 
mvs_info *mvi, int is_tmf
slot->n_elem = n_elem;
slot->slot_tag = tag;

-   slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
+   slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
if (!slot->buf) {
rc = -ENOMEM;
goto err_out_tag;
}
-   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);

tei.task = task;
tei.hdr = >slot[tag];
--
1.9.1



[PATCH] scsi: pmcraid: Use dma_pool_zalloc()

2018-02-15 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/pmcraid.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 201c8de..7535161 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4716,7 +4716,7 @@ static int pmcraid_allocate_control_blocks(struct 
pmcraid_instance *pinstance)

for (i = 0; i < PMCRAID_MAX_CMD; i++) {
pinstance->cmd_list[i]->ioa_cb =
-   dma_pool_alloc(
+   dma_pool_zalloc(
pinstance->control_pool,
GFP_KERNEL,
&(pinstance->cmd_list[i]->ioa_cb_bus_addr));
@@ -4725,8 +4725,6 @@ static int pmcraid_allocate_control_blocks(struct 
pmcraid_instance *pinstance)
pmcraid_release_control_blocks(pinstance, i);
return -ENOMEM;
}
-   memset(pinstance->cmd_list[i]->ioa_cb, 0,
-   sizeof(struct pmcraid_control_block));
}
return 0;
 }
--
1.9.1



[PATCH v2] scsi: qla2xxx: Use dma_pool_zalloc()

2018-02-14 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---

v2: Remove extra line and comment

 drivers/scsi/qla2xxx/qla_bsg.c|  3 +--
 drivers/scsi/qla2xxx/qla_iocb.c   | 10 ++
 drivers/scsi/qla2xxx/qla_target.c |  7 +--
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index e2d5d3c..c11a89b 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -1035,7 +1035,7 @@
sg_copy_to_buffer(bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, fw_buf, data_len);

-   mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, _dma);
+   mn = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, _dma);
if (!mn) {
ql_log(ql_log_warn, vha, 0x7036,
"DMA alloc failed for fw buffer.\n");
@@ -1046,7 +1046,6 @@
flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1];
fw_ver = le32_to_cpu(*((uint32_t *)((uint32_t *)fw_buf + 2)));

-   memset(mn, 0, sizeof(struct access_chip_84xx));
mn->entry_type = VERIFY_CHIP_IOCB_TYPE;
mn->entry_count = 1;

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 1b62e94..1796866 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1203,7 +1203,6 @@ struct fw_dif_context {
uint32_tdif_bytes;
uint8_t bundling = 1;
uint16_tblk_size;
-   uint8_t *clr_ptr;
struct crc_context  *crc_ctx_pkt = NULL;
struct qla_hw_data  *ha;
uint8_t additional_fcpcdb_len;
@@ -1245,15 +1244,11 @@ struct fw_dif_context {

/* Allocate CRC context from global pool */
crc_ctx_pkt = sp->u.scmd.ctx =
-   dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);
+   dma_pool_zalloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);

if (!crc_ctx_pkt)
goto crc_queuing_error;

-   /* Zero out CTX area. */
-   clr_ptr = (uint8_t *)crc_ctx_pkt;
-   memset(clr_ptr, 0, sizeof(*crc_ctx_pkt));
-
crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma;

sp->flags |= SRB_CRC_CTX_DMA_VALID;
@@ -3067,7 +3062,7 @@ struct fw_dif_context {
}

memset(ctx, 0, sizeof(struct ct6_dsd));
-   ctx->fcp_cmnd = dma_pool_alloc(ha->fcp_cmnd_dma_pool,
+   ctx->fcp_cmnd = dma_pool_zalloc(ha->fcp_cmnd_dma_pool,
GFP_ATOMIC, >fcp_cmnd_dma);
if (!ctx->fcp_cmnd) {
ql_log(ql_log_fatal, vha, 0x3011,
@@ -3120,7 +3115,6 @@ struct fw_dif_context {
host_to_fcp_swap((uint8_t *)_pkt->lun, 
sizeof(cmd_pkt->lun));

/* build FCP_CMND IU */
-   memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
int_to_scsilun(cmd->device->lun, >fcp_cmnd->lun);
ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index fc89af8..3b52bcd 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2871,7 +2871,6 @@ static void qlt_24xx_init_ctio_to_isp(struct 
ctio7_to_24xx *ctio,
uint32_tdata_bytes;
uint32_tdif_bytes;
uint8_t bundling = 1;
-   uint8_t *clr_ptr;
struct crc_context  *crc_ctx_pkt = NULL;
struct qla_hw_data  *ha;
struct ctio_crc2_to_fw  *pkt;
@@ -3000,15 +2999,11 @@ static void qlt_24xx_init_ctio_to_isp(struct 
ctio7_to_24xx *ctio,

/* Allocate CRC context from global pool */
crc_ctx_pkt = cmd->ctx =
-   dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);
+   dma_pool_zalloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);

if (!crc_ctx_pkt)
goto crc_queuing_error;

-   /* Zero out CTX area. */
-   clr_ptr = (uint8_t *)crc_ctx_pkt;
-   memset(clr_ptr, 0, sizeof(*crc_ctx_pkt));
-
crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma;
INIT_LIST_HEAD(_ctx_pkt->dsd_list);

--
1.9.1



[PATCH] scsi: qla2xxx: Use dma_pool_zalloc()

2018-02-14 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/qla2xxx/qla_bsg.c|  3 +--
 drivers/scsi/qla2xxx/qla_iocb.c   | 10 ++
 drivers/scsi/qla2xxx/qla_target.c |  5 +
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index e2d5d3c..c11a89b 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -1035,7 +1035,7 @@
sg_copy_to_buffer(bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, fw_buf, data_len);

-   mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, _dma);
+   mn = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, _dma);
if (!mn) {
ql_log(ql_log_warn, vha, 0x7036,
"DMA alloc failed for fw buffer.\n");
@@ -1046,7 +1046,6 @@
flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1];
fw_ver = le32_to_cpu(*((uint32_t *)((uint32_t *)fw_buf + 2)));

-   memset(mn, 0, sizeof(struct access_chip_84xx));
mn->entry_type = VERIFY_CHIP_IOCB_TYPE;
mn->entry_count = 1;

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 1b62e94..1796866 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1203,7 +1203,6 @@ struct fw_dif_context {
uint32_tdif_bytes;
uint8_t bundling = 1;
uint16_tblk_size;
-   uint8_t *clr_ptr;
struct crc_context  *crc_ctx_pkt = NULL;
struct qla_hw_data  *ha;
uint8_t additional_fcpcdb_len;
@@ -1245,15 +1244,11 @@ struct fw_dif_context {

/* Allocate CRC context from global pool */
crc_ctx_pkt = sp->u.scmd.ctx =
-   dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);
+   dma_pool_zalloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);

if (!crc_ctx_pkt)
goto crc_queuing_error;

-   /* Zero out CTX area. */
-   clr_ptr = (uint8_t *)crc_ctx_pkt;
-   memset(clr_ptr, 0, sizeof(*crc_ctx_pkt));
-
crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma;

sp->flags |= SRB_CRC_CTX_DMA_VALID;
@@ -3067,7 +3062,7 @@ struct fw_dif_context {
}

memset(ctx, 0, sizeof(struct ct6_dsd));
-   ctx->fcp_cmnd = dma_pool_alloc(ha->fcp_cmnd_dma_pool,
+   ctx->fcp_cmnd = dma_pool_zalloc(ha->fcp_cmnd_dma_pool,
GFP_ATOMIC, >fcp_cmnd_dma);
if (!ctx->fcp_cmnd) {
ql_log(ql_log_fatal, vha, 0x3011,
@@ -3120,7 +3115,6 @@ struct fw_dif_context {
host_to_fcp_swap((uint8_t *)_pkt->lun, 
sizeof(cmd_pkt->lun));

/* build FCP_CMND IU */
-   memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
int_to_scsilun(cmd->device->lun, >fcp_cmnd->lun);
ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index fc89af8..17ab939 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2871,7 +2871,6 @@ static void qlt_24xx_init_ctio_to_isp(struct 
ctio7_to_24xx *ctio,
uint32_tdata_bytes;
uint32_tdif_bytes;
uint8_t bundling = 1;
-   uint8_t *clr_ptr;
struct crc_context  *crc_ctx_pkt = NULL;
struct qla_hw_data  *ha;
struct ctio_crc2_to_fw  *pkt;
@@ -3000,14 +2999,12 @@ static void qlt_24xx_init_ctio_to_isp(struct 
ctio7_to_24xx *ctio,

/* Allocate CRC context from global pool */
crc_ctx_pkt = cmd->ctx =
-   dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);
+   dma_pool_zalloc(ha->dl_dma_pool, GFP_ATOMIC, _ctx_dma);

if (!crc_ctx_pkt)
goto crc_queuing_error;

/* Zero out CTX area. */
-   clr_ptr = (uint8_t *)crc_ctx_pkt;
-   memset(clr_ptr, 0, sizeof(*crc_ctx_pkt));

crc_ctx_pkt->crc_ctx_dma = crc_ctx_dma;
INIT_LIST_HEAD(_ctx_pkt->dsd_list);
--
1.9.1



[PATCH] scsi: qla4xxx: Use dma_pool_zalloc()

2018-02-14 Thread Souptick Joarder
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/qla4xxx/ql4_mbx.c | 6 ++
 drivers/scsi/qla4xxx/ql4_os.c  | 4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index bda2e64..5d56904 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1584,12 +1584,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char 
*username, char *password,
struct ql4_chap_table *chap_table;
dma_addr_t chap_dma;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL)
return -ENOMEM;

chap_size = sizeof(struct ql4_chap_table);
-   memset(chap_table, 0, chap_size);

if (is_qla40XX(ha))
offset = FLASH_CHAP_OFFSET | (idx * chap_size);
@@ -1648,13 +1647,12 @@ int qla4xxx_set_chap(struct scsi_qla_host *ha, char 
*username, char *password,
uint32_t chap_size = 0;
dma_addr_t chap_dma;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL) {
ret =  -ENOMEM;
goto exit_set_chap;
}

-   memset(chap_table, 0, sizeof(struct ql4_chap_table));
if (bidi)
chap_table->flags |= BIT_6; /* peer */
else
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 82e889b..5896343 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -825,12 +825,10 @@ static int qla4xxx_delete_chap(struct Scsi_Host *shost, 
uint16_t chap_tbl_idx)
uint32_t chap_size;
int ret = 0;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL)
return -ENOMEM;

-   memset(chap_table, 0, sizeof(struct ql4_chap_table));
-
if (is_qla80XX(ha))
max_chap_entries = (ha->hw.flt_chap_size / 2) /
   sizeof(struct ql4_chap_table);
--
1.9.1



Re: [PATCH v2] scsi: qla4xxx: Use dma_pool_zalloc

2017-01-01 Thread Souptick Joarder
Hi Nilesh,

On Thu, Dec 22, 2016 at 5:42 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>
> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
> ---
> v2 changes:
>- Address comment from Nilesh to make same change in
>  all applicable places inside qla4xxx source
>
>  drivers/scsi/qla4xxx/ql4_mbx.c | 6 ++
>  drivers/scsi/qla4xxx/ql4_os.c  | 4 +---
>  2 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
> index c291fdf..8f97839 100644
> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
> @@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char 
> *username, char *password,
> struct ql4_chap_table *chap_table;
> dma_addr_t chap_dma;
>
> -   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, 
> _dma);
> if (chap_table == NULL)
> return -ENOMEM;
>
> chap_size = sizeof(struct ql4_chap_table);
> -   memset(chap_table, 0, chap_size);
>
> if (is_qla40XX(ha))
> offset = FLASH_CHAP_OFFSET | (idx * chap_size);
> @@ -1651,13 +1650,12 @@ int qla4xxx_set_chap(struct scsi_qla_host *ha, char 
> *username, char *password,
> uint32_t chap_size = 0;
> dma_addr_t chap_dma;
>
> -   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, 
> _dma);
> if (chap_table == NULL) {
> ret =  -ENOMEM;
> goto exit_set_chap;
> }
>
> -   memset(chap_table, 0, sizeof(struct ql4_chap_table));
> if (bidi)
> chap_table->flags |= BIT_6; /* peer */
> else
> diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> index 01c3610..0c91c89 100644
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -825,12 +825,10 @@ static int qla4xxx_delete_chap(struct Scsi_Host *shost, 
> uint16_t chap_tbl_idx)
> uint32_t chap_size;
> int ret = 0;
>
> -   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, 
> _dma);
> if (chap_table == NULL)
> return -ENOMEM;
>
> -   memset(chap_table, 0, sizeof(struct ql4_chap_table));
> -
> if (is_qla80XX(ha))
> max_chap_entries = (ha->hw.flt_chap_size / 2) /
>sizeof(struct ql4_chap_table);
> --
> 1.9.1
>

Any further comment on this patch ?

Regards
Souptick
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] scsi: qla4xxx: Use dma_pool_zalloc

2016-12-22 Thread Souptick Joarder
We should use dma_pool_zalloc instead of dma_pool_alloc/memset

Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
---
v2 changes:
   - Address comment from Nilesh to make same change in
 all applicable places inside qla4xxx source

 drivers/scsi/qla4xxx/ql4_mbx.c | 6 ++
 drivers/scsi/qla4xxx/ql4_os.c  | 4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index c291fdf..8f97839 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char 
*username, char *password,
struct ql4_chap_table *chap_table;
dma_addr_t chap_dma;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL)
return -ENOMEM;

chap_size = sizeof(struct ql4_chap_table);
-   memset(chap_table, 0, chap_size);

if (is_qla40XX(ha))
offset = FLASH_CHAP_OFFSET | (idx * chap_size);
@@ -1651,13 +1650,12 @@ int qla4xxx_set_chap(struct scsi_qla_host *ha, char 
*username, char *password,
uint32_t chap_size = 0;
dma_addr_t chap_dma;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL) {
ret =  -ENOMEM;
goto exit_set_chap;
}

-   memset(chap_table, 0, sizeof(struct ql4_chap_table));
if (bidi)
chap_table->flags |= BIT_6; /* peer */
else
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 01c3610..0c91c89 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -825,12 +825,10 @@ static int qla4xxx_delete_chap(struct Scsi_Host *shost, 
uint16_t chap_tbl_idx)
uint32_t chap_size;
int ret = 0;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL)
return -ENOMEM;

-   memset(chap_table, 0, sizeof(struct ql4_chap_table));
-
if (is_qla80XX(ha))
max_chap_entries = (ha->hw.flt_chap_size / 2) /
   sizeof(struct ql4_chap_table);
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: qla4xxx: Use dma_pool_zalloc

2016-12-21 Thread Souptick Joarder
On Wed, Dec 21, 2016 at 5:13 PM, Javali, Nilesh
<nilesh.jav...@cavium.com> wrote:
>
>
> On 13/12/16, 6:35 PM, "Souptick Joarder" <jrdr.li...@gmail.com> wrote:
>
>>On Tue, Dec 13, 2016 at 4:11 PM, Javali, Nilesh
>><nilesh.jav...@cavium.com> wrote:
>>>
>>>
>>> On 12/12/16, 10:16 AM, "linux-scsi-ow...@vger.kernel.org on behalf of
>>> Souptick Joarder" <linux-scsi-ow...@vger.kernel.org on behalf of
>>> jrdr.li...@gmail.com> wrote:
>>>
>>>>On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder <jrdr.li...@gmail.com>
>>>>wrote:
>>>>> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>>>>>
>>>>> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
>>>>> ---
>>>>>  drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
>>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c
>>>>>b/drivers/scsi/qla4xxx/ql4_mbx.c
>>>>> index c291fdf..f2edfd7 100644
>>>>> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
>>>>> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
>>>>> @@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha,
>>>>>char *username, char *password,
>>>>> struct ql4_chap_table *chap_table;
>>>>> dma_addr_t chap_dma;
>>>>>
>>>>> -   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL,
>>>>>_dma);
>>>>> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL,
>>>>>_dma);
>>>>> if (chap_table == NULL)
>>>>> return -ENOMEM;
>>>>>
>>>>> chap_size = sizeof(struct ql4_chap_table);
>>>>> -   memset(chap_table, 0, chap_size);
>>>>>
>>>>> if (is_qla40XX(ha))
>>>>> offset = FLASH_CHAP_OFFSET | (idx * chap_size);
>>>>> --
>>>>> 1.9.1
>>>>>
>>>>
>>>>Any comment on this patch?
>>>
>>> There are multiple other places where dma_pool_alloc needs to be
>>>replaced
>>> by dma_pool_zalloc.
>>
>>
>> are you asking to do this for SCSI subsystem?
>> If yes, I can do that.
>>
>>>
>>> Can you please take care within a single patch.
>>
>> But the same changes are applicable in other subsystems as well.
>> I think I shouldn't send those changes in a single patch as
>>maintainers are different
>> for different modules.
>
> I'm referring to multiple other files within qla4xxx source which uses
> dma_pool_alloc.
> The current patch takes care only of ql4_mbx.c and qla4xxx_get_chap
> function.
> There is qla4xxx_set_chap function as well. Also ql4_init.c and ql4_os.c
> files also use dma_pool_alloc.
> I was requesting to make all these changes related to qla4xxx module
> within a single patch.

Well I will do that.
>
> Thanks,
> Nilesh
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-12-14 Thread Souptick Joarder
Martin,

On Wed, Dec 14, 2016 at 7:22 AM, Martin K. Petersen
<martin.peter...@oracle.com> wrote:
>>>>>> "Souptick" == Souptick Joarder <jrdr.li...@gmail.com> writes:
>
> Souptick,
>
> Sorry about the delay. Been out for a few days.
>
>>>> Inside mvs_task_prep(), pci_pool_alloc() followed by memset will be
>>>> replaced by pci_pool_zalloc()
>
> Souptick> Any further comment on this ?
>
> I took one of your other patches because the driver maintainer acked it,
> thus assuming responsibility for testing it and fixing any regressions
> it may cause.
>
> The failure rate on these "trivial" patches to old and unmaintained
> drivers is very high. And since you are not fixing any bugs and your
> change is functionally identical what the code already does, why would
> we merge it and risk a regression? (for changes like this, a Tested-by:
> from somebody with actual hardware is worth a thousand Reviewed-by:
> tags).
>
> Also, I'm not really convinced that this constant churn of new and
> "improved" kernel interface helper functions is really solving anything.
> Quite the contrary. Real bug fixes for drivers adopting the
> pci_pool_zalloc() interface will now potentially be harder to backport
> to stable releases predating 4.4 or whenever that call was introduced.
>
> So in summary, I don't see any actual benefits to your proposed
> change. It's probably fine, but why would I risk merging it?

  I understand the importance of testing this patch on old and
unmaintained driver and
  totally agreed with your point of view now.

  I will drop this patch.
  If possible, can you please let me know what are all the basic
stability test cases are covered
  for SCSI drivers?
>
> Hope that all makes sense...
>
> Thanks!
>
> --
> Martin K. Petersen  Oracle Linux Engineering

Thanks -
Souptick
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: qla4xxx: Use dma_pool_zalloc

2016-12-13 Thread Souptick Joarder
On Tue, Dec 13, 2016 at 4:11 PM, Javali, Nilesh
<nilesh.jav...@cavium.com> wrote:
>
>
> On 12/12/16, 10:16 AM, "linux-scsi-ow...@vger.kernel.org on behalf of
> Souptick Joarder" <linux-scsi-ow...@vger.kernel.org on behalf of
> jrdr.li...@gmail.com> wrote:
>
>>On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder <jrdr.li...@gmail.com>
>>wrote:
>>> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>>>
>>> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
>>> ---
>>>  drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c
>>>b/drivers/scsi/qla4xxx/ql4_mbx.c
>>> index c291fdf..f2edfd7 100644
>>> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
>>> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
>>> @@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha,
>>>char *username, char *password,
>>> struct ql4_chap_table *chap_table;
>>> dma_addr_t chap_dma;
>>>
>>> -   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL,
>>>_dma);
>>> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL,
>>>_dma);
>>> if (chap_table == NULL)
>>> return -ENOMEM;
>>>
>>> chap_size = sizeof(struct ql4_chap_table);
>>> -   memset(chap_table, 0, chap_size);
>>>
>>> if (is_qla40XX(ha))
>>> offset = FLASH_CHAP_OFFSET | (idx * chap_size);
>>> --
>>> 1.9.1
>>>
>>
>>Any comment on this patch?
>
> There are multiple other places where dma_pool_alloc needs to be replaced
> by dma_pool_zalloc.


 are you asking to do this for SCSI subsystem?
 If yes, I can do that.

>
> Can you please take care within a single patch.

 But the same changes are applicable in other subsystems as well.
 I think I shouldn't send those changes in a single patch as
maintainers are different
 for different modules.

>
> Thanks,
> Nilesh
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: qla4xxx: Use dma_pool_zalloc

2016-12-11 Thread Souptick Joarder
On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>
> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
> ---
>  drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
> index c291fdf..f2edfd7 100644
> --- a/drivers/scsi/qla4xxx/ql4_mbx.c
> +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
> @@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char 
> *username, char *password,
> struct ql4_chap_table *chap_table;
> dma_addr_t chap_dma;
>
> -   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, 
> _dma);
> if (chap_table == NULL)
> return -ENOMEM;
>
> chap_size = sizeof(struct ql4_chap_table);
> -   memset(chap_table, 0, chap_size);
>
> if (is_qla40XX(ha))
> offset = FLASH_CHAP_OFFSET | (idx * chap_size);
> --
> 1.9.1
>

Any comment on this patch?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-12-11 Thread Souptick Joarder
Hi Martin,

On Tue, Dec 6, 2016 at 6:58 PM, Johannes Thumshirn <jthumsh...@suse.de> wrote:
> On Mon, Nov 28, 2016 at 04:56:26PM +0530, Souptick Joarder wrote:
>> Inside mvs_task_prep(), pci_pool_alloc() followed by memset will be
>> replaced by pci_pool_zalloc()
>>
>> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
>> ---
>
> FWIW,
> Reviewed-by: Johannes Thumshirn <jthumsh...@suse.de>
>
> --
> Johannes Thumshirn  Storage
> jthumsh...@suse.de+49 911 74053 689
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: Felix Imendörffer, Jane Smithard, Graham Norton
> HRB 21284 (AG Nürnberg)
> Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

Any further comment on this ?

Regards
Souptick
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: qla4xxx: Use dma_pool_zalloc

2016-12-06 Thread Souptick Joarder
We should use dma_pool_zalloc instead of dma_pool_alloc/memset

Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index c291fdf..f2edfd7 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1587,12 +1587,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char 
*username, char *password,
struct ql4_chap_table *chap_table;
dma_addr_t chap_dma;

-   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
+   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
if (chap_table == NULL)
return -ENOMEM;

chap_size = sizeof(struct ql4_chap_table);
-   memset(chap_table, 0, chap_size);

if (is_qla40XX(ha))
offset = FLASH_CHAP_OFFSET | (idx * chap_size);
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-12-06 Thread Souptick Joarder
Hi Martin,

On Tue, Dec 6, 2016 at 3:34 AM, Martin K. Petersen
<martin.peter...@oracle.com> wrote:
>>>>>> "Souptick" == Souptick Joarder <jrdr.li...@gmail.com> writes:
>
> Souptick,
>
> Souptick> Any comment on this patch?
>
> The patch looked OK to me when you posted it. However, you need one
> person in addition to me to review it. And you need convince us of the
> merit of a presumably untested change to an unmaintained driver.

pci_pool_zalloc() will perform the same as pci_pool_alloc() and memset combined.

I have send similar patches to other modules like - dmaengine, scsi,
net, gpu . Those
were accepted and merged into respective branches. one similar patch
you have applied
previously.

I am sure this patch will work fine even without testing.

>
> --
> Martin K. Petersen  Oracle Linux Engineering

Regards
Souptick
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-12-04 Thread Souptick Joarder
Hi Martin,

Any comment on this patch?

On Thu, Dec 1, 2016 at 11:34 AM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> On Mon, Nov 28, 2016 at 4:56 PM, Souptick Joarder <jrdr.li...@gmail.com> 
> wrote:
>> Inside mvs_task_prep(), pci_pool_alloc() followed by memset will be
>> replaced by pci_pool_zalloc()
>>
>> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
>> ---
>>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>> index 86eb199..681e5f7 100644
>> --- a/drivers/scsi/mvsas/mv_sas.c
>> +++ b/drivers/scsi/mvsas/mv_sas.c
>> @@ -790,10 +790,9 @@ static int mvs_task_prep(struct sas_task *task, struct 
>> mvs_info *mvi, int is_tmf
>> slot->n_elem = n_elem;
>> slot->slot_tag = tag;
>>
>> -   slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, 
>> >buf_dma);
>> +   slot->buf = pci_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, 
>> >buf_dma);
>> if (!slot->buf)
>> goto err_out_tag;
>> -   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>>
>> tei.task = task;
>> tei.hdr = >slot[tag];
>> --
>> 1.9.1
>
> Any Comment on this patch?
>>

Regards
Souptick
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-11-30 Thread Souptick Joarder
On Mon, Nov 28, 2016 at 4:56 PM, Souptick Joarder <jrdr.li...@gmail.com> wrote:
> Inside mvs_task_prep(), pci_pool_alloc() followed by memset will be
> replaced by pci_pool_zalloc()
>
> Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
> ---
>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
> index 86eb199..681e5f7 100644
> --- a/drivers/scsi/mvsas/mv_sas.c
> +++ b/drivers/scsi/mvsas/mv_sas.c
> @@ -790,10 +790,9 @@ static int mvs_task_prep(struct sas_task *task, struct 
> mvs_info *mvi, int is_tmf
> slot->n_elem = n_elem;
> slot->slot_tag = tag;
>
> -   slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
> +   slot->buf = pci_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, 
> >buf_dma);
> if (!slot->buf)
> goto err_out_tag;
> -   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>
> tei.task = task;
> tei.hdr = >slot[tag];
> --
> 1.9.1

Any Comment on this patch?
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: mvsas: Replace pci_pool_alloc by pci_pool_zalloc

2016-11-28 Thread Souptick Joarder
Inside mvs_task_prep(), pci_pool_alloc() followed by memset will be
replaced by pci_pool_zalloc()

Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/mvsas/mv_sas.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 86eb199..681e5f7 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -790,10 +790,9 @@ static int mvs_task_prep(struct sas_task *task, struct 
mvs_info *mvi, int is_tmf
slot->n_elem = n_elem;
slot->slot_tag = tag;
 
-   slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
+   slot->buf = pci_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
if (!slot->buf)
goto err_out_tag;
-   memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
 
tei.task = task;
tei.hdr = >slot[tag];
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: lpfc: Replace pci_pool_alloc by pci_pool_zalloc

2016-11-28 Thread Souptick Joarder
In lpfc_new_scsi_buf_s3() and lpfc_new_scsi_buf_s4() pci_pool_alloc
followed by memset will be replaced by pci_pool_zalloc()

Signed-off-by: Souptick joarder <jrdr.li...@gmail.com>
---
 drivers/scsi/lpfc/lpfc_scsi.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index d197aa1..58851c7 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -413,15 +413,13 @@ struct scsi_dif_tuple {
 * struct fcp_cmnd, struct fcp_rsp and the number of bde's
 * necessary to support the sg_tablesize.
 */
-   psb->data = pci_pool_alloc(phba->lpfc_scsi_dma_buf_pool,
+   psb->data = pci_pool_zalloc(phba->lpfc_scsi_dma_buf_pool,
GFP_KERNEL, >dma_handle);
if (!psb->data) {
kfree(psb);
break;
}
 
-   /* Initialize virtual ptrs to dma_buf region. */
-   memset(psb->data, 0, phba->cfg_sg_dma_buf_size);
 
/* Allocate iotag for psb->cur_iocbq. */
iotag = lpfc_sli_next_iotag(phba, >cur_iocbq);
@@ -821,13 +819,12 @@ struct scsi_dif_tuple {
 * for the struct fcp_cmnd, struct fcp_rsp and the number
 * of bde's necessary to support the sg_tablesize.
 */
-   psb->data = pci_pool_alloc(phba->lpfc_scsi_dma_buf_pool,
+   psb->data = pci_pool_zalloc(phba->lpfc_scsi_dma_buf_pool,
GFP_KERNEL, >dma_handle);
if (!psb->data) {
kfree(psb);
break;
}
-   memset(psb->data, 0, phba->cfg_sg_dma_buf_size);
 
/*
 * 4K Page alignment is CRITICAL to BlockGuard, double check
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html