Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp201483lqb; Tue, 4 Jun 2024 08:55:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+Gq8SqcKOFyerB4zn1Wc369pwTMVDIRcacWkdHRgrBe6cBJVH8r+vkBzov2RRPErXo7hFf5/c9xbpQVBkbOC70nRefxpvZH64pxdpfA== X-Google-Smtp-Source: AGHT+IG1DClzXNm1I8pL2BdZL9YuoIRZ5iHOHAWTsubVHQovKdNOmA1wwol/q7qnZ6n6QdMIM4QG X-Received: by 2002:a05:620a:40cc:b0:78e:bd94:723e with SMTP id af79cd13be357-795136384femr441862585a.34.1717516506379; Tue, 04 Jun 2024 08:55:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717516506; cv=pass; d=google.com; s=arc-20160816; b=q/lcBYacAbBZVXeLJkppc8wR6Azv+OgyLxy2kMkSTIcZix1brCLS6aszJFznm84Ecu vQP5HiD/2oECHJpV061wnE8toZoQXyETnfJPwMDQ2nYIRzsL2XGzHqZh7bs8BcQ9YjPj aMk/CE6sGJyik2aZ1VzKh76BkeGT3ylIJsQS9fcG/83DkICSSaVIXF+w2ndBJ7tjTbTn Kb1LoVgEydnqilpJuqgxX2bcMT7KvfVOARuZCjI/z/VHhB+5pFeGCCNw/CKSU+5HgsIq EQL9Te2RqNWLPtvrSQ4LFDlRseuM2XpT5HhOhZbIr9Nx8IRdsBQxI1kGg/dK4qLwY5zx 8Pfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=2fi35N2KF3sgT8VBVY7bMWYyA81LAoTv86Jf4wATRo8=; fh=ryGs2k7hVds1s24RqAcGK5AsPUAI7keE/NkK8pUu358=; b=lOl9XMnmyOBC51HQQuNSyvdxLIJOgVxwf3Swuj/bv895ZCCP5CGNXuC+F9oOxULXDr GGaDRBBKtiC15vzZUrUOVtewUVaidP+QzlMyJDBio3GRRlhE+4mrhVifxAulg4hRuTte X6V3ntyKVJ+HfY+LUM91EDkZdewtnmavWp0vGIxzwMrSuUxCiogh0aidM/nmsdvx2Olw LPRwo1eVMFWfe9qcGOq43VfvhptX1CjYLFWXx/5fyy7HjJ0g2jWyrVc3GVp/O93QDMha 1ZkhauJqQFGCb9NJmLZnVqbpp7f9SFHVm5qJU+wucBxifwGFlpEeM9Dy3hyiPrnHWwz6 lfvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-wireless+bounces-8486-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8486-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f90e103dsi228855785a.492.2024.06.04.08.55.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 08:55:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8486-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-wireless+bounces-8486-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8486-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C0C721C24C84 for ; Tue, 4 Jun 2024 15:54:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91947149C5E; Tue, 4 Jun 2024 15:53:26 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CA463148FE6; Tue, 4 Jun 2024 15:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717516406; cv=none; b=J/ElMn9fnrAqKHj3Q04mRBprYqY+wqNGifUYyZiyMFLQLHCTS25Uj41KAD7XE06esu1IlUxJft+wyaIdDyTdhp7T/FBd6BJAtIa87svht6SR53OFyPuN5s0Fk6Vej4j+uOOzbygcSuA+kTNL5UlecU3UpWXjznFhBuuFSNTcJ7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717516406; c=relaxed/simple; bh=jqzyU34fAZG4/WHYtSv7WuekoSVYXVRfGb6ve0icGKI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p24aUvh2sK+xxHKdgy6Nsc5etRY5CTEgKo1l4S7OjdgLXzMcnrN24i2KecpeN4cQrCEo2G5nkOI5AFT/v/bN9IbHUJb2/eqkeQWsl4pHDIpZORyG//m5nc3Wva1nnddlD6cegodt4qLjznDIf8yAzGpYSrbrXWn6acFsy+qIupw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 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) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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