Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp393004ybe; Wed, 4 Sep 2019 01:09:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqywh5paA2/Jd72tBWhZuhgKLAsmNWM6GxW5VPeeuAuu4emLt1gQiX3IKMLj4q9/v8qB9s4T X-Received: by 2002:a17:90a:18e:: with SMTP id 14mr3629930pjc.66.1567584549860; Wed, 04 Sep 2019 01:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567584549; cv=none; d=google.com; s=arc-20160816; b=ppfY+QBmLZCUjmSxkKMkrRY1lNP4qUV96LV2kIOmYk99XU9Dm9+MKfH6ItnNTsLX/6 gpMyWlhheIvJ/4SKpGlWOc4Z1ufNMrVJs4ZrdnK2gp85fFl+lIcK9uxLIYxT15kuMAVg v22jA8mKRmTLzwg/6MkWcDCaGCz9S3H1CmYrFiDLQBdgsZWZv/XsgVn1GHKxGkBlQx5j 3dDG3R8SJYLhe9OVZI+EGv5i2gCRr61nT4QVQa7FMz4Jny6ZG+C7a2sip2fMvI8pDAGV 2qsuzNxxiwfWsPk7SD7PD6wBUsRvGf5HEvngUw4at/cYi0DTwSOVMp4VJ+rHnbTDmJ+4 gfew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=a0kRc/YGO4sI2T4Jh9SgXNSXruke3g7n9BxPhpUUJ54=; b=xtmiZ6HwqZSCMfokjgA7xDYobbJA+wEongG8ofh2AqHOivhMPQBQ5aafkHJB2JYt4s xBv46khEE1KtACz1ykIQtjtFnrPbyHQYYt2+drueBxnaLPJT1E9j3TYjm6WmY5o9NqVV RY8W8TsSX5zMqBiI6DJo2OadDebVEi/l7/7/xqf88p/D2+UlMYMUGAREUyI3tcH8scpp VXUWW5fj0btmryYjIlm/skqzXFSWr9bPESIGF7PgYKdfIuaOxqH3giERNLg2XZ8ZlYxe /jQ2E8+hx6q1hgOzSDAAdXWeh4Auoz5r1BaDZIro/tCQ/lA96ULKVEKO6s6LHn9F+lYb aakQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=P4VDt5A6; 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 s65si1749504pjc.103.2019.09.04.01.08.53; Wed, 04 Sep 2019 01:09:09 -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=@rasmusvillemoes.dk header.s=google header.b=P4VDt5A6; 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 S1729173AbfIDIID (ORCPT + 99 others); Wed, 4 Sep 2019 04:08:03 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45089 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728948AbfIDIIC (ORCPT ); Wed, 4 Sep 2019 04:08:02 -0400 Received: by mail-lf1-f66.google.com with SMTP id r134so14229426lff.12 for ; Wed, 04 Sep 2019 01:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=a0kRc/YGO4sI2T4Jh9SgXNSXruke3g7n9BxPhpUUJ54=; b=P4VDt5A6J/Y3PvIBzQ6SPSxa/x9TjXmZukB9THqunU38XJM5ivrf2H/Q2LyXaOMgzK Pd5ydHTs4EIvyjSPo3A8Hmr4tHXUUtBJmQY5UvW3DtX+8oxiRvxf43pu+ax2o3Zh+GkI yRm4cPAZGjqkCee4M3LbDLVUSpIcfnC8CCWHY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a0kRc/YGO4sI2T4Jh9SgXNSXruke3g7n9BxPhpUUJ54=; b=ZhT8UyOBnPYHv9RIGG5AGRp863kTX23pS228/wE6XW8Xu/IzyMMdILT09P9KDBbSqd OCOf6Bs7bW6wu9+vNsEgerHC5r6rQ/eLmn2cdia56LfqYsw5fII7MUgp+xmD2f+JIcKF MxCYz/03kQpXu04eHvV9a+fxCwATK8JgzLxJ9+hHLiz/FTE+FdpiFeSzleHpRJf1L/ZR bHJcueltD+720rHxhideWvzjASRZ+qaiJaLcoQHQg1bGh20kgEpbOvCCkzbuWNPcJNRI CJZ05+zu+awp32ZN+6k9bC/AvYXkV1wpcTPZp7/yUo8E3a+JZ7Q+gPn12fRh87oeWI1X 4w4Q== X-Gm-Message-State: APjAAAUg3Nr2Z+DNdR50kQjZls/cvN+2mkCjrIiDzY02Jf1TGq3seIeA YqB8vLaKpVqa7ywlkq4PC1YDxw== X-Received: by 2002:ac2:558a:: with SMTP id v10mr1946562lfg.162.1567584480532; Wed, 04 Sep 2019 01:08:00 -0700 (PDT) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id z72sm1131327ljb.98.2019.09.04.01.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Sep 2019 01:07:59 -0700 (PDT) Subject: Re: [PATCH 1/2] linux/kernel.h: add yesno(), onoff(), enableddisabled(), plural() helpers To: Jani Nikula , linux-kernel@vger.kernel.org Cc: Joonas Lahtinen , Rodrigo Vivi , intel-gfx@lists.freedesktop.org, Vishal Kulkarni , netdev@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, Andrew Morton , Julia Lawall References: <20190903133731.2094-1-jani.nikula@intel.com> From: Rasmus Villemoes Message-ID: Date: Wed, 4 Sep 2019 10:07:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190903133731.2094-1-jani.nikula@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/09/2019 15.37, Jani Nikula wrote: > 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. Eh, no? The linker does that across translation units anyway - moreover, given that you make them static inlines, "yes" and "no" will still live in .rodata.strX.Y in each individual TU that uses the yesno() helper. The enableddisabled() is a mouthful, perhaps the helpers should have an underscore between the choices yes_no() enabled_disabled() on_off() ? > drivers/gpu/drm/i915/i915_utils.h | 15 ------------- > .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 ---------- > drivers/usb/core/config.c | 5 ----- > drivers/usb/core/generic.c | 5 ----- > include/linux/kernel.h | 21 +++++++++++++++++++ Pet peeve: Can we please stop using linux/kernel.h as a dumping ground for every little utility/helper? That makes each and every translation unit in the kernel slightly larger, hence slower to compile. Please make a linux/string-choice.h and put them there. Rasmus