From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11011000.outbound.protection.outlook.com [52.101.52.0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 731E649690D for ; Tue, 19 May 2026 16:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.52.0 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779208273; cv=fail; b=buCTv08HtbtZLvMiArHFrHH3WQ+qAyQvEAWxYk0GPdFth9C8S/+9ADAq4YrO97gr0koXtFQhl0iRSSl9yci13hTzUiN62kW+kc3Ep7dzNf96HUADeQPs0eFBzB6TQTaD1/1DxlbK9KBXdEypJarv/lX/3obhlQAntWyGZMA7hNU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779208273; c=relaxed/simple; bh=a2S8mAxuIFSmsPFPQ4NyAXNQ/OzPHU252XRp51KD4ss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=dYjJg92/lUljq+0D9Tj/21vNAhRnsMcdNvE9vWl/3425B+z1K2jdR8jb7x5BbkpDgc+5RNr+SeggI4NaLDiEem/6QdOzuS3PO3iOCBA2SvKKYhyfoEKcDvYlyueSQ9xs2uH7dGvloEIjFHyrKuRrnqIBHQ0P9GPXpzhMn2mJQBA= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=EeWpjmai; arc=fail smtp.client-ip=52.101.52.0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="EeWpjmai" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ms9luA6SC+q4pjgSJ3Cj3T0XkFRmmMaMOvQb1yIaZb4odWGQ3WfMVZmRWQAgfsqEztqWsUbbzBvyFub3O9hJtiQjNLEbJMLcPBu4L8VtcARNEykc9mgIFoz/oEx6AkNCTGkL7pe7I6wfFEo+6mnnCKUa0oi6hg7DuYHvwPRSQd7Oc5/2/K/1cgTjeMGYVYMDhtROwiqSHrQxoUUxTsd4y7CXjnq7LrbQb56WWQOasqKIHtfIaRftjFQVZGxRnkEcRQi0UwWUWWqf11ABGFs+I9tbX2N8QwW8K/ZkA2lx1jLLFg4o8pyb+fHLaUMwGzoclR9+Sb4GyXx8Mk+RS0vAjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B+a3e/pAmABu4okmPPsBD7rGsOjP+LIXb7OVqFEjrHk=; b=f8viJRZLnudqSgqBBjs9ODD2p6pEgDnkAbHoMYCMx/ckgpBvrPFu0qmfoc25S4lJ13P6f0PH38/K+iI6jrQlTPJxDV+KFHyG66bIU7t/rWNn5xkTvf3mXj4dC9W+zEtpK+jecNaN2y0QAshrpPLBRqK3ydytuWhqFdxnawTpjFkG9MDre00fgzG0oXI9QcJ8cU0I8LhkvSk/6xfO+eweP7L0T9Lw2pTPOTio8CBVqO64W8edzp/TcmMtyTvcE3CDCslZL/ksYW+p/283ZJ5ukDnCkUROq41P5R7Vv53jcwC9HhqgSpx++PAQt2S1jELF3/Mf/4Bel7e6e4DiK44cbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B+a3e/pAmABu4okmPPsBD7rGsOjP+LIXb7OVqFEjrHk=; b=EeWpjmaiOiPrDJ6LcVqpKw9SQSpGoOF+C06r/RfiqLGGDt6k00fiif7Q1kMyhEIq63jxyVbTiceFExN4RZgTSziKKUmE+xqZXxrS8Jk7pgaxc/2VpzKVMluftecE0KZukXJ8WqA3SvB9566GC7+VE/BxAu0Ibzfdk5J7T/RJFGxv2OXsK0B1oZrHpzD8Sh+ezG1GNUNR5EvnLs3y5vQgBCUtNaUfUp5IH0zCiin+eyizhOPqz+Pv3iQeOeSvFkCuSmZ2BAclygEHcrkInjjh7VgE36gB3RNONbkkzR1plAUZmCeYi33wYP+uJkMKpXGLubHvIHjcQWAwqhTijUAmtA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY8PR12MB8300.namprd12.prod.outlook.com (2603:10b6:930:7d::16) by PH0PR12MB8800.namprd12.prod.outlook.com (2603:10b6:510:26f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.25.24; Tue, 19 May 2026 16:31:06 +0000 Received: from CY8PR12MB8300.namprd12.prod.outlook.com ([fe80::ce75:8187:3ac3:c5de]) by CY8PR12MB8300.namprd12.prod.outlook.com ([fe80::ce75:8187:3ac3:c5de%3]) with mapi id 15.21.0025.023; Tue, 19 May 2026 16:31:06 +0000 From: Yury Norov To: Yury Norov , Rasmus Villemoes , Andrew Morton , linux-kernel@vger.kernel.org Cc: Yury Norov , Thorsten Blum , Lorenzo Stoakes , "David Hildenbrand (Arm)" , Andy Shevchenko , William Kucharski Subject: [PATCH 2/2] bitmap: drop bitmap_print_to_pagebuf() Date: Tue, 19 May 2026 12:30:57 -0400 Message-ID: <20260519163058.953690-3-ynorov@nvidia.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260519163058.953690-1-ynorov@nvidia.com> References: <20260519163058.953690-1-ynorov@nvidia.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0343.namprd03.prod.outlook.com (2603:10b6:a03:39c::18) To CY8PR12MB8300.namprd12.prod.outlook.com (2603:10b6:930:7d::16) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR12MB8300:EE_|PH0PR12MB8800:EE_ X-MS-Office365-Filtering-Correlation-Id: 174ce62e-e367-4499-dbf2-08deb5c40692 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|376014|1800799024|366016|3023799003|56012099003|22082099003|18002099003|11063799006; X-Microsoft-Antispam-Message-Info: B6y8wCvkhMFXrt6EVt+3rm1JHdkk+yzJmmccE4Wp1BAT9CHwhFJZ1OzoWWjnLytg6Fq8EQ7uXDcPnF7wxb92GcT+A8mQc3FTjPMKNRyFPeFbIzBCNXh8pKFeujkijRU83SzsDtC6JvOQ0A7sPZk2otNJ1P/JhrEG2MaUGTvS+ZZl3Y0acDih9TtQBaAtoOzZLp1JNKWiXih29MefURGKqdbQzhdv3fewlOL1eIXhvMg6w1EQX7DpPFsqnTwqxTtkgCA1Yaikh0QmqvNHNA19I0f1vhiTCVyGZtwE7IhJMCYdNPBDO2/C7zISPnCKeO0Cc90kb/K/2LBOCYoFg/9GNUTis6wH7YdLuWeA6eRUZal+cyoqwA7gSBd2ArIZE1YxDoEn/apdq3HPu9sMMFsDEfLYed35GvZE4/0Qu76/SodYGaE44G7ta8qXfd+ER2efJvmbgOoRHeGuoBvm01h5GHbdwgcv7KNjs5/pFnS4YilEwEfq/klYhlw4Iy43I3JxvJgHOhWWrwpVGV1CeCExMz6U79gUfPHkb3mrIdWFL1ZNfKvtAJnGIlk1aRzv76jID0gnuKARKkuPaIWKTriIZx2AziZdYNdNL6rMbDTC6ATCDKhShEuYd5HXz+qAZSs4MqAR4yN21MJK+zgu5NNfvriEX5AByf2oimMPN+dBoXt8rTP8ZpTDK96xTQY+wCvX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR12MB8300.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(376014)(1800799024)(366016)(3023799003)(56012099003)(22082099003)(18002099003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lqrf8T08tF3pqkYeD8Y/2S+Lw5GKkLPmLkUyi/fSCLBtb/EL0aI6yjawQMKz?= =?us-ascii?Q?hDx3m+/r2TR2kpKwUEFAynWWyuGtX9sUJjrJFI7qGLMAH0B7jawSiarAbzzj?= =?us-ascii?Q?cSjeHDw/yIeR3O3NthsZpgfMiYUyLR1lL4xqnVMQQwXBfVShCg6I3Fglh9mH?= =?us-ascii?Q?qsT56Dbx/8FbyC3MkV7HxRstep3HDavWvr1W+m9V2JRcJTH1EZT5r5p3zNdv?= =?us-ascii?Q?V4qJtWttp9cVT1vXw7wW/m3+38PLu8Ujlu0tUgub/PO+05n4V8HswUN+GC04?= =?us-ascii?Q?jm60+tGSIgFdVsAPafxprVvu8BbuN8Il5fzG6VHjPYqmYOjYzTa4Yo7pr6r9?= =?us-ascii?Q?zgSVfPMNkL8+DS4CFchbT8f09NaBtAZWQAPQyAKrUbdC3Ph5l1Pu07Zjiv2B?= =?us-ascii?Q?Eg9arnEIIhTvUicmdtaSL4zZNR+ofek/wfAw5D4YX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JQbXDsKrb0jnlvgjSvIiPgGcDIPOGgCobCsVk?= =?us-ascii?Q?H+N2xMo9rSI0SIsnOWzKRg6oChhYa893FBnrwp5N2KGjHjUrLbom8xQ3vtpM?= =?us-ascii?Q?PA8PI8Z6oxMsZMC3KHZ7dqCPIP0+19ntECJxTuA0zl9/shy66/j8DY02bHFa?= =?us-ascii?Q?oa3nIn34l7TyH/MUdC/23ISqxSWjMyGY14z5oX+geqxii4lz0axJqeRXGqW6?= =?us-ascii?Q?ThcjAsocKF7f50k3gNdpmKYK+eIp1ttFvKBIxJ3Xu8u32IPmqEr05RUDJBCx?= =?us-ascii?Q?5h7JdafFBwfL33a8kraCjy6Cmm8Nqbp0zuPJlAp5u17vHOSvvfGyGorFnWgl?= =?us-ascii?Q?/LjJNJR4qNzOIo2xXFkQ6/jkT+5VjXyeHyDdoxqozXp9WhnaA4lq2weo35za?= =?us-ascii?Q?VonlWfzaX2BzbCKlBV1zD/FfkQe4GllWIT8ydn+PRccdUlFe3i1E?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 174ce62e-e367-4499-dbf2-08deb5c40692 X-MS-Exchange-CrossTenant-AuthSource: CY8PR12MB8300.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2026 16:31:06.4521 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pNN5ClTCE3wdV/EAxdY+b2bf1e1DoFU39xVvR6VtfJ/Zy26pV4LNLCfQr1zxvgK1Z6Gbx4VhbYS0DoVUvm0meg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8800 Now that all users of bitmap_print_to_pagebuf() are switched to the alternatives, drop the function. Signed-off-by: Yury Norov --- include/linux/bitmap-str.h | 1 - lib/bitmap-str.c | 42 +++++--------------------------------- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/include/linux/bitmap-str.h b/include/linux/bitmap-str.h index 53d3e1b32d3d..abe7a69a846f 100644 --- a/include/linux/bitmap-str.h +++ b/include/linux/bitmap-str.h @@ -5,7 +5,6 @@ #include int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, unsigned long *dst, int nbits); -int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, int nmaskbits); int bitmap_print_bitmask_to_buf(char *buf, const unsigned long *maskp, int nmaskbits, loff_t off, size_t count); int bitmap_print_list_to_buf(char *buf, const unsigned long *maskp, int nmaskbits, diff --git a/lib/bitmap-str.c b/lib/bitmap-str.c index be745209507a..bbdb2e9ff2c2 100644 --- a/lib/bitmap-str.c +++ b/lib/bitmap-str.c @@ -39,32 +39,6 @@ int bitmap_parse_user(const char __user *ubuf, } EXPORT_SYMBOL(bitmap_parse_user); -/** - * bitmap_print_to_pagebuf - convert bitmap to list or hex format ASCII string - * @list: indicates whether the bitmap must be list - * @buf: page aligned buffer into which string is placed - * @maskp: pointer to bitmap to convert - * @nmaskbits: size of bitmap, in bits - * - * Output format is a comma-separated list of decimal numbers and - * ranges if list is specified or hex digits grouped into comma-separated - * sets of 8 digits/set. Returns the number of characters written to buf. - * - * It is assumed that @buf is a pointer into a PAGE_SIZE, page-aligned - * area and that sufficient storage remains at @buf to accommodate the - * bitmap_print_to_pagebuf() output. Returns the number of characters - * actually printed to @buf, excluding terminating '\0'. - */ -int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, - int nmaskbits) -{ - ptrdiff_t len = PAGE_SIZE - offset_in_page(buf); - - return list ? scnprintf(buf, len, "%*pbl\n", nmaskbits, maskp) : - scnprintf(buf, len, "%*pb\n", nmaskbits, maskp); -} -EXPORT_SYMBOL(bitmap_print_to_pagebuf); - /** * bitmap_print_to_buf - convert bitmap to list or hex format ASCII string * @list: indicates whether the bitmap must be list @@ -101,7 +75,7 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp, * @off: in the string from which we are copying, We copy to @buf * @count: the maximum number of bytes to print * - * The bitmap_print_to_pagebuf() is used indirectly via its cpumap wrapper + * The sprintf("%*pb[l]") is used indirectly via its cpumap wrapper * cpumap_print_to_pagebuf() or directly by drivers to export hexadecimal * bitmask and decimal list to userspace by sysfs ABI. * Drivers might be using a normal attribute for this kind of ABIs. A @@ -111,18 +85,11 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp, * struct device_attribute *attr, char *buf) * { * ... - * return bitmap_print_to_pagebuf(true, buf, &mask, nr_trig_max); + * return scnprintf(buf, PAGE_SIZE - offset_in_page(buf), nr_trig_max, &mask); * } * * show entry of attribute has no offset and count parameters and this * means the file is limited to one page only. - * bitmap_print_to_pagebuf() API works terribly well for this kind of - * normal attribute with buf parameter and without offset, count:: - * - * bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, - * int nmaskbits) - * { - * } * * The problem is once we have a large bitmap, we have a chance to get a * bitmask or list more than one page. Especially for list, it could be @@ -149,7 +116,7 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp, * * The role of cpumap_print_bitmask_to_buf() and cpumap_print_list_to_buf() * is similar with cpumap_print_to_pagebuf(), the difference is that - * bitmap_print_to_pagebuf() mainly serves sysfs attribute with the assumption + * scnprintf("%*pb[l]") mainly serves sysfs attribute with the assumption * the destination buffer is exactly one page and won't be more than one page. * cpumap_print_bitmask_to_buf() and cpumap_print_list_to_buf(), on the other * hand, mainly serves bin_attribute which doesn't work with exact one page, @@ -158,7 +125,8 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp, * * WARNING! * - * This function is not a replacement for sprintf() or bitmap_print_to_pagebuf(). + * This function is not a replacement for sprintf(). + * * It is intended to workaround sysfs limitations discussed above and should be * used carefully in general case for the following reasons: * -- 2.51.0