Message ID | a51e9f32c19a007f4922943282cb12c89064440d.1681671848.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp573365vqo; Thu, 20 Apr 2023 12:43:45 -0700 (PDT) X-Google-Smtp-Source: AKy350bDThjRGsftJrE4Xr2er31Uu0zFM4HORtzt0YOQvMF9Zln7XSsC5PdnZ6WZA97NOaEnvqk9 X-Received: by 2002:a05:6a00:1796:b0:634:7ba3:d140 with SMTP id s22-20020a056a00179600b006347ba3d140mr3313544pfg.15.1682019824838; Thu, 20 Apr 2023 12:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682019824; cv=none; d=google.com; s=arc-20160816; b=yqa0vYvIr1EUiQ6c+Z5+2/znNqejk++qk5Ct0TIfnWP9RXyppKOzEpIjhCwX8epSsh 4mvBxWv5UEzGl5WxjErGOTvEZEmBHH4EBSeWh4KXix9xiz63jh0WL/c+q26QOnab5tVv 7+Mhldc9S33PqODT/Yryy228wb9nxewHeIIrazlMA6G+ZG8yJq7fSaNoAVi078Qjs8Q9 HUXGJYpdSqKXzayujNxFMmXYWQUQZQ8jUiLdcHQy1EKCZAvMDkUbHreXwSZzoGB+5J0o EcyX7XiS85VMJfKwICOxtRTQ8hy2zKLFKu0Bix5QMXMts7SpxmcTXCEhs+pheIA0Syjq 3PEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xEO8CI9H9WDO+PWu0PIXBsB8fTZqe2/3Shi9OjFKgUE=; b=sfq2BTxn/rpa0m7yrLSBnD3fS/cUe3yq9s+NmTE3hhVBVOd4bgcF81dD9dAbJTpeqZ rVxKUekpOH/LpAeU819pFJPq7N2sr0s/JmCMOveVoJAjxyldHsj99REnD+Looks+I5C1 o/SJTUZ4J1jkcp3IgvAiADr4AWi6FTbxXBMFm0XbdnuFRDWMx100TifxmKczZh4fYotI ZQPfHz8WtmagIX1CKWzJqTILxUJzxUwhQtw8BoBrDmjlUqbST7QgME/ENskCtvoHRLwm lakLHM1GikMgdq2A1i4Wda18BeDmpVcXjkTbSwH6ED7jsU0z9ARiOz7qb8b0Qdx7XIkt TQEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=d7DupFV1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 186-20020a6300c3000000b0051b8ab93411si2123508pga.767.2023.04.20.12.43.32; Thu, 20 Apr 2023 12:43:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=d7DupFV1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbjDTTTa (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Thu, 20 Apr 2023 15:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231954AbjDTTTZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Apr 2023 15:19:25 -0400 Received: from smtp.smtpout.orange.fr (smtp-11.smtpout.orange.fr [80.12.242.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E8B755B8 for <linux-kernel@vger.kernel.org>; Thu, 20 Apr 2023 12:19:08 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id pZo7pjZIVLbpDpZo8pVyl8; Thu, 20 Apr 2023 21:19:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682018345; bh=xEO8CI9H9WDO+PWu0PIXBsB8fTZqe2/3Shi9OjFKgUE=; h=From:To:Cc:Subject:Date; b=d7DupFV1mk554xgT7ZmeBZ2PilYiuqaqFgfYq0DWlJN6USgDG1I1rM+fUGT1I363i O6Rw+b7pIRwd+G7hHsbBPvD9a0gZyfvMFh5utXc3AgnRd6snMLZXdBEl3SAZ9jH1N/ PTCrhMoNKF1fojEC6NgjF+l/Y+meLDIoemkomHDNCrAPIpYYnyV0SZFyHm7w4KDV/S ZBzejECVQ4bEAMlYRl6Yc5LKHSUvXbvYUiEzsKf+WSk8t8W8XPosEqA0iSLF9xAqn+ IkSAonHcDssNK8l5dglnOu4/0H6AJnvH7OyGZYElA122UtSW2eSe/CrrSE+rUgEbFB tb5Hu+LNwIv+w== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 20 Apr 2023 21:19:05 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-sh@vger.kernel.org Subject: [PATCH v2] sh: sq: Use the bitmap API when applicable Date: Thu, 20 Apr 2023 21:19:03 +0200 Message-Id: <a51e9f32c19a007f4922943282cb12c89064440d.1681671848.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763725619666682116?= X-GMAIL-MSGID: =?utf-8?q?1763725619666682116?= |
Series |
[v2] sh: sq: Use the bitmap API when applicable
|
|
Commit Message
Christophe JAILLET
April 20, 2023, 7:19 p.m. UTC
Using the bitmap API is less verbose than hand writing it.
It also improves the semantic.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2:
- synch with latest linux-next because of 80f746e2bd0e which fixes a bug
---
arch/sh/kernel/cpu/sh4/sq.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Comments
On Thu, Apr 20, 2023 at 9:41 PM Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > Using the bitmap API is less verbose than hand writing it. > It also improves the semantic. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > v2: > - synch with latest linux-next because of 80f746e2bd0e which fixes a bug Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert
On Thu, 2023-04-20 at 21:19 +0200, Christophe JAILLET wrote: > Using the bitmap API is less verbose than hand writing it. > It also improves the semantic. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > v2: > - synch with latest linux-next because of 80f746e2bd0e which fixes a bug > --- > arch/sh/kernel/cpu/sh4/sq.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c > index 27f2e3da5aa2..d289e99dc118 100644 > --- a/arch/sh/kernel/cpu/sh4/sq.c > +++ b/arch/sh/kernel/cpu/sh4/sq.c > @@ -372,7 +372,6 @@ static struct subsys_interface sq_interface = { > static int __init sq_api_init(void) > { > unsigned int nr_pages = 0x04000000 >> PAGE_SHIFT; > - unsigned int size = (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG; > int ret = -ENOMEM; > > printk(KERN_NOTICE "sq: Registering store queue API.\n"); > @@ -382,7 +381,7 @@ static int __init sq_api_init(void) > if (unlikely(!sq_cache)) > return ret; > > - sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL); > + sq_bitmap = bitmap_zalloc(nr_pages, GFP_KERNEL); > if (unlikely(!sq_bitmap)) > goto out; > > @@ -393,7 +392,7 @@ static int __init sq_api_init(void) > return 0; > > out: > - kfree(sq_bitmap); > + bitmap_free(sq_bitmap); > kmem_cache_destroy(sq_cache); > > return ret; > @@ -402,7 +401,7 @@ static int __init sq_api_init(void) > static void __exit sq_api_exit(void) > { > subsys_interface_unregister(&sq_interface); > - kfree(sq_bitmap); > + bitmap_free(sq_bitmap); > kmem_cache_destroy(sq_cache); > } > Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
On Thu, 2023-04-20 at 21:19 +0200, Christophe JAILLET wrote: > Using the bitmap API is less verbose than hand writing it. > It also improves the semantic. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > v2: > - synch with latest linux-next because of 80f746e2bd0e which fixes a bug > --- > arch/sh/kernel/cpu/sh4/sq.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c > index 27f2e3da5aa2..d289e99dc118 100644 > --- a/arch/sh/kernel/cpu/sh4/sq.c > +++ b/arch/sh/kernel/cpu/sh4/sq.c > @@ -372,7 +372,6 @@ static struct subsys_interface sq_interface = { > static int __init sq_api_init(void) > { > unsigned int nr_pages = 0x04000000 >> PAGE_SHIFT; > - unsigned int size = (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG; > int ret = -ENOMEM; > > printk(KERN_NOTICE "sq: Registering store queue API.\n"); > @@ -382,7 +381,7 @@ static int __init sq_api_init(void) > if (unlikely(!sq_cache)) > return ret; > > - sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL); > + sq_bitmap = bitmap_zalloc(nr_pages, GFP_KERNEL); > if (unlikely(!sq_bitmap)) > goto out; > > @@ -393,7 +392,7 @@ static int __init sq_api_init(void) > return 0; > > out: > - kfree(sq_bitmap); > + bitmap_free(sq_bitmap); > kmem_cache_destroy(sq_cache); > > return ret; > @@ -402,7 +401,7 @@ static int __init sq_api_init(void) > static void __exit sq_api_exit(void) > { > subsys_interface_unregister(&sq_interface); > - kfree(sq_bitmap); > + bitmap_free(sq_bitmap); > kmem_cache_destroy(sq_cache); > } > Applied to my for-next branch for 6.4. Thanks, Adrian
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index 27f2e3da5aa2..d289e99dc118 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c @@ -372,7 +372,6 @@ static struct subsys_interface sq_interface = { static int __init sq_api_init(void) { unsigned int nr_pages = 0x04000000 >> PAGE_SHIFT; - unsigned int size = (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG; int ret = -ENOMEM; printk(KERN_NOTICE "sq: Registering store queue API.\n"); @@ -382,7 +381,7 @@ static int __init sq_api_init(void) if (unlikely(!sq_cache)) return ret; - sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL); + sq_bitmap = bitmap_zalloc(nr_pages, GFP_KERNEL); if (unlikely(!sq_bitmap)) goto out; @@ -393,7 +392,7 @@ static int __init sq_api_init(void) return 0; out: - kfree(sq_bitmap); + bitmap_free(sq_bitmap); kmem_cache_destroy(sq_cache); return ret; @@ -402,7 +401,7 @@ static int __init sq_api_init(void) static void __exit sq_api_exit(void) { subsys_interface_unregister(&sq_interface); - kfree(sq_bitmap); + bitmap_free(sq_bitmap); kmem_cache_destroy(sq_cache); }