* [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset
@ 2018-08-01 7:16 ` zhong jiang
0 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-01 7:16 UTC (permalink / raw)
To: jejb, martin.petersen; +Cc: linux-scsi, linux-kernel
Pci_zalloc_consistent is better than pci_alloc_consistent+memset,
and it make the code concise
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/scsi/pmcraid.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 4e86994..8a6facc 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4736,11 +4736,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
buffer_size = HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD;
for (i = 0; i < pinstance->num_hrrq; i++) {
- pinstance->hrrq_start[i] =
- pci_alloc_consistent(
- pinstance->pdev,
- buffer_size,
- &(pinstance->hrrq_start_bus_addr[i]));
+ pinstance->hrrq_start[i] = pci_zalloc_consistent(pinstance->pdev,
+ buffer_size,
+ &(pinstance->hrrq_start_bus_addr[i]));
if (!pinstance->hrrq_start[i]) {
pmcraid_err("pci_alloc failed for hrrq vector : %d\n",
@@ -4749,7 +4747,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
return -ENOMEM;
}
- memset(pinstance->hrrq_start[i], 0, buffer_size);
pinstance->hrrq_curr[i] = pinstance->hrrq_start[i];
pinstance->hrrq_end[i] =
pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1;
--
1.7.12.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset
@ 2018-08-01 7:16 ` zhong jiang
0 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-01 7:16 UTC (permalink / raw)
To: jejb, martin.petersen; +Cc: linux-scsi, linux-kernel
Pci_zalloc_consistent is better than pci_alloc_consistent+memset,
and it make the code concise
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/scsi/pmcraid.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 4e86994..8a6facc 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4736,11 +4736,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
buffer_size = HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD;
for (i = 0; i < pinstance->num_hrrq; i++) {
- pinstance->hrrq_start[i] =
- pci_alloc_consistent(
- pinstance->pdev,
- buffer_size,
- &(pinstance->hrrq_start_bus_addr[i]));
+ pinstance->hrrq_start[i] = pci_zalloc_consistent(pinstance->pdev,
+ buffer_size,
+ &(pinstance->hrrq_start_bus_addr[i]));
if (!pinstance->hrrq_start[i]) {
pmcraid_err("pci_alloc failed for hrrq vector : %d\n",
@@ -4749,7 +4747,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
return -ENOMEM;
}
- memset(pinstance->hrrq_start[i], 0, buffer_size);
pinstance->hrrq_curr[i] = pinstance->hrrq_start[i];
pinstance->hrrq_end[i] =
pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1;
--
1.7.12.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset
2018-08-01 7:16 ` zhong jiang
@ 2018-08-01 8:27 ` John Garry
-1 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2018-08-01 8:27 UTC (permalink / raw)
To: zhong jiang, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel
在 2018/8/1 15:16, zhong jiang 写道:
> Pci_zalloc_consistent is better than pci_alloc_consistent+memset,
> and it make the code concise
Aren't these APIs deprecated:
https://lkml.org/lkml/2018/6/5/381
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> drivers/scsi/pmcraid.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index 4e86994..8a6facc 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -4736,11 +4736,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
> buffer_size = HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD;
>
> for (i = 0; i < pinstance->num_hrrq; i++) {
> - pinstance->hrrq_start[i] =
> - pci_alloc_consistent(
> - pinstance->pdev,
> - buffer_size,
> - &(pinstance->hrrq_start_bus_addr[i]));
> + pinstance->hrrq_start[i] = pci_zalloc_consistent(pinstance->pdev,
> + buffer_size,
> + &(pinstance->hrrq_start_bus_addr[i]));
>
> if (!pinstance->hrrq_start[i]) {
> pmcraid_err("pci_alloc failed for hrrq vector : %d\n",
> @@ -4749,7 +4747,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
> return -ENOMEM;
> }
>
> - memset(pinstance->hrrq_start[i], 0, buffer_size);
> pinstance->hrrq_curr[i] = pinstance->hrrq_start[i];
> pinstance->hrrq_end[i] =
> pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset
@ 2018-08-01 8:27 ` John Garry
0 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2018-08-01 8:27 UTC (permalink / raw)
To: zhong jiang, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel
在 2018/8/1 15:16, zhong jiang 写道:
> Pci_zalloc_consistent is better than pci_alloc_consistent+memset,
> and it make the code concise
Aren't these APIs deprecated:
https://lkml.org/lkml/2018/6/5/381
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> drivers/scsi/pmcraid.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index 4e86994..8a6facc 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -4736,11 +4736,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
> buffer_size = HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD;
>
> for (i = 0; i < pinstance->num_hrrq; i++) {
> - pinstance->hrrq_start[i] =
> - pci_alloc_consistent(
> - pinstance->pdev,
> - buffer_size,
> - &(pinstance->hrrq_start_bus_addr[i]));
> + pinstance->hrrq_start[i] = pci_zalloc_consistent(pinstance->pdev,
> + buffer_size,
> + &(pinstance->hrrq_start_bus_addr[i]));
>
> if (!pinstance->hrrq_start[i]) {
> pmcraid_err("pci_alloc failed for hrrq vector : %d\n",
> @@ -4749,7 +4747,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
> return -ENOMEM;
> }
>
> - memset(pinstance->hrrq_start[i], 0, buffer_size);
> pinstance->hrrq_curr[i] = pinstance->hrrq_start[i];
> pinstance->hrrq_end[i] =
> pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset
2018-08-01 8:27 ` John Garry
@ 2018-08-01 9:14 ` zhong jiang
-1 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-01 9:14 UTC (permalink / raw)
To: John Garry; +Cc: jejb, martin.petersen, linux-scsi, linux-kernel
On 2018/8/1 16:27, John Garry wrote:
> 在 2018/8/1 15:16, zhong jiang 写道:
>> Pci_zalloc_consistent is better than pci_alloc_consistent+memset,
>> and it make the code concise
>
> Aren't these APIs deprecated:
> https://lkml.org/lkml/2018/6/5/381
>
I miss that, Thanks
Thanks
zhong jiang
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>> drivers/scsi/pmcraid.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
>> index 4e86994..8a6facc 100644
>> --- a/drivers/scsi/pmcraid.c
>> +++ b/drivers/scsi/pmcraid.c
>> @@ -4736,11 +4736,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
>> buffer_size = HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD;
>> for (i = 0; i < pinstance->num_hrrq; i++) {
>> - pinstance->hrrq_start[i] =
>> - pci_alloc_consistent(
>> - pinstance->pdev,
>> - buffer_size,
>> - &(pinstance->hrrq_start_bus_addr[i]));
>> + pinstance->hrrq_start[i] = pci_zalloc_consistent(pinstance->pdev,
>> + buffer_size,
>> + &(pinstance->hrrq_start_bus_addr[i]));
>> if (!pinstance->hrrq_start[i]) {
>> pmcraid_err("pci_alloc failed for hrrq vector : %d\n",
>> @@ -4749,7 +4747,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
>> return -ENOMEM;
>> }
>> - memset(pinstance->hrrq_start[i], 0, buffer_size);
>> pinstance->hrrq_curr[i] = pinstance->hrrq_start[i];
>> pinstance->hrrq_end[i] =
>> pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1;
>>
>
>
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset
@ 2018-08-01 9:14 ` zhong jiang
0 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-01 9:14 UTC (permalink / raw)
To: John Garry; +Cc: jejb, martin.petersen, linux-scsi, linux-kernel
On 2018/8/1 16:27, John Garry wrote:
> 在 2018/8/1 15:16, zhong jiang 写道:
>> Pci_zalloc_consistent is better than pci_alloc_consistent+memset,
>> and it make the code concise
>
> Aren't these APIs deprecated:
> https://lkml.org/lkml/2018/6/5/381
>
I miss that, Thanks
Thanks
zhong jiang
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>> drivers/scsi/pmcraid.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
>> index 4e86994..8a6facc 100644
>> --- a/drivers/scsi/pmcraid.c
>> +++ b/drivers/scsi/pmcraid.c
>> @@ -4736,11 +4736,9 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
>> buffer_size = HRRQ_ENTRY_SIZE * PMCRAID_MAX_CMD;
>> for (i = 0; i < pinstance->num_hrrq; i++) {
>> - pinstance->hrrq_start[i] =
>> - pci_alloc_consistent(
>> - pinstance->pdev,
>> - buffer_size,
>> - &(pinstance->hrrq_start_bus_addr[i]));
>> + pinstance->hrrq_start[i] = pci_zalloc_consistent(pinstance->pdev,
>> + buffer_size,
>> + &(pinstance->hrrq_start_bus_addr[i]));
>> if (!pinstance->hrrq_start[i]) {
>> pmcraid_err("pci_alloc failed for hrrq vector : %d\n",
>> @@ -4749,7 +4747,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
>> return -ENOMEM;
>> }
>> - memset(pinstance->hrrq_start[i], 0, buffer_size);
>> pinstance->hrrq_curr[i] = pinstance->hrrq_start[i];
>> pinstance->hrrq_end[i] =
>> pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1;
>>
>
>
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-01 9:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 7:16 [PATCH v2] driver/scsi/pmcraid: Use pci_zalloc_consistent instead of pci_alloc_consistent+memset zhong jiang
2018-08-01 7:16 ` zhong jiang
2018-08-01 8:27 ` John Garry
2018-08-01 8:27 ` John Garry
2018-08-01 9:14 ` zhong jiang
2018-08-01 9:14 ` zhong jiang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.