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

2018-02-21 Thread Martin K. Petersen

Souptick,

> Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Applied to 4.17/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering


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

2018-02-18 Thread Rangankar, Manish


On 15/02/18 12:30 AM, "Souptick Joarder"  wrote:

>Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
>Signed-off-by: Souptick Joarder 
>---
> 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, &chap_dma);
>+  chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_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, &chap_dma);
>+  chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_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, &chap_dma);
>+  chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_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

Thanks,

Acked-by: Manish Rangankar 




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
 wrote:
>
>
> On 13/12/16, 6:35 PM, "Souptick Joarder"  wrote:
>
>>On Tue, Dec 13, 2016 at 4:11 PM, Javali, Nilesh
>> wrote:
>>>
>>>
>>> On 12/12/16, 10:16 AM, "linux-scsi-ow...@vger.kernel.org on behalf of
>>> Souptick Joarder" >> jrdr.li...@gmail.com> wrote:
>>>
On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder 
wrote:
> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>
> Signed-off-by: Souptick joarder 
> ---
>  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,
>&chap_dma);
> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL,
>&chap_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: qla4xxx: Use dma_pool_zalloc

2016-12-21 Thread Javali, Nilesh


On 13/12/16, 6:35 PM, "Souptick Joarder"  wrote:

>On Tue, Dec 13, 2016 at 4:11 PM, Javali, Nilesh
> wrote:
>>
>>
>> On 12/12/16, 10:16 AM, "linux-scsi-ow...@vger.kernel.org on behalf of
>> Souptick Joarder" > jrdr.li...@gmail.com> wrote:
>>
>>>On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder 
>>>wrote:
 We should use dma_pool_zalloc instead of dma_pool_alloc/memset

 Signed-off-by: Souptick joarder 
 ---
  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,
&chap_dma);
 +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL,
&chap_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.

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-13 Thread Souptick Joarder
On Tue, Dec 13, 2016 at 4:11 PM, Javali, Nilesh
 wrote:
>
>
> On 12/12/16, 10:16 AM, "linux-scsi-ow...@vger.kernel.org on behalf of
> Souptick Joarder"  jrdr.li...@gmail.com> wrote:
>
>>On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder 
>>wrote:
>>> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>>>
>>> Signed-off-by: Souptick joarder 
>>> ---
>>>  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,
>>>&chap_dma);
>>> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL,
>>>&chap_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-13 Thread Javali, Nilesh


On 12/12/16, 10:16 AM, "linux-scsi-ow...@vger.kernel.org on behalf of
Souptick Joarder"  wrote:

>On Wed, Dec 7, 2016 at 1:53 AM, Souptick Joarder 
>wrote:
>> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>>
>> Signed-off-by: Souptick joarder 
>> ---
>>  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,
>>&chap_dma);
>> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL,
>>&chap_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.

Can you please take care within a single patch.

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  wrote:
> We should use dma_pool_zalloc instead of dma_pool_alloc/memset
>
> Signed-off-by: Souptick joarder 
> ---
>  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, &chap_dma);
> +   chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, 
> &chap_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