From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42FAAC27C4F for ; Thu, 13 Jun 2024 16:09:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9BEEF211D; Thu, 13 Jun 2024 18:08:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9BEEF211D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718294941; bh=jqzyU34fAZG4/WHYtSv7WuekoSVYXVRfGb6ve0icGKI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lGDPq4u5ghQiwCFbutS1RQAaVX0VnZD8qXpBQ85eLvq4BOYo2D+jifu2QX6lMemZk ADxl0hhAISUtI8VoFzh19g7ud01hMxgW8NLgJNgwnBZEDmKrC5cpilm3NTSb3AEBZg jP9pSABBDW8OakYpY0BOUXnieutJM3OJ1WKHM0Y8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id F2AD9F89751; Thu, 13 Jun 2024 18:02:53 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 60CD0F89751; Thu, 13 Jun 2024 18:02:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4EA2FF802DB; Tue, 4 Jun 2024 17:53:46 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9B6ACF80088 for ; Tue, 4 Jun 2024 17:53:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9B6ACF80088 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 861766134B; Tue, 4 Jun 2024 15:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D41BC2BBFC; Tue, 4 Jun 2024 15:52:38 +0000 (UTC) Date: Tue, 4 Jun 2024 11:52:35 -0400 From: Steven Rostedt To: Jani Nikula Cc: Andy Shevchenko , "Rafael J. Wysocki" , Greg Kroah-Hartman , Corey Minyard , Allen Pais , Sebastian Reichel , Perry Yuan , Giovanni Cabiddu , Herbert Xu , Nuno Sa , Guenter Roeck , Randy Dunlap , Andi Shyti , Heiner Kallweit , Lee Jones , Samuel Holland , Elad Nachman , Arseniy Krasnov , Johannes Berg , Gregory Greenman , Benjamin Berg , Bjorn Helgaas , Robert Richter , Vinod Koul , Chunfeng Yun , Linus Walleij , Hans de Goede , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , Nikita Kravets , Jiri Slaby , Srinivas Pandruvada , Stanley Chang , Heikki Krogerus , Abdel Alkuor , Kent Overstreet , Eric Biggers , Kees Cook , Ingo Molnar , Daniel Bristot de Oliveira , Andrew Morton , Hugh Dickins , Abel Wu , John Johansen , Mimi Zohar , Stefan Berger , Roberto Sassu , Eric Snowberg , Takashi Iwai , Takashi Sakamoto , Jiapeng Chong , Mark Brown , Kuninori Morimoto , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-acpi@vger.kernel.org, linux-ide@vger.kernel.org, openipmi-developer@lists.sourceforge.net, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, qat-linux@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org, linux-leds@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-hardening@vger.kernel.org, cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Howells , "David S. Miller" , "Rafael J. Wysocki" , Len Brown , Sergey Shtylyov , Damien Le Moal , Niklas Cassel , Daniel Scally , Sakari Ailus , Michael Turquette , Stephen Boyd , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Heiko Stuebner , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , Viresh Kumar , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Karol Herbst , Lyude Paul , Danilo Krummrich , Jean Delvare , Alexander Shishkin , Pavel Machek , Chen-Yu Tsai , Jernej Skrabec , Tony Lindgren , Adrian Hunter , Hu Ziji , Ulf Hansson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Potnuri Bharat Teja , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Miri Korenblit , Kalle Valo , Mahesh J Salgaonkar , Oliver O'Halloran , Kishon Vijay Abraham I , Matthias Brugger , AngeloGioacchino Del Regno , JC Kuo , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Sebastian Reichel , Daniel Lezcano , Zhang Rui , Lukasz Luba , Thinh Nguyen , Helge Deller , Brian Foster , Zhihao Cheng , Tejun Heo , Zefan Li , Johannes Weiner , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Masami Hiramatsu , Mathieu Desnoyers , Jason Baron , Jim Cromie , Paul Moore , James Morris , "Serge E. Hallyn" , Dmitry Kasatkin , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Linus Torvalds Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Message-ID: <20240604115235.044acfd6@gandalf.local.home> In-Reply-To: <87tti9cfry.fsf@intel.com> References: <20240603211538.289765-1-andriy.shevchenko@linux.intel.com> <87tti9cfry.fsf@intel.com> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-MailFrom: SRS0=dfpp=NG=goodmis.org=rostedt@kernel.org X-Mailman-Rule-Hits: max-recipients X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-size; news-moderation; no-subject; digests; suspicious-header Message-ID-Hash: 4CEUTDMZTEIPSYGTPIOUYKOJBXW5UKF4 X-Message-ID-Hash: 4CEUTDMZTEIPSYGTPIOUYKOJBXW5UKF4 X-Mailman-Approved-At: Thu, 13 Jun 2024 16:02:36 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 04 Jun 2024 10:45:37 +0300 Jani Nikula wrote: > On Sun, 02 Jun 2024, Andy Shevchenko wrote: > > Make two APIs look similar. Hence convert match_string() to be > > a 2-argument macro. In order to avoid unneeded churn, convert > > all users as well. There is no functional change intended. > > Why do we think it's a good idea to increase and normalize the use of > double-underscore function names across the kernel, like > __match_string() in this case? It should mean "reserved for the > implementation, not to be called directly". > > If it's to be used directly, it should be named accordingly, right? > > Being in line with __sysfs_match_string() isn't a great argument alone, > because this adds three times the number of __match_string() calls than > there are __sysfs_match_string() calls. It's not a good model to follow. > Arguably both should be renamed. Agreed. I want to get rid of any functions starting with an underscore except for those that are basically the same function used internally for convenience. Perhaps "match_string_dynamic()"? Where it is used for dynamically allocated arrays without known size. Or, allow a third parameter for dynamic arrays. #define match_string(_a, _s, ...) char _______STR[] = __stringify((__VA_ARGS__)); \ if (sizeof(_______STR) > 3) \ __match_string(_a, _s, ##__VA_ARGS__); \ else \ __match_string(_a, _s, ARRAY_SIZE(_a)); What the above stringify((__VA_ARGS__)) does is to check the size of any args added to match_string(). if there isn't any, it will turn into: "()\0", which is of size 3. If you add an argument, it will be: "()\0", which will have a size greater than three. (trace_printk() does this trick in include/linux/kernel.h). This way, both: match_string(array, sting); or match_string(array, string, size); will work. -- Steve From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F40ECC25B78 for ; Tue, 4 Jun 2024 15:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PkkOVWF66v1GGhB0++TOAEkPoaT8q5KFTETt2Mw1M54=; b=qVIPCzDp/c2F4x AioO6YklDcc+JIw4mCERsHhvsb9SUACs2NOLrKwpft5/h/0y7WF/aukXanP/JRrKmI3LLI2oXOEAM dn4De6XblDZPi9i0GcVaXKhZ9U6BVqjdf4JnGjx6wDPXq/Xn7dIcvQoKP3PMbG39and8qkat4+svR C6/FTtid+afNpoF1itxY62HPDv8K+qHaXHVbhkkOvShYSytCiwBFk8aZad+kXe/3vHi20UFlB1PoY ExLGUA1Yk5ZoGuKhjIyhx238UXnN69NMx4k6QDCK9bkdvfbQJa3MgS9Ap5SUFulkBkYMqoGKkurmg ij1y3e9O21eATMnOXAjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEWTc-000000030xs-0SlT; Tue, 04 Jun 2024 15:53:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEWTW-000000030ul-3L9x; Tue, 04 Jun 2024 15:53:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8618E6134C; Tue, 4 Jun 2024 15:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D41BC2BBFC; Tue, 4 Jun 2024 15:52:38 +0000 (UTC) Date: Tue, 4 Jun 2024 11:52:35 -0400 From: Steven Rostedt To: Jani Nikula Cc: Andy Shevchenko , "Rafael J. Wysocki" , Greg Kroah-Hartman , Corey Minyard , Allen Pais , Sebastian Reichel , Perry Yuan , Giovanni Cabiddu , Herbert Xu , Nuno Sa , Guenter Roeck , Randy Dunlap , Andi Shyti , Heiner Kallweit , Lee Jones , Samuel Holland , Elad Nachman , Arseniy Krasnov , Johannes Berg , Gregory Greenman , Benjamin Berg , Bjorn Helgaas , Robert Richter , Vinod Koul , Chunfeng Yun , Linus Walleij , Hans de Goede , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , Nikita Kravets , Jiri Slaby , Srinivas Pandruvada , Stanley Chang , Heikki Krogerus , Abdel Alkuor , Kent Overstreet , Eric Biggers , Kees Cook , Ingo Molnar , Daniel Bristot de Oliveira , Andrew Morton , Hugh Dickins , Abel Wu , John Johansen , Mimi Zohar , Stefan Berger , Roberto Sassu , Eric Snowberg , Takashi Iwai , Takashi Sakamoto , Jiapeng Chong , Mark Brown , Kuninori Morimoto , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-acpi@vger.kernel.org, linux-ide@vger.kernel.org, openipmi-developer@lists.sourceforge.net, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, qat-linux@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org, linux-leds@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-hardening@vger.kernel.org, cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Howells , "David S. Miller" , "Rafael J. Wysocki" , Len Brown , Sergey Shtylyov , Damien Le Moal , Niklas Cassel , Daniel Scally , Sakari Ailus , Michael Turquette , Stephen Boyd , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Heiko Stuebner , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , Viresh Kumar , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Karol Herbst , Lyude Paul , Danilo Krummrich , Jean Delvare , Alexander Shishkin , Pavel Machek , Chen-Yu Tsai , Jernej Skrabec , Tony Lindgren , Adrian Hunter , Hu Ziji , Ulf Hansson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Potnuri Bharat Teja , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Miri Korenblit , Kalle Valo , Mahesh J Salgaonkar , Oliver O'Halloran , Kishon Vijay Abraham I , Matthias Brugger , AngeloGioacchino Del Regno , JC Kuo , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Sebastian Reichel , Daniel Lezcano , Zhang Rui , Lukasz Luba , Thinh Nguyen , Helge Deller , Brian Foster , Zhihao Cheng , Tejun Heo , Zefan Li , Johannes Weiner , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Masami Hiramatsu , Mathieu Desnoyers , Jason Baron , Jim Cromie , Paul Moore , James Morris , "Serge E. Hallyn" , Dmitry Kasatkin , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Linus Torvalds Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Message-ID: <20240604115235.044acfd6@gandalf.local.home> In-Reply-To: <87tti9cfry.fsf@intel.com> References: <20240603211538.289765-1-andriy.shevchenko@linux.intel.com> <87tti9cfry.fsf@intel.com> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_085326_943913_D5AAE3F9 X-CRM114-Status: GOOD ( 26.35 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Tue, 04 Jun 2024 10:45:37 +0300 Jani Nikula wrote: > On Sun, 02 Jun 2024, Andy Shevchenko wrote: > > Make two APIs look similar. Hence convert match_string() to be > > a 2-argument macro. In order to avoid unneeded churn, convert > > all users as well. There is no functional change intended. > > Why do we think it's a good idea to increase and normalize the use of > double-underscore function names across the kernel, like > __match_string() in this case? It should mean "reserved for the > implementation, not to be called directly". > > If it's to be used directly, it should be named accordingly, right? > > Being in line with __sysfs_match_string() isn't a great argument alone, > because this adds three times the number of __match_string() calls than > there are __sysfs_match_string() calls. It's not a good model to follow. > Arguably both should be renamed. Agreed. I want to get rid of any functions starting with an underscore except for those that are basically the same function used internally for convenience. Perhaps "match_string_dynamic()"? Where it is used for dynamically allocated arrays without known size. Or, allow a third parameter for dynamic arrays. #define match_string(_a, _s, ...) char _______STR[] = __stringify((__VA_ARGS__)); \ if (sizeof(_______STR) > 3) \ __match_string(_a, _s, ##__VA_ARGS__); \ else \ __match_string(_a, _s, ARRAY_SIZE(_a)); What the above stringify((__VA_ARGS__)) does is to check the size of any args added to match_string(). if there isn't any, it will turn into: "()\0", which is of size 3. If you add an argument, it will be: "()\0", which will have a size greater than three. (trace_printk() does this trick in include/linux/kernel.h). This way, both: match_string(array, sting); or match_string(array, string, size); will work. -- Steve ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99CBBC25B76 for ; Wed, 5 Jun 2024 04:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dv+XxTNiVgSqEFjHKTmIJtTOtVBd1ssL2/00xs3o67U=; b=BWZzPU1qFS/y3g hibJ44zLpAOohfEIrzrq62Ndq9mszBfgCzAbh0T4uzr4KjI7XUUVt9bnLwHlQsQavxG6HcNohENQ8 u/JvtzNJuBP2AzpnCyZq8qkrD9cFDryPmPEiMOI4yWh1hbx3DBen2haDJSOwJe8798dKYza/QHACL /Xnyv+AQ1w7qqjsZzk1VB7yX13r93+ailnv1dYc8wkQX7PufA9+GrZI/yxvSla/h3RHHDMIJZTJ3R Iqdc2qdc5pkdmJXiqiV8mbo/iFDDSDZ3llo4Zu8k9Gn/u3AuSX4AxCL20bGPE6DdGK9iXtbzP59es lCTtuXFdICdhaaT1wszw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEiYn-00000004d2t-0i1p; Wed, 05 Jun 2024 04:47:41 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEWTW-000000030ul-3L9x; Tue, 04 Jun 2024 15:53:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8618E6134C; Tue, 4 Jun 2024 15:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D41BC2BBFC; Tue, 4 Jun 2024 15:52:38 +0000 (UTC) Date: Tue, 4 Jun 2024 11:52:35 -0400 From: Steven Rostedt To: Jani Nikula Cc: Andy Shevchenko , "Rafael J. Wysocki" , Greg Kroah-Hartman , Corey Minyard , Allen Pais , Sebastian Reichel , Perry Yuan , Giovanni Cabiddu , Herbert Xu , Nuno Sa , Guenter Roeck , Randy Dunlap , Andi Shyti , Heiner Kallweit , Lee Jones , Samuel Holland , Elad Nachman , Arseniy Krasnov , Johannes Berg , Gregory Greenman , Benjamin Berg , Bjorn Helgaas , Robert Richter , Vinod Koul , Chunfeng Yun , Linus Walleij , Hans de Goede , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , Nikita Kravets , Jiri Slaby , Srinivas Pandruvada , Stanley Chang , Heikki Krogerus , Abdel Alkuor , Kent Overstreet , Eric Biggers , Kees Cook , Ingo Molnar , Daniel Bristot de Oliveira , Andrew Morton , Hugh Dickins , Abel Wu , John Johansen , Mimi Zohar , Stefan Berger , Roberto Sassu , Eric Snowberg , Takashi Iwai , Takashi Sakamoto , Jiapeng Chong , Mark Brown , Kuninori Morimoto , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-acpi@vger.kernel.org, linux-ide@vger.kernel.org, openipmi-developer@lists.sourceforge.net, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, qat-linux@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org, linux-leds@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-hardening@vger.kernel.org, cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Howells , "David S. Miller" , "Rafael J. Wysocki" , Len Brown , Sergey Shtylyov , Damien Le Moal , Niklas Cassel , Daniel Scally , Sakari Ailus , Michael Turquette , Stephen Boyd , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Heiko Stuebner , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , Viresh Kumar , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Karol Herbst , Lyude Paul , Danilo Krummrich , Jean Delvare , Alexander Shishkin , Pavel Machek , Chen-Yu Tsai , Jernej Skrabec , Tony Lindgren , Adrian Hunter , Hu Ziji , Ulf Hansson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Potnuri Bharat Teja , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Miri Korenblit , Kalle Valo , Mahesh J Salgaonkar , Oliver O'Halloran , Kishon Vijay Abraham I , Matthias Brugger , AngeloGioacchino Del Regno , JC Kuo , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Sebastian Reichel , Daniel Lezcano , Zhang Rui , Lukasz Luba , Thinh Nguyen , Helge Deller , Brian Foster , Zhihao Cheng , Tejun Heo , Zefan Li , Johannes Weiner , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Masami Hiramatsu , Mathieu Desnoyers , Jason Baron , Jim Cromie , Paul Moore , James Morris , "Serge E. Hallyn" , Dmitry Kasatkin , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Linus Torvalds Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Message-ID: <20240604115235.044acfd6@gandalf.local.home> In-Reply-To: <87tti9cfry.fsf@intel.com> References: <20240603211538.289765-1-andriy.shevchenko@linux.intel.com> <87tti9cfry.fsf@intel.com> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_085326_943913_D5AAE3F9 X-CRM114-Status: GOOD ( 26.35 ) X-Mailman-Approved-At: Tue, 04 Jun 2024 21:47:39 -0700 X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On Tue, 04 Jun 2024 10:45:37 +0300 Jani Nikula wrote: > On Sun, 02 Jun 2024, Andy Shevchenko wrote: > > Make two APIs look similar. Hence convert match_string() to be > > a 2-argument macro. In order to avoid unneeded churn, convert > > all users as well. There is no functional change intended. > > Why do we think it's a good idea to increase and normalize the use of > double-underscore function names across the kernel, like > __match_string() in this case? It should mean "reserved for the > implementation, not to be called directly". > > If it's to be used directly, it should be named accordingly, right? > > Being in line with __sysfs_match_string() isn't a great argument alone, > because this adds three times the number of __match_string() calls than > there are __sysfs_match_string() calls. It's not a good model to follow. > Arguably both should be renamed. Agreed. I want to get rid of any functions starting with an underscore except for those that are basically the same function used internally for convenience. Perhaps "match_string_dynamic()"? Where it is used for dynamically allocated arrays without known size. Or, allow a third parameter for dynamic arrays. #define match_string(_a, _s, ...) char _______STR[] = __stringify((__VA_ARGS__)); \ if (sizeof(_______STR) > 3) \ __match_string(_a, _s, ##__VA_ARGS__); \ else \ __match_string(_a, _s, ARRAY_SIZE(_a)); What the above stringify((__VA_ARGS__)) does is to check the size of any args added to match_string(). if there isn't any, it will turn into: "()\0", which is of size 3. If you add an argument, it will be: "()\0", which will have a size greater than three. (trace_printk() does this trick in include/linux/kernel.h). This way, both: match_string(array, sting); or match_string(array, string, size); will work. -- Steve -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F2D4CCD1AA for ; Mon, 20 Oct 2025 12:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CCC7RwLuud7nG91V9tHCc7koPxVzvXG6Gj3rAZsu8Zs=; b=ZRaW1sh/TS8eBZ lMCo7XurPOkWbR+yz7BGOxVaRwyMWRopmVmgmDHYyrE9Z60S5JbrnNAclps1Psw/ASN4SSTgpLUtk vCvuqE/RzOX+jLfNWHynsSBofUNpgWHcMstlqFWzDOlPtjRVBQlAgsaD4ohzeMHGS7uatBvYL908p dOib8JgsgwRAnOc+lV9M4i+bhKyF05qEQdkyOVewtNCdePpIwbpJRKvKIKzpmUc5EF0RT1vtZzAac JlT6sB9sf7UxCcX+ZFZxL7m6H2EsfWz6NWTYuOM5oxT60KqlXMw34qCBKFnarTvlt/bqiOPUwPhf1 Zct1ya9188yOWWxb3t+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vAonj-0000000DLqp-1kOu; Mon, 20 Oct 2025 12:15:47 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEWTW-000000030ul-3L9x; Tue, 04 Jun 2024 15:53:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8618E6134C; Tue, 4 Jun 2024 15:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D41BC2BBFC; Tue, 4 Jun 2024 15:52:38 +0000 (UTC) Date: Tue, 4 Jun 2024 11:52:35 -0400 From: Steven Rostedt To: Jani Nikula Cc: Andy Shevchenko , "Rafael J. Wysocki" , Greg Kroah-Hartman , Corey Minyard , Allen Pais , Sebastian Reichel , Perry Yuan , Giovanni Cabiddu , Herbert Xu , Nuno Sa , Guenter Roeck , Randy Dunlap , Andi Shyti , Heiner Kallweit , Lee Jones , Samuel Holland , Elad Nachman , Arseniy Krasnov , Johannes Berg , Gregory Greenman , Benjamin Berg , Bjorn Helgaas , Robert Richter , Vinod Koul , Chunfeng Yun , Linus Walleij , Hans de Goede , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , Nikita Kravets , Jiri Slaby , Srinivas Pandruvada , Stanley Chang , Heikki Krogerus , Abdel Alkuor , Kent Overstreet , Eric Biggers , Kees Cook , Ingo Molnar , Daniel Bristot de Oliveira , Andrew Morton , Hugh Dickins , Abel Wu , John Johansen , Mimi Zohar , Stefan Berger , Roberto Sassu , Eric Snowberg , Takashi Iwai , Takashi Sakamoto , Jiapeng Chong , Mark Brown , Kuninori Morimoto , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-acpi@vger.kernel.org, linux-ide@vger.kernel.org, openipmi-developer@lists.sourceforge.net, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, qat-linux@intel.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org, linux-leds@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-gpio@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-hardening@vger.kernel.org, cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Howells , "David S. Miller" , "Rafael J. Wysocki" , Len Brown , Sergey Shtylyov , Damien Le Moal , Niklas Cassel , Daniel Scally , Sakari Ailus , Michael Turquette , Stephen Boyd , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Heiko Stuebner , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , Viresh Kumar , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Karol Herbst , Lyude Paul , Danilo Krummrich , Jean Delvare , Alexander Shishkin , Pavel Machek , Chen-Yu Tsai , Jernej Skrabec , Tony Lindgren , Adrian Hunter , Hu Ziji , Ulf Hansson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Potnuri Bharat Teja , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Miri Korenblit , Kalle Valo , Mahesh J Salgaonkar , Oliver O'Halloran , Kishon Vijay Abraham I , Matthias Brugger , AngeloGioacchino Del Regno , JC Kuo , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Sebastian Reichel , Daniel Lezcano , Zhang Rui , Lukasz Luba , Thinh Nguyen , Helge Deller , Brian Foster , Zhihao Cheng , Tejun Heo , Zefan Li , Johannes Weiner , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Masami Hiramatsu , Mathieu Desnoyers , Jason Baron , Jim Cromie , Paul Moore , James Morris , "Serge E. Hallyn" , Dmitry Kasatkin , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Linus Torvalds Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Message-ID: <20240604115235.044acfd6@gandalf.local.home> In-Reply-To: <87tti9cfry.fsf@intel.com> References: <20240603211538.289765-1-andriy.shevchenko@linux.intel.com> <87tti9cfry.fsf@intel.com> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_085326_943913_D5AAE3F9 X-CRM114-Status: GOOD ( 26.35 ) X-Mailman-Approved-At: Mon, 20 Oct 2025 05:15:44 -0700 X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Tue, 04 Jun 2024 10:45:37 +0300 Jani Nikula wrote: > On Sun, 02 Jun 2024, Andy Shevchenko wrote: > > Make two APIs look similar. Hence convert match_string() to be > > a 2-argument macro. In order to avoid unneeded churn, convert > > all users as well. There is no functional change intended. > > Why do we think it's a good idea to increase and normalize the use of > double-underscore function names across the kernel, like > __match_string() in this case? It should mean "reserved for the > implementation, not to be called directly". > > If it's to be used directly, it should be named accordingly, right? > > Being in line with __sysfs_match_string() isn't a great argument alone, > because this adds three times the number of __match_string() calls than > there are __sysfs_match_string() calls. It's not a good model to follow. > Arguably both should be renamed. Agreed. I want to get rid of any functions starting with an underscore except for those that are basically the same function used internally for convenience. Perhaps "match_string_dynamic()"? Where it is used for dynamically allocated arrays without known size. Or, allow a third parameter for dynamic arrays. #define match_string(_a, _s, ...) char _______STR[] = __stringify((__VA_ARGS__)); \ if (sizeof(_______STR) > 3) \ __match_string(_a, _s, ##__VA_ARGS__); \ else \ __match_string(_a, _s, ARRAY_SIZE(_a)); What the above stringify((__VA_ARGS__)) does is to check the size of any args added to match_string(). if there isn't any, it will turn into: "()\0", which is of size 3. If you add an argument, it will be: "()\0", which will have a size greater than three. (trace_printk() does this trick in include/linux/kernel.h). This way, both: match_string(array, sting); or match_string(array, string, size); will work. -- Steve _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76B97C27C52 for ; Tue, 4 Jun 2024 18:06:34 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Vtz7D577fz3fml for ; Wed, 5 Jun 2024 04:06:32 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=srs0=dfpp=ng=goodmis.org=rostedt@kernel.org; receiver=lists.ozlabs.org) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Vtw9n69RBz3cNt for ; Wed, 5 Jun 2024 01:53:33 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8618E6134C; Tue, 4 Jun 2024 15:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D41BC2BBFC; Tue, 4 Jun 2024 15:52:38 +0000 (UTC) Date: Tue, 4 Jun 2024 11:52:35 -0400 From: Steven Rostedt To: Jani Nikula Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Message-ID: <20240604115235.044acfd6@gandalf.local.home> In-Reply-To: <87tti9cfry.fsf@intel.com> References: <20240603211538.289765-1-andriy.shevchenko@linux.intel.com> <87tti9cfry.fsf@intel.com> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Wed, 05 Jun 2024 03:59:10 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Andrew Lunn , "Rafael J. Wysocki" , Heiko Stuebner , "Rafael J. Wysocki" , Takashi Iwai , Viresh Kumar , Linus Walleij , dri-devel@lists.freedesktop.org, Jaroslav Kysela , Ben Segall , Perry Yuan , Prashant Gaikwad , Pavel Machek , Srinivas Pandruvada , linux-clk@vger.kernel.org, Kishon Vijay Abraham I , Abel Wu , Vincent Guittot , Karol Herbst , Samuel Holland , Sebastian Reichel , Tvrtko Ursulin , linux-acpi@vger.kernel.org, Danilo Krummrich , Mel Gorman , linux-sunxi@lists. linux.dev, Guenter Roeck , Jean Delvare , linux-pm@vger.kernel.org, Potnuri Bharat Teja , James Morris , linux-sound@vger.kernel.org, Thomas Gleixner , linux-omap@vger.kernel.org, Zhihao Cheng , Dietmar Eggemann , Niklas Cassel , Scott Branden , Greg Kroah-Hartman , Randy Dunlap , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, "Gautham R. Shenoy" , Dmitry Kasatkin , Tejun Heo , Andrew Morton , Elad Nachman , Linus Torvalds , Lukasz Luba , linux-fbdev@vger.kernel.org, linux-usb@vger.kernel.org, Zefan Li , nouveau@ lists.freedesktop.org, Dave Hansen , Clemens Ladisch , Mimi Zohar , Mahesh J Salgaonkar , Hu Ziji , Eric Dumazet , keyrings@vger.kernel.org, Oliver O'Halloran , linux-i2c@vger.kernel.org, Gregory Greenman , Ingo Molnar , linux-security-module@vger.kernel.org, Valentin Schneider , Corey Minyard , Gregory Clement , Lee Jones , Hugh Dickins , Jonathan Hunter , linux-rockchip@lists.infradead.org, linux-trace-kernel@vger.kernel.org, Andi Shyti , Robert Richter , Maarten Lankhorst , Brian Foster , Maxime Ripard , linux-gpio@vger.kernel.org, Jason Baron , linux-rpi-kernel@lists.infradead.org, Bjorn Helgaas , cgroups@vger.kernel.org, Allen Pais , linux-arm-kernel@lists.infradead.org, Daniel Lezcano , Stephen Boyd , Roberto Sassu , linux-integrity@vger.kernel.org, Daniel Bristot de Oliveira , Len Brown , Heiner Kallweit , Miri Korenblit , Arseniy Krasnov , Ulf Hansson , Heikki Krogerus , Kuninori Morimoto , Alexander Shishkin , linux-pci@vger.kernel.org, Michael Turquette , Joonas Lahtinen , alsa-devel@alsa-project.org, Nuno Sa , Matthias Brugger , linux-mtd@lists .infradead.org, linux-hardening@vger.kernel.org, linux-phy@lists.infradead.org, Jiri Slaby , linux-staging@lists.linux.dev, Jernej Skrabec , Nikita Kravets , Peter Zijlstra , Chen-Yu Tsai , Abdel Alkuor , Broadcom internal kernel review list , "Naveen N. Rao" , Ilpo =?UTF-8?B?SsOkcnZpbmVu?= , Paolo Abeni , "Serge E. Hallyn" , Lyude Paul , Kees Cook , Ray Jui , intel-gfx@lists.freedesktop.org, Johannes Berg , Paul Moore , Mark Brown , Borislav Petkov , Rodrigo Vivi , Stanley Chang , Daniel Vetter , openipmi-developer@list s.sourceforge.net, linux-hwmon@vger.kernel.org, Sergey Shtylyov , linux-mm@kvack.org, Thinh Nguyen , linux-mmc@vger.kernel.org, Sebastian Reichel , Takashi Sakamoto , Daniel Scally , JC Kuo , Thierry Reding , Masami Hiramatsu , Sakari Ailus , "David S. Miller" , Mario Limonciello , Giovanni Cabiddu , Vignesh Raghavendra , Eric Biggers , Tony Lindgren , Takashi Iwai , David Howells , linux-ide@vger.kernel.org, Huang Rui , "H. Peter Anvin" , David Airlie , Jim Cromie , linux-leds@vger.kernel.org, Eric Snowberg , Herbert Xu , Florian Fainelli , Richard Weinberger , x86@kernel.org, qat-linux@intel.com, linux-bcachefs@vger.kernel.org, Ingo Molnar , Chunfeng Yun , Jakub Kicinski , Zhang Rui , Sebastian Hesselbarth , platform-driver-x86@vger.kernel.org, Thomas Zimmermann , Jiapeng Chong , Miquel Raynal , Kalle Valo , apparmor@lists.ubuntu.com, Hans de Goede , linux-mediatek@lists.infradead.org, Nicholas Piggin , Benjamin Berg , linux-tegra@vger.kernel.org, Andy Shevchenko , intel-xe@lists.freedesktop.org, AngeloGioacchino Del Regno , John Johansen , L iam Girdwood , netdev@vger.kernel.org, Peter De Schrijver , Kent Overstreet , Adrian Hunter , Vinod Koul , Damien Le Moal , Daniel Bristot de Oliveira , Johannes Weiner , Mathieu Desnoyers , linuxppc-dev@lists.ozlabs.org, Helge Deller , Stefan Berger Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, 04 Jun 2024 10:45:37 +0300 Jani Nikula wrote: > On Sun, 02 Jun 2024, Andy Shevchenko wrote: > > Make two APIs look similar. Hence convert match_string() to be > > a 2-argument macro. In order to avoid unneeded churn, convert > > all users as well. There is no functional change intended. > > Why do we think it's a good idea to increase and normalize the use of > double-underscore function names across the kernel, like > __match_string() in this case? It should mean "reserved for the > implementation, not to be called directly". > > If it's to be used directly, it should be named accordingly, right? > > Being in line with __sysfs_match_string() isn't a great argument alone, > because this adds three times the number of __match_string() calls than > there are __sysfs_match_string() calls. It's not a good model to follow. > Arguably both should be renamed. Agreed. I want to get rid of any functions starting with an underscore except for those that are basically the same function used internally for convenience. Perhaps "match_string_dynamic()"? Where it is used for dynamically allocated arrays without known size. Or, allow a third parameter for dynamic arrays. #define match_string(_a, _s, ...) char _______STR[] = __stringify((__VA_ARGS__)); \ if (sizeof(_______STR) > 3) \ __match_string(_a, _s, ##__VA_ARGS__); \ else \ __match_string(_a, _s, ARRAY_SIZE(_a)); What the above stringify((__VA_ARGS__)) does is to check the size of any args added to match_string(). if there isn't any, it will turn into: "()\0", which is of size 3. If you add an argument, it will be: "()\0", which will have a size greater than three. (trace_printk() does this trick in include/linux/kernel.h). This way, both: match_string(array, sting); or match_string(array, string, size); will work. -- Steve