Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3120791rwe; Sun, 16 Apr 2023 12:10:24 -0700 (PDT) X-Google-Smtp-Source: AKy350b5bJwFsS2OATj1c8NYOp+HAjIM5XYDHb9CFK+JLqKoaVhNHnfwmzNR0RCNmoeQzapQaZD9 X-Received: by 2002:a17:902:f549:b0:1a6:84be:a08f with SMTP id h9-20020a170902f54900b001a684bea08fmr11141617plf.64.1681672224537; Sun, 16 Apr 2023 12:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681672224; cv=none; d=google.com; s=arc-20160816; b=yEIPQK2kH1i8IJpMr/u623/FgoVp2KI7U6LTj3V0Utb0WW/dveMvTQX39VLiJeUrA7 /X91GKtPA7OQCOVuBZ5D+yKK6ngj8uQHzGsyq1T5/gjKGryZyo3wig/MEyBWZV1Q2AFM 6U00hL1v3TEjpvuTZ9Bq9G9z09ko4EeeEbCYfjjYtZU53qLUZT7/GhVE/l1a/7QaJrms 6O//F9iDIDVFzPtprImeZq4C1kEoBJS1RnY7qWxI9ILTJOISmeEBHvo6AThk1Bu9EZXi FswJxlnwou0imemC2xhtO0XeFpN9fZqQd0D9eEjrizNARyMG+8DzIyejcnPi8voSrDy+ Fr8w== 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=IVg6fEiAUlOm4eZf7hYcoOgAhxCwgPubM+tzVphnhWA=; b=ZvFdGPfj0GCR4WPPpGFDI/JnP2yhvXt/Rvx6QFp7Hbb5gUYxpEKE6BkQrII+kp8Bom JJuxKr4zWDiKl67+vnvJv6rYzC9lQKGL+00M+xZ9Tl8HEhNel8NGtXUr4ctnbwtI4bvl 1ImTUc5vMWDm+r8GZjO2UMI4ykHdwaFMLw1rIGxREuMIE9VWdmcql4CwwzrmYp+ge3Oj RFg2d66c3aIZ75z48GVvBFodWPsqmqac8ncCSKHg3q/iLBXeJvd2N88vAXcvkAmZGNYj JK7TQsKZFHeZU7QV4Nso/YuJ7S1twGLCFWxRLh3iJU+OzIfiydmPPfN6m8lEIOSCzSgo 4WBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@orange.fr header.s=t20230301 header.b=stcSMDrg; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a170902f7c700b001a63889512csi10095304plw.135.2023.04.16.12.10.10; Sun, 16 Apr 2023 12:10:24 -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=@orange.fr header.s=t20230301 header.b=stcSMDrg; 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 S229519AbjDPTFn (ORCPT + 99 others); Sun, 16 Apr 2023 15:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjDPTFn (ORCPT ); Sun, 16 Apr 2023 15:05:43 -0400 Received: from smtp.smtpout.orange.fr (smtp-22.smtpout.orange.fr [80.12.242.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066DC1FC3 for ; Sun, 16 Apr 2023 12:05:40 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id o7gupnSP89ijuo7gupFud6; Sun, 16 Apr 2023 21:05:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1681671939; bh=IVg6fEiAUlOm4eZf7hYcoOgAhxCwgPubM+tzVphnhWA=; h=From:To:Cc:Subject:Date; b=stcSMDrgerXIwGDnWbFTpJLich5sCmokXWajyYm+hTqyDWD1ySwkL80AfExFKq7Ei bK7BYo5b4Ff1B5tdqZJ7aT4fjEPnexivEfJdFVzbqv4PvnmheT9h9rNayHAowfz+eL I7KhMpmN21W8PHSti6gf5HunswVUeua7UZMD622kE+ajo0Gx/GResTiROqKUMaLiGj ZwAFborjvoKnKsSUh7W5DzJOMwo7G3zmDosgiDOU9DO76gwcWXiXMHHNc9i1KErbXZ LM/Ozs44yreCoWTzUahIRG2KBDIzvxCOaxg6ReIfKxz3nYp08I7njdCD+HvUpjLfhM v+cg+PSIV0JPA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 16 Apr 2023 21:05:39 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-sh@vger.kernel.org Subject: [PATCH RESEND] sh: sq: Use the bitmap API when applicable Date: Sun, 16 Apr 2023 21:05:14 +0200 Message-Id: <071e9f32c19a007f4922903282c9121898641400.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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org Using the bitmap API is less verbose than hand writing them. It also improves the semantic. Signed-off-by: Christophe JAILLET --- This is a resend of [1]. Now cross-compile tested with CONFIG_CPU_SUBTYPE_SH7770=y [1]: https://lore.kernel.org/all/521788e22ad8f7a5058c154f068b061525321841.1656142814.git.christophe.jaillet@wanadoo.fr/ --- 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 = kzalloc(size, 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); } -- 2.34.1