Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1244209pxb; Fri, 21 Jan 2022 13:12:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAPeob20uFMBQQI0b/5Y0Qx7VCxM/UEg5/CWxgAqqyCFsor3lhimZm+qH7Hh1mLzrChi41 X-Received: by 2002:a05:6a00:10d5:b0:4bc:a0eb:c6a0 with SMTP id d21-20020a056a0010d500b004bca0ebc6a0mr5378277pfu.70.1642799566786; Fri, 21 Jan 2022 13:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642799566; cv=none; d=google.com; s=arc-20160816; b=i0wwi/h8btCmM1LlrppwIZfHgYFFXySPVoCBFTMRbk4nw5N3qVIL6NTyD3jnf5u1G5 /xkGj1bHMTdidilqDKXyelxd4ChcEqc7QL6qukaeSKch69Wcqm4uN4g0y7CNS0G0bpXU bwx0FTuvYL0DXVXtV31dM4cqFs4lcZciGJTyeyIDu8hYVRCeNzVNj2GlhhmBiQRrP0Ua amVnAcUg833jTphUdXiruLu9+C06Vq+F7YIBU2ApZDWgiBlzv56ZNia451GJ1uLN4gKE QOlkxckcJP1GL2zhUhYgUaj83HKrBXHV95FZdGgtvp4hWuOWzM9EXjhvWsa4CoNYrp3P em9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=JHRqYKZuI/HKuEHlTAHmVl4JTK7C/syUXa7FmKn/DTs=; b=MDyInFwaqc0reWSceRhn6yqkw7xSe4mKC2wRquIot3WMAxeFe6do5OHG4YcqLKQCW4 8dvP1IZbrYZ+Hiq3GzyweT7yGLlliiWBYttyS7P/xamJ+uK4GhtUPmPCvEul37qIq0kM eucGocGIiYauGCbVvzRA5KofccsCsyBkbUPeWxgF2Tazr0Wo492hAE/QJH3s5qJcZ2ty gmjl69C6CKbEu+3LtX2EeMqZQWFgVU+fX3k5o+MrrC992rz7h17RNVocO4fbx9GiX6Rk jeEQAPXxk9iidg/Dtrz2/pIG0PaZU8sCvzqP9DQDHAgV0BuishBdZtQNsOmIIx6Jyj34 wamw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AHA02wk5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 70si7044977pgb.73.2022.01.21.13.12.34; Fri, 21 Jan 2022 13:12:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AHA02wk5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241134AbiATJMv (ORCPT + 99 others); Thu, 20 Jan 2022 04:12:51 -0500 Received: from mga11.intel.com ([192.55.52.93]:41324 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237469AbiATJMu (ORCPT ); Thu, 20 Jan 2022 04:12:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642669970; x=1674205970; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=O6+9vsSDVilrh7UjW1BQCXvdPjMTCzf/nC38lgkfjeM=; b=AHA02wk5ouwuy6W2HYrPYzS3lrrL/+qHOg0CYICTR4e+NnGDFVlrPQJY gUj38EYBjNh8qH1E352SLmi7aiETla3w5jUoSe+DLdc6dwhtORh48OxAB wwXh0qh8dDeN8ZpYxipzfTpLjwedgt6UZTGuVuF0tPJWiTOD8Hb6lBqYz TUbCocR9flrnZDvAlhu8UmnmUBvlBMKQk8+wBnGcT+5/+LbCwKTmYYJFo 5Zdbc2SDIn7jtDAU5Mcfjj2Ul9fOOFojNnFmVlLIhBT6wLzbLvZBezAhi o0Krv3L9xYhq5xaiCt5g4CTKMsIURyXAl01a6ZaGbJ/PxuOdz23nu1+ji Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10232"; a="242871050" X-IronPort-AV: E=Sophos;i="5.88,302,1635231600"; d="scan'208";a="242871050" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2022 01:12:43 -0800 X-IronPort-AV: E=Sophos;i="5.88,302,1635231600"; d="scan'208";a="532691996" Received: from davidfsc-mobl3.ger.corp.intel.com (HELO localhost) ([10.252.52.140]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2022 01:12:32 -0800 From: Jani Nikula To: Petr Mladek Cc: Lucas De Marchi , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-security-module@vger.kernel.org, nouveau@lists.freedesktop.org, netdev@vger.kernel.org, Alex Deucher , Andrew Morton , Andy Shevchenko , Andy Shevchenko , Ben Skeggs , Christian =?utf-8?Q?K=C3=B6nig?= , Chris Wilson , Daniel Vetter , David Airlie , "David S . Miller" , Emma Anholt , Eryk Brol , Francis Laniel , Greg Kroah-Hartman , Harry Wentland , Jakub Kicinski , Joonas Lahtinen , Julia Lawall , Kentaro Takeda , Leo Li , Mikita Lipski , Rahul Lakkireddy , Raju Rangoju , Rasmus Villemoes , Rodrigo Vivi , Sakari Ailus , Sergey Senozhatsky , Steven Rostedt , Vishal Kulkarni Subject: Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220119072450.2890107-1-lucas.demarchi@intel.com> <87tudzbykz.fsf@intel.com> Date: Thu, 20 Jan 2022 11:12:27 +0200 Message-ID: <8735libwjo.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Jan 2022, Petr Mladek wrote: > On Wed 2022-01-19 16:16:12, Jani Nikula wrote: >> On Wed, 19 Jan 2022, Petr Mladek wrote: >> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote: >> >> d. This doesn't bring onoff() helper as there are some places in the >> >> kernel with onoff as variable - another name is probably needed for >> >> this function in order not to shadow the variable, or those variables >> >> could be renamed. Or if people wanting >> >> try to find a short one >> > >> > I would call it str_on_off(). >> > >> > And I would actually suggest to use the same style also for >> > the other helpers. >> > >> > The "str_" prefix would make it clear that it is something with >> > string. There are other _on_off() that affect some >> > functionality, e.g. mute_led_on_off(), e1000_vlan_filter_on_off(). >> > >> > The dash '_' would significantly help to parse the name. yesno() and >> > onoff() are nicely short and kind of acceptable. But "enabledisable()" >> > is a puzzle. >> > >> > IMHO, str_yes_no(), str_on_off(), str_enable_disable() are a good >> > compromise. >> > >> > The main motivation should be code readability. You write the >> > code once. But many people will read it many times. Open coding >> > is sometimes better than misleading macro names. >> > >> > That said, I do not want to block this patchset. If others like >> > it... ;-) >> >> I don't mind the names either way. Adding the prefix and dashes is >> helpful in that it's possible to add the functions first and convert >> users at leisure, though with a bunch of churn, while using names that >> collide with existing ones requires the changes to happen in one go. > > It is also possible to support both notations at the beginning. > And convert the existing users in the 2nd step. > >> What I do mind is grinding this series to a halt once again. I sent a >> handful of versions of this three years ago, with inconclusive >> bikeshedding back and forth, eventually threw my hands up in disgust, >> and walked away. > > Yeah, and I am sorry for bikeshedding. Honestly, I do not know what is > better. This is why I do not want to block this series when others > like this. > > My main motivation is to point out that: > > enabledisable(enable) > > might be, for some people, more eye bleeding than > > enable ? "enable" : "disable" > > > The problem is not that visible with yesno() and onoff(). But as you said, > onoff() confliscts with variable names. And enabledisable() sucks. > As a result, there is a non-trivial risk of two mass changes: My point is, in the past three years we could have churned through more than two mass renames just fine, if needed, *if* we had just managed to merge something for a start! BR, Jani. > > now: > > - contition ? "yes" : "no" > + yesno(condition) > > a few moths later: > > - yesno(condition) > + str_yes_no(condition) > > > Best Regards, > Petr -- Jani Nikula, Intel Open Source Graphics Center