linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Schspa Shi" <schspa@gmail.com>, "Marc Zyngier" <maz@kernel.org>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	patches@opensource.cirrus.com,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Doug Berger" <opendmb@gmail.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Kuppuswamy Sathyanarayanan"
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	"Nandor Han" <nandor.han@ge.com>,
	"Semi Malinen" <semi.malinen@ge.com>
Subject: Re: [PATCH v1 00/16] gpio: Use string_choices.h
Date: Thu, 9 Mar 2023 16:22:19 +0100	[thread overview]
Message-ID: <CAMRc=Me-FMZ3e=EaUA1kimEonz=HVHBp7coxCz53bJK9NYBuFg@mail.gmail.com> (raw)
In-Reply-To: <20230306195556.55475-1-andriy.shevchenko@linux.intel.com>

On Mon, Mar 6, 2023 at 8:55 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Use string_choices.h in the GPIO drivers and library.
> It has been tested on x86_64 and (semi-)compile tested
> over all.
>
> Andy Shevchenko (16):
>   lib/string_helpers: Add missing header files to MAINTAINERS database
>   lib/string_helpers: Split out string_choices.h
>   lib/string_choices: Add str_high_low() helper
>   lib/string_choices: Add str_input_output() helper
>   gpiolib: Utilize helpers from string_choices.h
>   gpio: adnp: Utilize helpers from string_choices.h
>   gpio: brcmstb: Utilize helpers from string_choices.h
>   gpio: crystalcove: Utilize helpers from string_choices.h
>   gpio: grgpio: Utilize helpers from string_choices.h
>   gpio: mvebu: Utilize helpers from string_choices.h
>   gpio: pl061: Utilize helpers from string_choices.h
>   gpio: stmpe: Utilize helpers from string_choices.h
>   gpio: wcove: Utilize helpers from string_choices.h
>   gpio: wm831x: Utilize helpers from string_choices.h
>   gpio: wm8994: Utilize helpers from string_choices.h
>   gpio: xra1403: Utilize helpers from string_choices.h
>
>  MAINTAINERS                     |  3 ++
>  drivers/gpio/gpio-adnp.c        | 24 ++++----------
>  drivers/gpio/gpio-brcmstb.c     |  3 +-
>  drivers/gpio/gpio-crystalcove.c | 17 +++++-----
>  drivers/gpio/gpio-grgpio.c      |  3 +-
>  drivers/gpio/gpio-mvebu.c       | 27 +++++++---------
>  drivers/gpio/gpio-pl061.c       |  4 +--
>  drivers/gpio/gpio-stmpe.c       | 19 +++++------
>  drivers/gpio/gpio-wcove.c       | 15 ++++-----
>  drivers/gpio/gpio-wm831x.c      |  5 +--
>  drivers/gpio/gpio-wm8994.c      |  6 ++--
>  drivers/gpio/gpio-xra1403.c     |  5 +--
>  drivers/gpio/gpiolib-sysfs.c    |  3 +-
>  drivers/gpio/gpiolib.c          | 13 ++++----
>  include/linux/string_choices.h  | 56 +++++++++++++++++++++++++++++++++
>  include/linux/string_helpers.h  | 26 +--------------
>  16 files changed, 125 insertions(+), 104 deletions(-)
>  create mode 100644 include/linux/string_choices.h
>
> --
> 2.39.1
>

I've been thinking about this and I must say it doesn't make much
sense to me. Not only does it NOT reduce the code size (even if we
assume the unlikely case where we'd build all those modules that use
the helpers) but also decreases the readability for anyone not
familiar with the new interfaces (meaning time spent looking up the
new function). The "%s", x ? "if" : "else" statement is concise and
clear already, I don't see much improvement with this series. And I'm
saying it from the position of someone who loves factoring out common
code. :)

I'll wait to hear what others have to say but if it were up to me, I'd
politely say no.

(I mean: I guess, in the end it is up to me, but I'm open to arguments.) :)

Bart

  parent reply	other threads:[~2023-03-09 15:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 19:55 [PATCH v1 00/16] gpio: Use string_choices.h Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 01/16] lib/string_helpers: Add missing header files to MAINTAINERS database Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 02/16] lib/string_helpers: Split out string_choices.h Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 03/16] lib/string_choices: Add str_high_low() helper Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 04/16] lib/string_choices: Add str_input_output() helper Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 05/16] gpiolib: Utilize helpers from string_choices.h Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 06/16] gpio: adnp: " Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 07/16] gpio: brcmstb: " Andy Shevchenko
2023-03-06 19:57   ` Florian Fainelli
2023-03-06 19:55 ` [PATCH v1 08/16] gpio: crystalcove: " Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 09/16] gpio: grgpio: " Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 10/16] gpio: mvebu: " Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 11/16] gpio: pl061: " Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 12/16] gpio: stmpe: " Andy Shevchenko
2023-03-06 19:55 ` [PATCH v1 13/16] gpio: wcove: " Andy Shevchenko
2023-03-06 20:28   ` Sathyanarayanan Kuppuswamy
2023-03-06 19:55 ` [PATCH v1 14/16] gpio: wm831x: " Andy Shevchenko
2023-03-07 11:35   ` Charles Keepax
2023-03-06 19:55 ` [PATCH v1 15/16] gpio: wm8994: " Andy Shevchenko
2023-03-07 11:36   ` Charles Keepax
2023-03-06 19:55 ` [PATCH v1 16/16] gpio: xra1403: " Andy Shevchenko
2023-03-06 20:25 ` [PATCH v1 00/16] gpio: Use string_choices.h Andy Shevchenko
2023-03-09 15:22 ` Bartosz Golaszewski [this message]
2023-03-10  7:32   ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMRc=Me-FMZ3e=EaUA1kimEonz=HVHBp7coxCz53bJK9NYBuFg@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maz@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nandor.han@ge.com \
    --cc=opendmb@gmail.com \
    --cc=patches@opensource.cirrus.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=schspa@gmail.com \
    --cc=semi.malinen@ge.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).