From: Christoph Hellwig <hch@infradead.org>
To: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Cc: linux-scsi@vger.kernel.org, hch@infradead.org,
Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com
Subject: Re: [v1 3/5] mpt3sas: Separate out RDPQ allocation to new function.
Date: Tue, 21 Apr 2020 23:39:07 -0700 [thread overview]
Message-ID: <20200422063907.GD20318@infradead.org> (raw)
In-Reply-To: <1586957125-19460-4-git-send-email-suganath-prabu.subramani@broadcom.com>
On Wed, Apr 15, 2020 at 09:25:23AM -0400, Suganath Prabu wrote:
> From: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
>
> For readability separate out RDPQ allocations to new function
> base_alloc_rdpq_dma_pool().
>
> Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 85 ++++++++++++++++++++++---------------
> 1 file changed, 51 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 7f7b5af..27c829e 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -4944,6 +4944,55 @@ mpt3sas_check_same_4gb_region(long reply_pool_start_address, u32 pool_sz)
> }
>
> /**
> + * base_alloc_rdpq_dma_pool - Allocating DMA'able memory
> + * for reply queues.
> + * @ioc: per adapter object
> + * @sz: DMA Pool size
> + * Return: 0 for success, non-zero for failure.
> + */
> +static int
> +base_alloc_rdpq_dma_pool(struct MPT3SAS_ADAPTER *ioc, int sz)
> +{
> + int i;
> +
> + ioc->reply_post = kcalloc((ioc->rdpq_array_enable) ?
> + (ioc->reply_queue_count):1,
> + sizeof(struct reply_post_struct), GFP_KERNEL);
Odd use of whitespaces. Also this would benefit from a little
untangling as well:
int count = ioc->rdpq_array_enable ? ioc->reply_queue_count : 1;
ioc->reply_post = kcalloc(count, sizeof(struct reply_post_struct),
GFP_KERNEL);
> +
> + if (!ioc->reply_post) {
> + ioc_err(ioc, "reply_post_free pool: kcalloc failed\n");
> + return -ENOMEM;
> + }
> + ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
> + &ioc->pdev->dev, sz, 16, 0);
> + if (!ioc->reply_post_free_dma_pool) {
> + ioc_err(ioc, "reply_post_free pool: dma_pool_create failed\n");
> + return -ENOMEM;
We normally don't print error messages for memory allocation failures,
as the allocator already prints one including a stack trace.
Same for additional allocations below.
> + } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count));
no need for the inner braces.
> + total_sz += sz * (!ioc->rdpq_array_enable ? 1 : ioc->reply_queue_count);
if (ioc->rdpq_array_enable)
total_sz += sz * ioc->reply_queue_count;
else
total_sz += sz;
next prev parent reply other threads:[~2020-04-22 6:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 13:25 [v1 0/5] mpt3sas: Fix changing coherent mask after allocation Suganath Prabu
2020-04-15 13:25 ` [v1 1/5] mpt3sas: Don't change the dma coherent mask after allocations Suganath Prabu
2020-04-22 6:34 ` Christoph Hellwig
2020-04-22 9:19 ` Suganath Prabu Subramani
2020-04-22 17:18 ` Christoph Hellwig
2020-04-15 13:25 ` [v1 2/5] mpt3sas: Rename function name is_MSB_are_same Suganath Prabu
2020-04-22 6:34 ` Christoph Hellwig
2020-04-15 13:25 ` [v1 3/5] mpt3sas: Separate out RDPQ allocation to new function Suganath Prabu
2020-04-22 6:39 ` Christoph Hellwig [this message]
2020-04-15 13:25 ` [v1 4/5] mpt3sas: Handle RDPQ DMA allocation in same 4G region Suganath Prabu
2020-04-22 6:41 ` Christoph Hellwig
2020-04-15 13:25 ` [v1 5/5] mpt3sas: Update mpt3sas version to 33.101.00.00 Suganath Prabu
2020-04-22 3:36 ` [v1 0/5] mpt3sas: Fix changing coherent mask after allocation Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422063907.GD20318@infradead.org \
--to=hch@infradead.org \
--cc=Sathya.Prakash@broadcom.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sreekanth.reddy@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.