* [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable
@ 2021-09-26 13:07 Christophe JAILLET
2021-10-07 18:02 ` Thierry Reding
2021-10-18 11:39 ` Joerg Roedel
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-09-26 13:07 UTC (permalink / raw)
To: thierry.reding, vdumpa, joro, will, jonathanh
Cc: linux-tegra, iommu, linux-kernel, kernel-janitors, Christophe JAILLET
'smmu->asids' is a bitmap. So use 'devm_kzalloc()' to simplify code,
improve the semantic of the code and avoid some open-coded arithmetic in
allocator arguments.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/iommu/tegra-smmu.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 0a281833f611..e900e3c46903 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1079,7 +1079,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
struct tegra_mc *mc)
{
struct tegra_smmu *smmu;
- size_t size;
u32 value;
int err;
@@ -1097,9 +1096,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
*/
mc->smmu = smmu;
- size = BITS_TO_LONGS(soc->num_asids) * sizeof(long);
-
- smmu->asids = devm_kzalloc(dev, size, GFP_KERNEL);
+ smmu->asids = devm_bitmap_zalloc(dev, soc->num_asids, GFP_KERNEL);
if (!smmu->asids)
return ERR_PTR(-ENOMEM);
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable
2021-09-26 13:07 [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable Christophe JAILLET
@ 2021-10-07 18:02 ` Thierry Reding
2021-10-18 11:39 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2021-10-07 18:02 UTC (permalink / raw)
To: Christophe JAILLET
Cc: vdumpa, joro, will, jonathanh, linux-tegra, iommu, linux-kernel,
kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 462 bytes --]
On Sun, Sep 26, 2021 at 03:07:18PM +0200, Christophe JAILLET wrote:
> 'smmu->asids' is a bitmap. So use 'devm_kzalloc()' to simplify code,
> improve the semantic of the code and avoid some open-coded arithmetic in
> allocator arguments.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/iommu/tegra-smmu.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable
2021-09-26 13:07 [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable Christophe JAILLET
2021-10-07 18:02 ` Thierry Reding
@ 2021-10-18 11:39 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2021-10-18 11:39 UTC (permalink / raw)
To: Christophe JAILLET
Cc: thierry.reding, vdumpa, will, jonathanh, linux-tegra, iommu,
linux-kernel, kernel-janitors
On Sun, Sep 26, 2021 at 03:07:18PM +0200, Christophe JAILLET wrote:
> 'smmu->asids' is a bitmap. So use 'devm_kzalloc()' to simplify code,
> improve the semantic of the code and avoid some open-coded arithmetic in
> allocator arguments.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/iommu/tegra-smmu.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-18 11:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 13:07 [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable Christophe JAILLET
2021-10-07 18:02 ` Thierry Reding
2021-10-18 11:39 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).