summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-07-04 22:31:51 +0200
committerThierry Reding <treding@nvidia.com>2022-07-08 17:38:34 +0200
commit2e1bfb314c99de2f7b9c8280408316ad2f316de9 (patch)
treeda701c676f9f94b3897d63e8cf9195b6ab923951 /drivers
parent8c92243d9e68a93dd282fa2151b67b5c0e31e957 (diff)
downloadlwn-2e1bfb314c99de2f7b9c8280408316ad2f316de9.tar.gz
lwn-2e1bfb314c99de2f7b9c8280408316ad2f316de9.zip
gpu: host1x: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. While at it, remove a useless bitmap_zero() call. The bitmap is already zero'ed when allocated. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/host1x/channel.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/gpu/host1x/channel.c b/drivers/gpu/host1x/channel.c
index 2a9a3a8d5931..2d0051d6314c 100644
--- a/drivers/gpu/host1x/channel.c
+++ b/drivers/gpu/host1x/channel.c
@@ -21,22 +21,18 @@ int host1x_channel_list_init(struct host1x_channel_list *chlist,
if (!chlist->channels)
return -ENOMEM;
- chlist->allocated_channels =
- kcalloc(BITS_TO_LONGS(num_channels), sizeof(unsigned long),
- GFP_KERNEL);
+ chlist->allocated_channels = bitmap_zalloc(num_channels, GFP_KERNEL);
if (!chlist->allocated_channels) {
kfree(chlist->channels);
return -ENOMEM;
}
- bitmap_zero(chlist->allocated_channels, num_channels);
-
return 0;
}
void host1x_channel_list_free(struct host1x_channel_list *chlist)
{
- kfree(chlist->allocated_channels);
+ bitmap_free(chlist->allocated_channels);
kfree(chlist->channels);
}