mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Will Deacon <will@kernel.org>, Joerg Roedel <joro@8bytes.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org
Subject: Re: [PATCH 2/2] iommu/arm-smmu-v3: Simplify memory allocation
Date: Mon, 7 Feb 2022 10:56:41 +0000	[thread overview]
Message-ID: <f315aea5-b088-62ad-2234-81e8c0b13f74@arm.com> (raw)
In-Reply-To: <018afc7c92ae4132ac901b088b72ab5979256a9e.1644081032.git.christophe.jaillet@wanadoo.fr>

On 2022-02-05 17:11, Christophe JAILLET wrote:
> Use devm_bitmap_zalloc() instead of hand writing it.

Heh, that reminds me that I have more or less the same patch sat locally 
somewhere, except IIRC I took it further and removed the unhelpful error 
message and pruned the local variables as well - I think that would 
still be my preference here (or I could dig out my patch and post it if 
you like).

Cheers,
Robin.

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This is NOT compile tested.
> I don't have the needed cross compiling tools.
> ---
>   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 14d06aad0726..ba0e7f1f7dbf 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2911,12 +2911,6 @@ static int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
>   	return 0;
>   }
>   
> -static void arm_smmu_cmdq_free_bitmap(void *data)
> -{
> -	unsigned long *bitmap = data;
> -	bitmap_free(bitmap);
> -}
> -
>   static int arm_smmu_cmdq_init(struct arm_smmu_device *smmu)
>   {
>   	int ret = 0;
> @@ -2927,13 +2921,13 @@ static int arm_smmu_cmdq_init(struct arm_smmu_device *smmu)
>   	atomic_set(&cmdq->owner_prod, 0);
>   	atomic_set(&cmdq->lock, 0);
>   
> -	bitmap = (atomic_long_t *)bitmap_zalloc(nents, GFP_KERNEL);
> +	bitmap = (atomic_long_t *)devm_bitmap_zalloc(smmu->dev, nents,
> +						     GFP_KERNEL);
>   	if (!bitmap) {
>   		dev_err(smmu->dev, "failed to allocate cmdq bitmap\n");
>   		ret = -ENOMEM;
>   	} else {
>   		cmdq->valid_map = bitmap;
> -		devm_add_action(smmu->dev, arm_smmu_cmdq_free_bitmap, bitmap);
>   	}
>   
>   	return ret;

  reply	other threads:[~2022-02-07 11:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 17:10 [PATCH 1/2] iommu/arm-smmu-v3: Avoid open coded arithmetic in " Christophe JAILLET
2022-02-05 17:11 ` [PATCH 2/2] iommu/arm-smmu-v3: Simplify " Christophe JAILLET
2022-02-07 10:56   ` Robin Murphy [this message]
2022-02-07 10:26 ` [PATCH 1/2] iommu/arm-smmu-v3: Avoid open coded arithmetic in " Robin Murphy

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=f315aea5-b088-62ad-2234-81e8c0b13f74@arm.com \
    --to=robin.murphy@arm.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®