提交 a8eba8dd 编写于 作者: C Christophe JAILLET 提交者: Nishanth Menon

soc: ti: k3-ringacc: Use devm_bitmap_zalloc() when applicable

'rings_inuse' and 'proxy_inuse' are bitmaps. So use 'devm_bitmap_zalloc()'
to simplify code and improve the semantic.
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NNishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/45544b0d97a7bea7764292852842adf5085a7700.1640276001.git.christophe.jaillet@wanadoo.fr
上级 e783362e
...@@ -1402,12 +1402,10 @@ static int k3_ringacc_init(struct platform_device *pdev, ...@@ -1402,12 +1402,10 @@ static int k3_ringacc_init(struct platform_device *pdev,
sizeof(*ringacc->rings) * sizeof(*ringacc->rings) *
ringacc->num_rings, ringacc->num_rings,
GFP_KERNEL); GFP_KERNEL);
ringacc->rings_inuse = devm_kcalloc(dev, ringacc->rings_inuse = devm_bitmap_zalloc(dev, ringacc->num_rings,
BITS_TO_LONGS(ringacc->num_rings), GFP_KERNEL);
sizeof(unsigned long), GFP_KERNEL); ringacc->proxy_inuse = devm_bitmap_zalloc(dev, ringacc->num_proxies,
ringacc->proxy_inuse = devm_kcalloc(dev, GFP_KERNEL);
BITS_TO_LONGS(ringacc->num_proxies),
sizeof(unsigned long), GFP_KERNEL);
if (!ringacc->rings || !ringacc->rings_inuse || !ringacc->proxy_inuse) if (!ringacc->rings || !ringacc->rings_inuse || !ringacc->proxy_inuse)
return -ENOMEM; return -ENOMEM;
...@@ -1483,9 +1481,8 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev, ...@@ -1483,9 +1481,8 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev,
sizeof(*ringacc->rings) * sizeof(*ringacc->rings) *
ringacc->num_rings * 2, ringacc->num_rings * 2,
GFP_KERNEL); GFP_KERNEL);
ringacc->rings_inuse = devm_kcalloc(dev, ringacc->rings_inuse = devm_bitmap_zalloc(dev, ringacc->num_rings,
BITS_TO_LONGS(ringacc->num_rings), GFP_KERNEL);
sizeof(unsigned long), GFP_KERNEL);
if (!ringacc->rings || !ringacc->rings_inuse) if (!ringacc->rings || !ringacc->rings_inuse)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册