Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp681742ybp; Fri, 4 Oct 2019 03:18:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIoSoJHMl5HtW9Bhc3+5zQ6kthm597yXMuxymdqqK5+pnSHGKIDWQDJC3C0Bwz/G0m5bsY X-Received: by 2002:a17:906:5584:: with SMTP id y4mr11682910ejp.89.1570184297080; Fri, 04 Oct 2019 03:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570184297; cv=none; d=google.com; s=arc-20160816; b=PTveTivf0FAFo7YMcHJeFAIOj+USiE1fG6G2oJm6L9BjSL2fXhsc4EGjY0a5NYOax8 NAD/jVCpAk4THcRKE3GDijWslWuxbeCTQ57KeBqFKEbMtIj2tbAoIluas6ciDUJzGYQh QjjVxvLakhS/454r12e91OTj3oGMeRA9WS/WdehlMGjkW1Iri8aelQSP3wMStOqAVFbZ XsyZRFOutb3hjKRXprnMn4otQiwATl8MSZFrhiawKhUaqK64bI+cV8j7Ti/ZgZMmvNna HqrotweYS121zEzVkpNDE0F1WyhXkTNFwIJQZGGuVaMmyCrw/FtrOmuFBwNva7sCankV ygZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=P/gW1SOIxkhsjwfudKI1HY4/LjrWP7p7/VWy25WNp5w=; b=lNXEezQ3+nkacU4UtvWDeVvhKn+sq+FgvSEi/JEhaBiNcdJfoSzPmGh9vQpFXKwENJ RN5YG+PVT7AZk2MQQOGJtT71S3leGbze6E/qSnqThONN4TxJtPy30yK6NvfvUQdBTw5z pxu+DH2yNAHVWwEJgBO9LYSFFhc4M556W4UDqzSJ9sro4VDkd9iZ25sluc9wV4fgLd0y nBe9xsTiA4j7k8uALJoEeKF44glmmXpl+D4axHRGDz2G8NJERAuhciL1ay5gu5a9gup9 lTOVZECs+THzRZYFdzme6kRTMalViF9tkSJAPgrYH8EwIHzQ9qoGHdNIt6LHrS0cYBgI cb0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=17pnv8iB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si2703840ejr.29.2019.10.04.03.17.17; Fri, 04 Oct 2019 03:18:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=17pnv8iB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730651AbfJDJJq (ORCPT + 99 others); Fri, 4 Oct 2019 05:09:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:35612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfJDJJq (ORCPT ); Fri, 4 Oct 2019 05:09:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2D9A20867; Fri, 4 Oct 2019 09:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570180185; bh=hm9yY4mY6cAad/FS1LSmCGDFTnHyfdN4fmY2yqMQxzM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=17pnv8iBTAvOsSYGBVxGkVbDS9BdRJYY/2WIpvd2Zd/zgyS36I7AxeKuUf0E0xSFQ UuqHUn4K0QMnphSNfcR2pPU/m4gk/bcCPKSN6Ys4XwiSoC4zRTH+g+CFGKqGhGZpbP 3qMHJFANMlS43Mk0L9U0tJaOorP0MFBscY+E7cqI= Date: Fri, 4 Oct 2019 11:09:43 +0200 From: Greg Kroah-Hartman To: Jani Nikula Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org, Joonas Lahtinen , Rodrigo Vivi , intel-gfx@lists.freedesktop.org, Vishal Kulkarni , netdev@vger.kernel.org, linux-usb@vger.kernel.org, Andrew Morton , Julia Lawall Subject: Re: [PATCH v3] string-choice: add yesno(), onoff(), enableddisabled(), plural() helpers Message-ID: <20191004090943.GA306905@kroah.com> References: <8e697984-03b5-44f3-304e-42d303724eaa@rasmusvillemoes.dk> <20191001080739.18513-1-jani.nikula@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191001080739.18513-1-jani.nikula@intel.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 01, 2019 at 11:07:39AM +0300, Jani Nikula wrote: > The kernel has plenty of ternary operators to choose between constant > strings, such as condition ? "yes" : "no", as well as value == 1 ? "" : > "s": > > $ git grep '? "yes" : "no"' | wc -l > 258 > $ git grep '? "on" : "off"' | wc -l > 204 > $ git grep '? "enabled" : "disabled"' | wc -l > 196 > $ git grep '? "" : "s"' | wc -l > 25 > > Additionally, there are some occurences of the same in reverse order, > split to multiple lines, or otherwise not caught by the simple grep. > > Add helpers to return the constant strings. Remove existing equivalent > and conflicting functions in i915, cxgb4, and USB core. Further > conversion can be done incrementally. > > While the main goal here is to abstract recurring patterns, and slightly > clean up the code base by not open coding the ternary operators, there > are also some space savings to be had via better string constant > pooling. > > Cc: Joonas Lahtinen > Cc: Rodrigo Vivi > Cc: intel-gfx@lists.freedesktop.org > Cc: Vishal Kulkarni > Cc: netdev@vger.kernel.org > Cc: Greg Kroah-Hartman > Cc: linux-usb@vger.kernel.org > Cc: Andrew Morton > Cc: linux-kernel@vger.kernel.org > Cc: Julia Lawall > Cc: Rasmus Villemoes > Reviewed-by: Greg Kroah-Hartman # v1 > Signed-off-by: Jani Nikula Reviewed-by: Greg Kroah-Hartman For this version at least :)