All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  7:24 ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Alex Deucher, Andrew Morton, Andy Shevchenko, Andy Shevchenko,
	Ben Skeggs, Christian König, Chris Wilson, Daniel Vetter,
	David Airlie, David S . Miller, Emma Anholt, Eryk Brol,
	Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Steven Rostedt,
	Vishal Kulkarni

Add some helpers under lib/string_helpers.h so they can be used
throughout the kernel. When I started doing this there were 2 other
previous attempts I know of, not counting the iterations each of them
had:

1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t

Going through the comments I tried to find some common ground and
justification for what is in here, addressing some of the concerns
raised.

a. This version should be a drop-in replacement for what is currently in
   the tree, with no change in behavior or binary size. For binary
   size what I checked wat that the linked objects in the end have the
   same size (gcc 11). From comments in the previous attempts this seems
   also the case for earlier compiler versions

b. I didn't change the function name to choice_* as suggested by Andrew
   Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
   because other people argumented in favor of shorter names for these
   simple helpers - if they are long and people simply not use due to
   that, we failed

c. Use string_helper.h for these helpers - pulling string.h in the
   compilations units was one of the concerns and I think re-using this
   already existing header is better than creating a new string-choice.h

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  <someprefix>
   try to find a short one

e. One alternative to all of this suggested by Christian König
   (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
   printk format. But besides the comment, he also seemed to like
   the common function. This brought the argument from others that the
   simple yesno()/enabledisable() already used in the code is easier to
   remember and use than e.g. %py[DOY]

Last patch also has some additional conversion of open coded cases. I
preferred starting with drm/ since this is "closer to home".

I hope this is a good summary of the previous attempts and a way we can
move forward.

Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
proposal is to take first 2 patches either through mm tree or maybe
vsprintf. Last patch can be taken later through drm.

thanks
Lucas De Marchi

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: David S. Miller <davem@davemloft.net>
Cc: Emma Anholt <emma@anholt.net>
Cc: Eryk Brol <eryk.brol@amd.com>
Cc: Francis Laniel <laniel_francis@privacyrequired.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Mikita Lipski <mikita.lipski@amd.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Raju Rangoju <rajur@chelsio.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vishal Kulkarni <vishal@chelsio.com>

Lucas De Marchi (3):
  lib/string_helpers: Consolidate yesno() implementation
  lib/string_helpers: Add helpers for enable[d]/disable[d]
  drm: Convert open yes/no strings to yesno()

 drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
 drivers/gpu/drm/drm_gem.c                      |  3 ++-
 drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
 drivers/gpu/drm/radeon/atom.c                  |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  4 ++++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 15 files changed, 31 insertions(+), 59 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 160+ messages in thread

* [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  7:24 ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Add some helpers under lib/string_helpers.h so they can be used
throughout the kernel. When I started doing this there were 2 other
previous attempts I know of, not counting the iterations each of them
had:

1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t

Going through the comments I tried to find some common ground and
justification for what is in here, addressing some of the concerns
raised.

a. This version should be a drop-in replacement for what is currently in
   the tree, with no change in behavior or binary size. For binary
   size what I checked wat that the linked objects in the end have the
   same size (gcc 11). From comments in the previous attempts this seems
   also the case for earlier compiler versions

b. I didn't change the function name to choice_* as suggested by Andrew
   Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
   because other people argumented in favor of shorter names for these
   simple helpers - if they are long and people simply not use due to
   that, we failed

c. Use string_helper.h for these helpers - pulling string.h in the
   compilations units was one of the concerns and I think re-using this
   already existing header is better than creating a new string-choice.h

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  <someprefix>
   try to find a short one

e. One alternative to all of this suggested by Christian König
   (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
   printk format. But besides the comment, he also seemed to like
   the common function. This brought the argument from others that the
   simple yesno()/enabledisable() already used in the code is easier to
   remember and use than e.g. %py[DOY]

Last patch also has some additional conversion of open coded cases. I
preferred starting with drm/ since this is "closer to home".

I hope this is a good summary of the previous attempts and a way we can
move forward.

Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
proposal is to take first 2 patches either through mm tree or maybe
vsprintf. Last patch can be taken later through drm.

thanks
Lucas De Marchi

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: David S. Miller <davem@davemloft.net>
Cc: Emma Anholt <emma@anholt.net>
Cc: Eryk Brol <eryk.brol@amd.com>
Cc: Francis Laniel <laniel_francis@privacyrequired.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Mikita Lipski <mikita.lipski@amd.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Raju Rangoju <rajur@chelsio.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vishal Kulkarni <vishal@chelsio.com>

Lucas De Marchi (3):
  lib/string_helpers: Consolidate yesno() implementation
  lib/string_helpers: Add helpers for enable[d]/disable[d]
  drm: Convert open yes/no strings to yesno()

 drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
 drivers/gpu/drm/drm_gem.c                      |  3 ++-
 drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
 drivers/gpu/drm/radeon/atom.c                  |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  4 ++++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 15 files changed, 31 insertions(+), 59 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 160+ messages in thread

* [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  7:24 ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Add some helpers under lib/string_helpers.h so they can be used
throughout the kernel. When I started doing this there were 2 other
previous attempts I know of, not counting the iterations each of them
had:

1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t

Going through the comments I tried to find some common ground and
justification for what is in here, addressing some of the concerns
raised.

a. This version should be a drop-in replacement for what is currently in
   the tree, with no change in behavior or binary size. For binary
   size what I checked wat that the linked objects in the end have the
   same size (gcc 11). From comments in the previous attempts this seems
   also the case for earlier compiler versions

b. I didn't change the function name to choice_* as suggested by Andrew
   Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
   because other people argumented in favor of shorter names for these
   simple helpers - if they are long and people simply not use due to
   that, we failed

c. Use string_helper.h for these helpers - pulling string.h in the
   compilations units was one of the concerns and I think re-using this
   already existing header is better than creating a new string-choice.h

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  <someprefix>
   try to find a short one

e. One alternative to all of this suggested by Christian König
   (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
   printk format. But besides the comment, he also seemed to like
   the common function. This brought the argument from others that the
   simple yesno()/enabledisable() already used in the code is easier to
   remember and use than e.g. %py[DOY]

Last patch also has some additional conversion of open coded cases. I
preferred starting with drm/ since this is "closer to home".

I hope this is a good summary of the previous attempts and a way we can
move forward.

Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
proposal is to take first 2 patches either through mm tree or maybe
vsprintf. Last patch can be taken later through drm.

thanks
Lucas De Marchi

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: David S. Miller <davem@davemloft.net>
Cc: Emma Anholt <emma@anholt.net>
Cc: Eryk Brol <eryk.brol@amd.com>
Cc: Francis Laniel <laniel_francis@privacyrequired.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Mikita Lipski <mikita.lipski@amd.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Raju Rangoju <rajur@chelsio.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vishal Kulkarni <vishal@chelsio.com>

Lucas De Marchi (3):
  lib/string_helpers: Consolidate yesno() implementation
  lib/string_helpers: Add helpers for enable[d]/disable[d]
  drm: Convert open yes/no strings to yesno()

 drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
 drivers/gpu/drm/drm_gem.c                      |  3 ++-
 drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
 drivers/gpu/drm/radeon/atom.c                  |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  4 ++++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 15 files changed, 31 insertions(+), 59 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 160+ messages in thread

* [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  7:24 ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Add some helpers under lib/string_helpers.h so they can be used
throughout the kernel. When I started doing this there were 2 other
previous attempts I know of, not counting the iterations each of them
had:

1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t

Going through the comments I tried to find some common ground and
justification for what is in here, addressing some of the concerns
raised.

a. This version should be a drop-in replacement for what is currently in
   the tree, with no change in behavior or binary size. For binary
   size what I checked wat that the linked objects in the end have the
   same size (gcc 11). From comments in the previous attempts this seems
   also the case for earlier compiler versions

b. I didn't change the function name to choice_* as suggested by Andrew
   Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
   because other people argumented in favor of shorter names for these
   simple helpers - if they are long and people simply not use due to
   that, we failed

c. Use string_helper.h for these helpers - pulling string.h in the
   compilations units was one of the concerns and I think re-using this
   already existing header is better than creating a new string-choice.h

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  <someprefix>
   try to find a short one

e. One alternative to all of this suggested by Christian König
   (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
   printk format. But besides the comment, he also seemed to like
   the common function. This brought the argument from others that the
   simple yesno()/enabledisable() already used in the code is easier to
   remember and use than e.g. %py[DOY]

Last patch also has some additional conversion of open coded cases. I
preferred starting with drm/ since this is "closer to home".

I hope this is a good summary of the previous attempts and a way we can
move forward.

Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
proposal is to take first 2 patches either through mm tree or maybe
vsprintf. Last patch can be taken later through drm.

thanks
Lucas De Marchi

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: David S. Miller <davem@davemloft.net>
Cc: Emma Anholt <emma@anholt.net>
Cc: Eryk Brol <eryk.brol@amd.com>
Cc: Francis Laniel <laniel_francis@privacyrequired.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Mikita Lipski <mikita.lipski@amd.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Raju Rangoju <rajur@chelsio.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vishal Kulkarni <vishal@chelsio.com>

Lucas De Marchi (3):
  lib/string_helpers: Consolidate yesno() implementation
  lib/string_helpers: Add helpers for enable[d]/disable[d]
  drm: Convert open yes/no strings to yesno()

 drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
 drivers/gpu/drm/drm_gem.c                      |  3 ++-
 drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
 drivers/gpu/drm/radeon/atom.c                  |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  4 ++++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 15 files changed, 31 insertions(+), 59 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 160+ messages in thread

* [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  7:24 ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Add some helpers under lib/string_helpers.h so they can be used
throughout the kernel. When I started doing this there were 2 other
previous attempts I know of, not counting the iterations each of them
had:

1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t

Going through the comments I tried to find some common ground and
justification for what is in here, addressing some of the concerns
raised.

a. This version should be a drop-in replacement for what is currently in
   the tree, with no change in behavior or binary size. For binary
   size what I checked wat that the linked objects in the end have the
   same size (gcc 11). From comments in the previous attempts this seems
   also the case for earlier compiler versions

b. I didn't change the function name to choice_* as suggested by Andrew
   Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
   because other people argumented in favor of shorter names for these
   simple helpers - if they are long and people simply not use due to
   that, we failed

c. Use string_helper.h for these helpers - pulling string.h in the
   compilations units was one of the concerns and I think re-using this
   already existing header is better than creating a new string-choice.h

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  <someprefix>
   try to find a short one

e. One alternative to all of this suggested by Christian König
   (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
   printk format. But besides the comment, he also seemed to like
   the common function. This brought the argument from others that the
   simple yesno()/enabledisable() already used in the code is easier to
   remember and use than e.g. %py[DOY]

Last patch also has some additional conversion of open coded cases. I
preferred starting with drm/ since this is "closer to home".

I hope this is a good summary of the previous attempts and a way we can
move forward.

Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
proposal is to take first 2 patches either through mm tree or maybe
vsprintf. Last patch can be taken later through drm.

thanks
Lucas De Marchi

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: David S. Miller <davem@davemloft.net>
Cc: Emma Anholt <emma@anholt.net>
Cc: Eryk Brol <eryk.brol@amd.com>
Cc: Francis Laniel <laniel_francis@privacyrequired.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Mikita Lipski <mikita.lipski@amd.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Raju Rangoju <rajur@chelsio.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vishal Kulkarni <vishal@chelsio.com>

Lucas De Marchi (3):
  lib/string_helpers: Consolidate yesno() implementation
  lib/string_helpers: Add helpers for enable[d]/disable[d]
  drm: Convert open yes/no strings to yesno()

 drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
 drivers/gpu/drm/drm_gem.c                      |  3 ++-
 drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
 drivers/gpu/drm/radeon/atom.c                  |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  4 ++++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 15 files changed, 31 insertions(+), 59 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 160+ messages in thread

* [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19  7:24 ` Lucas De Marchi
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-19  7:24   ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Alex Deucher, Andrew Morton, Andy Shevchenko, Andy Shevchenko,
	Ben Skeggs, Christian König, Chris Wilson, Daniel Vetter,
	David Airlie, David S . Miller, Emma Anholt, Eryk Brol,
	Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Steven Rostedt,
	Vishal Kulkarni

There are a few implementations of yesno() in the tree. Consolidate them
in include/linux/string_helpers.h.  Quite a few users of open coded
yesno() could later be converted to the new function:

$ git grep '?\s*"yes"\s*' | wc -l
286
$ git grep '?\s*"no"\s*' | wc -l
20

The inlined function should keep the const strings local to each
compilation unit, the same way it's now, thus not changing the current
behavior.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/i915/i915_utils.h              |  5 -----
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  2 ++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 7 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 9d43ecb1f692..b59760f91bf6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include <linux/string_helpers.h>
 #include <linux/uaccess.h>
 
 #include "dc.h"
@@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
 	uint32_t param1;
 };
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 /* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array
  *
  * Function takes in attributes passed to debugfs write entry
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 7a5925072466..2a8781cc648b 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 #define MBps(x) KBps(1000 * (x))
 #define GBps(x) ((u64)1000 * MBps((x)))
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 static inline const char *onoff(bool v)
 {
 	return v ? "on" : "off";
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 7d49fd4edc9e..61a04d7abc1f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2015,17 +2015,6 @@ static const struct file_operations rss_debugfs_fops = {
 /* RSS Configuration.
  */
 
-/* Small utility function to return the strings "yes" or "no" if the supplied
- * argument is non-zero.
- */
-static const char *yesno(int x)
-{
-	static const char *yes = "yes";
-	static const char *no = "no";
-
-	return x ? yes : no;
-}
-
 static int rss_config_show(struct seq_file *seq, void *v)
 {
 	struct adapter *adapter = seq->private;
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4ba39e1403b2..e980dec05d31 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 
 void kfree_strarray(char **array, size_t n);
 
+static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+
 #endif
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index d79bf07e16be..1458e27361e8 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
 		       "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
 		       stamp.year, stamp.month, stamp.day, stamp.hour,
 		       stamp.min, stamp.sec, r->profile, tomoyo_mode[r->mode],
-		       tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
+		       yesno(r->granted), gpid, tomoyo_sys_getpid(),
 		       tomoyo_sys_getppid(),
 		       from_kuid(&init_user_ns, current_uid()),
 		       from_kgid(&init_user_ns, current_gid()),
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c64927bf2b3..304ed0f426dd 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/security.h>
+#include <linux/string_helpers.h>
 #include "common.h"
 
 /* String table for operation mode. */
@@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
 
 /* Utility functions. */
 
-/**
- * tomoyo_yesno - Return "yes" or "no".
- *
- * @value: Bool value.
- */
-const char *tomoyo_yesno(const unsigned int value)
-{
-	return value ? "yes" : "no";
-}
-
 /**
  * tomoyo_addprintf - strncat()-like-snprintf().
  *
@@ -730,8 +721,8 @@ static void tomoyo_print_config(struct tomoyo_io_buffer *head, const u8 config)
 {
 	tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
 			 tomoyo_mode[config & 3],
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
+			 yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
+			 yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
 }
 
 /**
@@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
 	case 3:
 		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
 			tomoyo_io_printf(head, " grant_log=%s",
-					 tomoyo_yesno(cond->grant_log ==
-						      TOMOYO_GRANTLOG_YES));
+					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
 		tomoyo_set_lf(head);
 		return true;
 	}
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 85246b9df7ca..ca285f362705 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param *param);
 char *tomoyo_realpath_from_path(const struct path *path);
 char *tomoyo_realpath_nofollow(const char *pathname);
 const char *tomoyo_get_exe(void);
-const char *tomoyo_yesno(const unsigned int value);
 const struct tomoyo_path_info *tomoyo_compare_name_union
 (const struct tomoyo_path_info *name, const struct tomoyo_name_union *ptr);
 const struct tomoyo_path_info *tomoyo_get_domainname
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

There are a few implementations of yesno() in the tree. Consolidate them
in include/linux/string_helpers.h.  Quite a few users of open coded
yesno() could later be converted to the new function:

$ git grep '?\s*"yes"\s*' | wc -l
286
$ git grep '?\s*"no"\s*' | wc -l
20

The inlined function should keep the const strings local to each
compilation unit, the same way it's now, thus not changing the current
behavior.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/i915/i915_utils.h              |  5 -----
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  2 ++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 7 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 9d43ecb1f692..b59760f91bf6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include <linux/string_helpers.h>
 #include <linux/uaccess.h>
 
 #include "dc.h"
@@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
 	uint32_t param1;
 };
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 /* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array
  *
  * Function takes in attributes passed to debugfs write entry
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 7a5925072466..2a8781cc648b 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 #define MBps(x) KBps(1000 * (x))
 #define GBps(x) ((u64)1000 * MBps((x)))
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 static inline const char *onoff(bool v)
 {
 	return v ? "on" : "off";
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 7d49fd4edc9e..61a04d7abc1f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2015,17 +2015,6 @@ static const struct file_operations rss_debugfs_fops = {
 /* RSS Configuration.
  */
 
-/* Small utility function to return the strings "yes" or "no" if the supplied
- * argument is non-zero.
- */
-static const char *yesno(int x)
-{
-	static const char *yes = "yes";
-	static const char *no = "no";
-
-	return x ? yes : no;
-}
-
 static int rss_config_show(struct seq_file *seq, void *v)
 {
 	struct adapter *adapter = seq->private;
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4ba39e1403b2..e980dec05d31 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 
 void kfree_strarray(char **array, size_t n);
 
+static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+
 #endif
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index d79bf07e16be..1458e27361e8 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
 		       "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
 		       stamp.year, stamp.month, stamp.day, stamp.hour,
 		       stamp.min, stamp.sec, r->profile, tomoyo_mode[r->mode],
-		       tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
+		       yesno(r->granted), gpid, tomoyo_sys_getpid(),
 		       tomoyo_sys_getppid(),
 		       from_kuid(&init_user_ns, current_uid()),
 		       from_kgid(&init_user_ns, current_gid()),
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c64927bf2b3..304ed0f426dd 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/security.h>
+#include <linux/string_helpers.h>
 #include "common.h"
 
 /* String table for operation mode. */
@@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
 
 /* Utility functions. */
 
-/**
- * tomoyo_yesno - Return "yes" or "no".
- *
- * @value: Bool value.
- */
-const char *tomoyo_yesno(const unsigned int value)
-{
-	return value ? "yes" : "no";
-}
-
 /**
  * tomoyo_addprintf - strncat()-like-snprintf().
  *
@@ -730,8 +721,8 @@ static void tomoyo_print_config(struct tomoyo_io_buffer *head, const u8 config)
 {
 	tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
 			 tomoyo_mode[config & 3],
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
+			 yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
+			 yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
 }
 
 /**
@@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
 	case 3:
 		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
 			tomoyo_io_printf(head, " grant_log=%s",
-					 tomoyo_yesno(cond->grant_log ==
-						      TOMOYO_GRANTLOG_YES));
+					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
 		tomoyo_set_lf(head);
 		return true;
 	}
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 85246b9df7ca..ca285f362705 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param *param);
 char *tomoyo_realpath_from_path(const struct path *path);
 char *tomoyo_realpath_nofollow(const char *pathname);
 const char *tomoyo_get_exe(void);
-const char *tomoyo_yesno(const unsigned int value);
 const struct tomoyo_path_info *tomoyo_compare_name_union
 (const struct tomoyo_path_info *name, const struct tomoyo_name_union *ptr);
 const struct tomoyo_path_info *tomoyo_get_domainname
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

There are a few implementations of yesno() in the tree. Consolidate them
in include/linux/string_helpers.h.  Quite a few users of open coded
yesno() could later be converted to the new function:

$ git grep '?\s*"yes"\s*' | wc -l
286
$ git grep '?\s*"no"\s*' | wc -l
20

The inlined function should keep the const strings local to each
compilation unit, the same way it's now, thus not changing the current
behavior.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/i915/i915_utils.h              |  5 -----
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  2 ++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 7 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 9d43ecb1f692..b59760f91bf6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include <linux/string_helpers.h>
 #include <linux/uaccess.h>
 
 #include "dc.h"
@@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
 	uint32_t param1;
 };
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 /* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array
  *
  * Function takes in attributes passed to debugfs write entry
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 7a5925072466..2a8781cc648b 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 #define MBps(x) KBps(1000 * (x))
 #define GBps(x) ((u64)1000 * MBps((x)))
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 static inline const char *onoff(bool v)
 {
 	return v ? "on" : "off";
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 7d49fd4edc9e..61a04d7abc1f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2015,17 +2015,6 @@ static const struct file_operations rss_debugfs_fops = {
 /* RSS Configuration.
  */
 
-/* Small utility function to return the strings "yes" or "no" if the supplied
- * argument is non-zero.
- */
-static const char *yesno(int x)
-{
-	static const char *yes = "yes";
-	static const char *no = "no";
-
-	return x ? yes : no;
-}
-
 static int rss_config_show(struct seq_file *seq, void *v)
 {
 	struct adapter *adapter = seq->private;
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4ba39e1403b2..e980dec05d31 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 
 void kfree_strarray(char **array, size_t n);
 
+static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+
 #endif
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index d79bf07e16be..1458e27361e8 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
 		       "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
 		       stamp.year, stamp.month, stamp.day, stamp.hour,
 		       stamp.min, stamp.sec, r->profile, tomoyo_mode[r->mode],
-		       tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
+		       yesno(r->granted), gpid, tomoyo_sys_getpid(),
 		       tomoyo_sys_getppid(),
 		       from_kuid(&init_user_ns, current_uid()),
 		       from_kgid(&init_user_ns, current_gid()),
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c64927bf2b3..304ed0f426dd 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/security.h>
+#include <linux/string_helpers.h>
 #include "common.h"
 
 /* String table for operation mode. */
@@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
 
 /* Utility functions. */
 
-/**
- * tomoyo_yesno - Return "yes" or "no".
- *
- * @value: Bool value.
- */
-const char *tomoyo_yesno(const unsigned int value)
-{
-	return value ? "yes" : "no";
-}
-
 /**
  * tomoyo_addprintf - strncat()-like-snprintf().
  *
@@ -730,8 +721,8 @@ static void tomoyo_print_config(struct tomoyo_io_buffer *head, const u8 config)
 {
 	tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
 			 tomoyo_mode[config & 3],
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
+			 yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
+			 yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
 }
 
 /**
@@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
 	case 3:
 		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
 			tomoyo_io_printf(head, " grant_log=%s",
-					 tomoyo_yesno(cond->grant_log ==
-						      TOMOYO_GRANTLOG_YES));
+					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
 		tomoyo_set_lf(head);
 		return true;
 	}
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 85246b9df7ca..ca285f362705 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param *param);
 char *tomoyo_realpath_from_path(const struct path *path);
 char *tomoyo_realpath_nofollow(const char *pathname);
 const char *tomoyo_get_exe(void);
-const char *tomoyo_yesno(const unsigned int value);
 const struct tomoyo_path_info *tomoyo_compare_name_union
 (const struct tomoyo_path_info *name, const struct tomoyo_name_union *ptr);
 const struct tomoyo_path_info *tomoyo_get_domainname
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

There are a few implementations of yesno() in the tree. Consolidate them
in include/linux/string_helpers.h.  Quite a few users of open coded
yesno() could later be converted to the new function:

$ git grep '?\s*"yes"\s*' | wc -l
286
$ git grep '?\s*"no"\s*' | wc -l
20

The inlined function should keep the const strings local to each
compilation unit, the same way it's now, thus not changing the current
behavior.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/i915/i915_utils.h              |  5 -----
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  2 ++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 7 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 9d43ecb1f692..b59760f91bf6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include <linux/string_helpers.h>
 #include <linux/uaccess.h>
 
 #include "dc.h"
@@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
 	uint32_t param1;
 };
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 /* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array
  *
  * Function takes in attributes passed to debugfs write entry
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 7a5925072466..2a8781cc648b 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 #define MBps(x) KBps(1000 * (x))
 #define GBps(x) ((u64)1000 * MBps((x)))
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 static inline const char *onoff(bool v)
 {
 	return v ? "on" : "off";
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 7d49fd4edc9e..61a04d7abc1f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2015,17 +2015,6 @@ static const struct file_operations rss_debugfs_fops = {
 /* RSS Configuration.
  */
 
-/* Small utility function to return the strings "yes" or "no" if the supplied
- * argument is non-zero.
- */
-static const char *yesno(int x)
-{
-	static const char *yes = "yes";
-	static const char *no = "no";
-
-	return x ? yes : no;
-}
-
 static int rss_config_show(struct seq_file *seq, void *v)
 {
 	struct adapter *adapter = seq->private;
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4ba39e1403b2..e980dec05d31 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 
 void kfree_strarray(char **array, size_t n);
 
+static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+
 #endif
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index d79bf07e16be..1458e27361e8 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
 		       "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
 		       stamp.year, stamp.month, stamp.day, stamp.hour,
 		       stamp.min, stamp.sec, r->profile, tomoyo_mode[r->mode],
-		       tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
+		       yesno(r->granted), gpid, tomoyo_sys_getpid(),
 		       tomoyo_sys_getppid(),
 		       from_kuid(&init_user_ns, current_uid()),
 		       from_kgid(&init_user_ns, current_gid()),
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c64927bf2b3..304ed0f426dd 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/security.h>
+#include <linux/string_helpers.h>
 #include "common.h"
 
 /* String table for operation mode. */
@@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
 
 /* Utility functions. */
 
-/**
- * tomoyo_yesno - Return "yes" or "no".
- *
- * @value: Bool value.
- */
-const char *tomoyo_yesno(const unsigned int value)
-{
-	return value ? "yes" : "no";
-}
-
 /**
  * tomoyo_addprintf - strncat()-like-snprintf().
  *
@@ -730,8 +721,8 @@ static void tomoyo_print_config(struct tomoyo_io_buffer *head, const u8 config)
 {
 	tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
 			 tomoyo_mode[config & 3],
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
+			 yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
+			 yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
 }
 
 /**
@@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
 	case 3:
 		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
 			tomoyo_io_printf(head, " grant_log=%s",
-					 tomoyo_yesno(cond->grant_log ==
-						      TOMOYO_GRANTLOG_YES));
+					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
 		tomoyo_set_lf(head);
 		return true;
 	}
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 85246b9df7ca..ca285f362705 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param *param);
 char *tomoyo_realpath_from_path(const struct path *path);
 char *tomoyo_realpath_nofollow(const char *pathname);
 const char *tomoyo_get_exe(void);
-const char *tomoyo_yesno(const unsigned int value);
 const struct tomoyo_path_info *tomoyo_compare_name_union
 (const struct tomoyo_path_info *name, const struct tomoyo_name_union *ptr);
 const struct tomoyo_path_info *tomoyo_get_domainname
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

There are a few implementations of yesno() in the tree. Consolidate them
in include/linux/string_helpers.h.  Quite a few users of open coded
yesno() could later be converted to the new function:

$ git grep '?\s*"yes"\s*' | wc -l
286
$ git grep '?\s*"no"\s*' | wc -l
20

The inlined function should keep the const strings local to each
compilation unit, the same way it's now, thus not changing the current
behavior.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
 drivers/gpu/drm/i915/i915_utils.h              |  5 -----
 .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
 include/linux/string_helpers.h                 |  2 ++
 security/tomoyo/audit.c                        |  2 +-
 security/tomoyo/common.c                       | 18 ++++--------------
 security/tomoyo/common.h                       |  1 -
 7 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 9d43ecb1f692..b59760f91bf6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include <linux/string_helpers.h>
 #include <linux/uaccess.h>
 
 #include "dc.h"
@@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
 	uint32_t param1;
 };
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 /* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array
  *
  * Function takes in attributes passed to debugfs write entry
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 7a5925072466..2a8781cc648b 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 #define MBps(x) KBps(1000 * (x))
 #define GBps(x) ((u64)1000 * MBps((x)))
 
-static inline const char *yesno(bool v)
-{
-	return v ? "yes" : "no";
-}
-
 static inline const char *onoff(bool v)
 {
 	return v ? "on" : "off";
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 7d49fd4edc9e..61a04d7abc1f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2015,17 +2015,6 @@ static const struct file_operations rss_debugfs_fops = {
 /* RSS Configuration.
  */
 
-/* Small utility function to return the strings "yes" or "no" if the supplied
- * argument is non-zero.
- */
-static const char *yesno(int x)
-{
-	static const char *yes = "yes";
-	static const char *no = "no";
-
-	return x ? yes : no;
-}
-
 static int rss_config_show(struct seq_file *seq, void *v)
 {
 	struct adapter *adapter = seq->private;
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4ba39e1403b2..e980dec05d31 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 
 void kfree_strarray(char **array, size_t n);
 
+static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+
 #endif
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
index d79bf07e16be..1458e27361e8 100644
--- a/security/tomoyo/audit.c
+++ b/security/tomoyo/audit.c
@@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
 		       "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
 		       stamp.year, stamp.month, stamp.day, stamp.hour,
 		       stamp.min, stamp.sec, r->profile, tomoyo_mode[r->mode],
-		       tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
+		       yesno(r->granted), gpid, tomoyo_sys_getpid(),
 		       tomoyo_sys_getppid(),
 		       from_kuid(&init_user_ns, current_uid()),
 		       from_kgid(&init_user_ns, current_gid()),
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c64927bf2b3..304ed0f426dd 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -8,6 +8,7 @@
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/security.h>
+#include <linux/string_helpers.h>
 #include "common.h"
 
 /* String table for operation mode. */
@@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
 
 /* Utility functions. */
 
-/**
- * tomoyo_yesno - Return "yes" or "no".
- *
- * @value: Bool value.
- */
-const char *tomoyo_yesno(const unsigned int value)
-{
-	return value ? "yes" : "no";
-}
-
 /**
  * tomoyo_addprintf - strncat()-like-snprintf().
  *
@@ -730,8 +721,8 @@ static void tomoyo_print_config(struct tomoyo_io_buffer *head, const u8 config)
 {
 	tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
 			 tomoyo_mode[config & 3],
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
-			 tomoyo_yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
+			 yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
+			 yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
 }
 
 /**
@@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
 	case 3:
 		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
 			tomoyo_io_printf(head, " grant_log=%s",
-					 tomoyo_yesno(cond->grant_log ==
-						      TOMOYO_GRANTLOG_YES));
+					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
 		tomoyo_set_lf(head);
 		return true;
 	}
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 85246b9df7ca..ca285f362705 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param *param);
 char *tomoyo_realpath_from_path(const struct path *path);
 char *tomoyo_realpath_nofollow(const char *pathname);
 const char *tomoyo_get_exe(void);
-const char *tomoyo_yesno(const unsigned int value);
 const struct tomoyo_path_info *tomoyo_compare_name_union
 (const struct tomoyo_path_info *name, const struct tomoyo_name_union *ptr);
 const struct tomoyo_path_info *tomoyo_get_domainname
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
  2022-01-19  7:24 ` Lucas De Marchi
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-19  7:24   ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Alex Deucher, Andrew Morton, Andy Shevchenko, Andy Shevchenko,
	Ben Skeggs, Christian König, Chris Wilson, Daniel Vetter,
	David Airlie, David S . Miller, Emma Anholt, Eryk Brol,
	Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Steven Rostedt,
	Vishal Kulkarni

Follow the yes/no logic and add helpers for enabled/disabled and
enable/disable - those are not so common throughout the kernel,
but they give a nice way to reuse the strings to log things as
enabled/disabled or enable/disable.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 10 ----------
 include/linux/string_helpers.h    |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 2a8781cc648b..cbec79bae0d2 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
 	return v ? "on" : "off";
 }
 
-static inline const char *enabledisable(bool v)
-{
-	return v ? "enable" : "disable";
-}
-
-static inline const char *enableddisabled(bool v)
-{
-	return v ? "enabled" : "disabled";
-}
-
 void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
 static inline void __add_taint_for_CI(unsigned int taint)
 {
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index e980dec05d31..e4b82f364ee1 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 void kfree_strarray(char **array, size_t n);
 
 static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+static inline const char *enabledisable(bool v) { return v ? "enable" : "disable"; }
+static inline const char *enableddisabled(bool v) { return v ? "enabled" : "disabled"; }
 
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Follow the yes/no logic and add helpers for enabled/disabled and
enable/disable - those are not so common throughout the kernel,
but they give a nice way to reuse the strings to log things as
enabled/disabled or enable/disable.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 10 ----------
 include/linux/string_helpers.h    |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 2a8781cc648b..cbec79bae0d2 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
 	return v ? "on" : "off";
 }
 
-static inline const char *enabledisable(bool v)
-{
-	return v ? "enable" : "disable";
-}
-
-static inline const char *enableddisabled(bool v)
-{
-	return v ? "enabled" : "disabled";
-}
-
 void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
 static inline void __add_taint_for_CI(unsigned int taint)
 {
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index e980dec05d31..e4b82f364ee1 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 void kfree_strarray(char **array, size_t n);
 
 static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+static inline const char *enabledisable(bool v) { return v ? "enable" : "disable"; }
+static inline const char *enableddisabled(bool v) { return v ? "enabled" : "disabled"; }
 
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Intel-gfx] [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Follow the yes/no logic and add helpers for enabled/disabled and
enable/disable - those are not so common throughout the kernel,
but they give a nice way to reuse the strings to log things as
enabled/disabled or enable/disable.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 10 ----------
 include/linux/string_helpers.h    |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 2a8781cc648b..cbec79bae0d2 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
 	return v ? "on" : "off";
 }
 
-static inline const char *enabledisable(bool v)
-{
-	return v ? "enable" : "disable";
-}
-
-static inline const char *enableddisabled(bool v)
-{
-	return v ? "enabled" : "disabled";
-}
-
 void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
 static inline void __add_taint_for_CI(unsigned int taint)
 {
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index e980dec05d31..e4b82f364ee1 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 void kfree_strarray(char **array, size_t n);
 
 static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+static inline const char *enabledisable(bool v) { return v ? "enable" : "disable"; }
+static inline const char *enableddisabled(bool v) { return v ? "enabled" : "disabled"; }
 
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Follow the yes/no logic and add helpers for enabled/disabled and
enable/disable - those are not so common throughout the kernel,
but they give a nice way to reuse the strings to log things as
enabled/disabled or enable/disable.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 10 ----------
 include/linux/string_helpers.h    |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 2a8781cc648b..cbec79bae0d2 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
 	return v ? "on" : "off";
 }
 
-static inline const char *enabledisable(bool v)
-{
-	return v ? "enable" : "disable";
-}
-
-static inline const char *enableddisabled(bool v)
-{
-	return v ? "enabled" : "disabled";
-}
-
 void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
 static inline void __add_taint_for_CI(unsigned int taint)
 {
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index e980dec05d31..e4b82f364ee1 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 void kfree_strarray(char **array, size_t n);
 
 static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+static inline const char *enabledisable(bool v) { return v ? "enable" : "disable"; }
+static inline const char *enableddisabled(bool v) { return v ? "enabled" : "disabled"; }
 
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Nouveau] [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

Follow the yes/no logic and add helpers for enabled/disabled and
enable/disable - those are not so common throughout the kernel,
but they give a nice way to reuse the strings to log things as
enabled/disabled or enable/disable.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 10 ----------
 include/linux/string_helpers.h    |  2 ++
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 2a8781cc648b..cbec79bae0d2 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
 	return v ? "on" : "off";
 }
 
-static inline const char *enabledisable(bool v)
-{
-	return v ? "enable" : "disable";
-}
-
-static inline const char *enableddisabled(bool v)
-{
-	return v ? "enabled" : "disabled";
-}
-
 void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
 static inline void __add_taint_for_CI(unsigned int taint)
 {
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index e980dec05d31..e4b82f364ee1 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
 void kfree_strarray(char **array, size_t n);
 
 static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
+static inline const char *enabledisable(bool v) { return v ? "enable" : "disable"; }
+static inline const char *enableddisabled(bool v) { return v ? "enabled" : "disabled"; }
 
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 3/3] drm: Convert open yes/no strings to yesno()
  2022-01-19  7:24 ` Lucas De Marchi
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-19  7:24   ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Alex Deucher, Andrew Morton, Andy Shevchenko, Andy Shevchenko,
	Ben Skeggs, Christian König, Chris Wilson, Daniel Vetter,
	David Airlie, David S . Miller, Emma Anholt, Eryk Brol,
	Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Steven Rostedt,
	Vishal Kulkarni

linux/string_helpers.h provides a helper to return "yes"/"no"
strings. Replace the open coded versions with yesno(). The places were
identified with the following semantic patch:

	@@
	expression b;
	@@

	- b ? "yes" : "no"
	+ yesno(b)

Then the includes were added, so we include-what-we-use, and parenthesis
adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
still see the same binary sizes:

   text    data     bss     dec     hex filename
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/atom.c             |  3 ++-
 drivers/gpu/drm/drm_client_modeset.c          |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c               |  3 ++-
 drivers/gpu/drm/drm_gem.c                     |  3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c |  4 +++-
 drivers/gpu/drm/radeon/atom.c                 |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c             | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c      |  3 ++-
 8 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 6fa2229b7229..3d7d0f4cfc05 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 #include <asm/unaligned.h>
 
 #include <drm/drm_util.h>
@@ -740,7 +741,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..3c55156a75fa 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_client.h>
@@ -241,7 +242,7 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
 		connector = connectors[i];
 		enabled[i] = drm_connector_enabled(connector, true);
 		DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
-			      connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+			      connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));
 
 		any_enabled |= enabled[i];
 	}
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 4d0d1e8e51fa..f600616839f3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_print.h>
@@ -1122,7 +1123,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
 	bool branch_device = drm_dp_is_branch(dpcd);
 
 	seq_printf(m, "\tDP branch device present: %s\n",
-		   branch_device ? "yes" : "no");
+		   yesno(branch_device));
 
 	if (!branch_device)
 		return;
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4dcdec6487bb..6436876341bb 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -39,6 +39,7 @@
 #include <linux/dma-buf-map.h>
 #include <linux/mem_encrypt.h>
 #include <linux/pagevec.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm.h>
 #include <drm/drm_device.h>
@@ -1145,7 +1146,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
 			  drm_vma_node_start(&obj->vma_node));
 	drm_printf_indent(p, indent, "size=%zu\n", obj->size);
 	drm_printf_indent(p, indent, "imported=%s\n",
-			  obj->import_attach ? "yes" : "no");
+			  yesno(obj->import_attach));
 
 	if (obj->funcs->print_info)
 		obj->funcs->print_info(p, indent, obj);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index a11637b0f6cc..d39a9c1a2a6e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -21,6 +21,8 @@
  *
  * Authors: Ben Skeggs
  */
+#include <linux/string_helpers.h>
+
 #include "aux.h"
 #include "pad.h"
 
@@ -94,7 +96,7 @@ void
 nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)
 {
 	struct nvkm_i2c_pad *pad = aux->pad;
-	AUX_TRACE(aux, "monitor: %s", monitor ? "yes" : "no");
+	AUX_TRACE(aux, "monitor: %s", yesno(monitor));
 	if (monitor)
 		nvkm_i2c_pad_mode(pad, NVKM_I2C_PAD_AUX);
 	else
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index f15b20da5315..77ef7d136530 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <asm/unaligned.h>
 
@@ -722,7 +723,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index e76b24bb8828..22c23f3a691e 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -6,6 +6,7 @@
 #include <linux/debugfs.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 
@@ -148,15 +149,15 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV),
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPIDX));
 	seq_printf(m, "MMU:        %s\n",
-		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
+		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
 	seq_printf(m, "TFU:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
 	seq_printf(m, "TSY:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
 	seq_printf(m, "MSO:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
 	seq_printf(m, "L3C:        %s (%dkb)\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
 		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
 
 	for (core = 0; core < cores; core++) {
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index b6954e2f75e6..c7f675721840 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -22,6 +22,7 @@
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 #include <drm/drm_file.h>
@@ -31,7 +32,7 @@
 static void virtio_gpu_add_bool(struct seq_file *m, const char *name,
 				bool value)
 {
-	seq_printf(m, "%-16s : %s\n", name, value ? "yes" : "no");
+	seq_printf(m, "%-16s : %s\n", name, yesno(value));
 }
 
 static void virtio_gpu_add_int(struct seq_file *m, const char *name, int value)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

linux/string_helpers.h provides a helper to return "yes"/"no"
strings. Replace the open coded versions with yesno(). The places were
identified with the following semantic patch:

	@@
	expression b;
	@@

	- b ? "yes" : "no"
	+ yesno(b)

Then the includes were added, so we include-what-we-use, and parenthesis
adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
still see the same binary sizes:

   text    data     bss     dec     hex filename
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/atom.c             |  3 ++-
 drivers/gpu/drm/drm_client_modeset.c          |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c               |  3 ++-
 drivers/gpu/drm/drm_gem.c                     |  3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c |  4 +++-
 drivers/gpu/drm/radeon/atom.c                 |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c             | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c      |  3 ++-
 8 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 6fa2229b7229..3d7d0f4cfc05 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 #include <asm/unaligned.h>
 
 #include <drm/drm_util.h>
@@ -740,7 +741,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..3c55156a75fa 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_client.h>
@@ -241,7 +242,7 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
 		connector = connectors[i];
 		enabled[i] = drm_connector_enabled(connector, true);
 		DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
-			      connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+			      connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));
 
 		any_enabled |= enabled[i];
 	}
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 4d0d1e8e51fa..f600616839f3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_print.h>
@@ -1122,7 +1123,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
 	bool branch_device = drm_dp_is_branch(dpcd);
 
 	seq_printf(m, "\tDP branch device present: %s\n",
-		   branch_device ? "yes" : "no");
+		   yesno(branch_device));
 
 	if (!branch_device)
 		return;
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4dcdec6487bb..6436876341bb 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -39,6 +39,7 @@
 #include <linux/dma-buf-map.h>
 #include <linux/mem_encrypt.h>
 #include <linux/pagevec.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm.h>
 #include <drm/drm_device.h>
@@ -1145,7 +1146,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
 			  drm_vma_node_start(&obj->vma_node));
 	drm_printf_indent(p, indent, "size=%zu\n", obj->size);
 	drm_printf_indent(p, indent, "imported=%s\n",
-			  obj->import_attach ? "yes" : "no");
+			  yesno(obj->import_attach));
 
 	if (obj->funcs->print_info)
 		obj->funcs->print_info(p, indent, obj);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index a11637b0f6cc..d39a9c1a2a6e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -21,6 +21,8 @@
  *
  * Authors: Ben Skeggs
  */
+#include <linux/string_helpers.h>
+
 #include "aux.h"
 #include "pad.h"
 
@@ -94,7 +96,7 @@ void
 nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)
 {
 	struct nvkm_i2c_pad *pad = aux->pad;
-	AUX_TRACE(aux, "monitor: %s", monitor ? "yes" : "no");
+	AUX_TRACE(aux, "monitor: %s", yesno(monitor));
 	if (monitor)
 		nvkm_i2c_pad_mode(pad, NVKM_I2C_PAD_AUX);
 	else
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index f15b20da5315..77ef7d136530 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <asm/unaligned.h>
 
@@ -722,7 +723,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index e76b24bb8828..22c23f3a691e 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -6,6 +6,7 @@
 #include <linux/debugfs.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 
@@ -148,15 +149,15 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV),
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPIDX));
 	seq_printf(m, "MMU:        %s\n",
-		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
+		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
 	seq_printf(m, "TFU:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
 	seq_printf(m, "TSY:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
 	seq_printf(m, "MSO:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
 	seq_printf(m, "L3C:        %s (%dkb)\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
 		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
 
 	for (core = 0; core < cores; core++) {
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index b6954e2f75e6..c7f675721840 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -22,6 +22,7 @@
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 #include <drm/drm_file.h>
@@ -31,7 +32,7 @@
 static void virtio_gpu_add_bool(struct seq_file *m, const char *name,
 				bool value)
 {
-	seq_printf(m, "%-16s : %s\n", name, value ? "yes" : "no");
+	seq_printf(m, "%-16s : %s\n", name, yesno(value));
 }
 
 static void virtio_gpu_add_int(struct seq_file *m, const char *name, int value)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Intel-gfx] [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

linux/string_helpers.h provides a helper to return "yes"/"no"
strings. Replace the open coded versions with yesno(). The places were
identified with the following semantic patch:

	@@
	expression b;
	@@

	- b ? "yes" : "no"
	+ yesno(b)

Then the includes were added, so we include-what-we-use, and parenthesis
adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
still see the same binary sizes:

   text    data     bss     dec     hex filename
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/atom.c             |  3 ++-
 drivers/gpu/drm/drm_client_modeset.c          |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c               |  3 ++-
 drivers/gpu/drm/drm_gem.c                     |  3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c |  4 +++-
 drivers/gpu/drm/radeon/atom.c                 |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c             | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c      |  3 ++-
 8 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 6fa2229b7229..3d7d0f4cfc05 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 #include <asm/unaligned.h>
 
 #include <drm/drm_util.h>
@@ -740,7 +741,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..3c55156a75fa 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_client.h>
@@ -241,7 +242,7 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
 		connector = connectors[i];
 		enabled[i] = drm_connector_enabled(connector, true);
 		DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
-			      connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+			      connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));
 
 		any_enabled |= enabled[i];
 	}
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 4d0d1e8e51fa..f600616839f3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_print.h>
@@ -1122,7 +1123,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
 	bool branch_device = drm_dp_is_branch(dpcd);
 
 	seq_printf(m, "\tDP branch device present: %s\n",
-		   branch_device ? "yes" : "no");
+		   yesno(branch_device));
 
 	if (!branch_device)
 		return;
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4dcdec6487bb..6436876341bb 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -39,6 +39,7 @@
 #include <linux/dma-buf-map.h>
 #include <linux/mem_encrypt.h>
 #include <linux/pagevec.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm.h>
 #include <drm/drm_device.h>
@@ -1145,7 +1146,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
 			  drm_vma_node_start(&obj->vma_node));
 	drm_printf_indent(p, indent, "size=%zu\n", obj->size);
 	drm_printf_indent(p, indent, "imported=%s\n",
-			  obj->import_attach ? "yes" : "no");
+			  yesno(obj->import_attach));
 
 	if (obj->funcs->print_info)
 		obj->funcs->print_info(p, indent, obj);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index a11637b0f6cc..d39a9c1a2a6e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -21,6 +21,8 @@
  *
  * Authors: Ben Skeggs
  */
+#include <linux/string_helpers.h>
+
 #include "aux.h"
 #include "pad.h"
 
@@ -94,7 +96,7 @@ void
 nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)
 {
 	struct nvkm_i2c_pad *pad = aux->pad;
-	AUX_TRACE(aux, "monitor: %s", monitor ? "yes" : "no");
+	AUX_TRACE(aux, "monitor: %s", yesno(monitor));
 	if (monitor)
 		nvkm_i2c_pad_mode(pad, NVKM_I2C_PAD_AUX);
 	else
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index f15b20da5315..77ef7d136530 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <asm/unaligned.h>
 
@@ -722,7 +723,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index e76b24bb8828..22c23f3a691e 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -6,6 +6,7 @@
 #include <linux/debugfs.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 
@@ -148,15 +149,15 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV),
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPIDX));
 	seq_printf(m, "MMU:        %s\n",
-		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
+		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
 	seq_printf(m, "TFU:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
 	seq_printf(m, "TSY:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
 	seq_printf(m, "MSO:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
 	seq_printf(m, "L3C:        %s (%dkb)\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
 		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
 
 	for (core = 0; core < cores; core++) {
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index b6954e2f75e6..c7f675721840 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -22,6 +22,7 @@
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 #include <drm/drm_file.h>
@@ -31,7 +32,7 @@
 static void virtio_gpu_add_bool(struct seq_file *m, const char *name,
 				bool value)
 {
-	seq_printf(m, "%-16s : %s\n", name, value ? "yes" : "no");
+	seq_printf(m, "%-16s : %s\n", name, yesno(value));
 }
 
 static void virtio_gpu_add_int(struct seq_file *m, const char *name, int value)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

linux/string_helpers.h provides a helper to return "yes"/"no"
strings. Replace the open coded versions with yesno(). The places were
identified with the following semantic patch:

	@@
	expression b;
	@@

	- b ? "yes" : "no"
	+ yesno(b)

Then the includes were added, so we include-what-we-use, and parenthesis
adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
still see the same binary sizes:

   text    data     bss     dec     hex filename
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/atom.c             |  3 ++-
 drivers/gpu/drm/drm_client_modeset.c          |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c               |  3 ++-
 drivers/gpu/drm/drm_gem.c                     |  3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c |  4 +++-
 drivers/gpu/drm/radeon/atom.c                 |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c             | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c      |  3 ++-
 8 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 6fa2229b7229..3d7d0f4cfc05 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 #include <asm/unaligned.h>
 
 #include <drm/drm_util.h>
@@ -740,7 +741,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..3c55156a75fa 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_client.h>
@@ -241,7 +242,7 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
 		connector = connectors[i];
 		enabled[i] = drm_connector_enabled(connector, true);
 		DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
-			      connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+			      connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));
 
 		any_enabled |= enabled[i];
 	}
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 4d0d1e8e51fa..f600616839f3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_print.h>
@@ -1122,7 +1123,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
 	bool branch_device = drm_dp_is_branch(dpcd);
 
 	seq_printf(m, "\tDP branch device present: %s\n",
-		   branch_device ? "yes" : "no");
+		   yesno(branch_device));
 
 	if (!branch_device)
 		return;
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4dcdec6487bb..6436876341bb 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -39,6 +39,7 @@
 #include <linux/dma-buf-map.h>
 #include <linux/mem_encrypt.h>
 #include <linux/pagevec.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm.h>
 #include <drm/drm_device.h>
@@ -1145,7 +1146,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
 			  drm_vma_node_start(&obj->vma_node));
 	drm_printf_indent(p, indent, "size=%zu\n", obj->size);
 	drm_printf_indent(p, indent, "imported=%s\n",
-			  obj->import_attach ? "yes" : "no");
+			  yesno(obj->import_attach));
 
 	if (obj->funcs->print_info)
 		obj->funcs->print_info(p, indent, obj);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index a11637b0f6cc..d39a9c1a2a6e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -21,6 +21,8 @@
  *
  * Authors: Ben Skeggs
  */
+#include <linux/string_helpers.h>
+
 #include "aux.h"
 #include "pad.h"
 
@@ -94,7 +96,7 @@ void
 nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)
 {
 	struct nvkm_i2c_pad *pad = aux->pad;
-	AUX_TRACE(aux, "monitor: %s", monitor ? "yes" : "no");
+	AUX_TRACE(aux, "monitor: %s", yesno(monitor));
 	if (monitor)
 		nvkm_i2c_pad_mode(pad, NVKM_I2C_PAD_AUX);
 	else
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index f15b20da5315..77ef7d136530 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <asm/unaligned.h>
 
@@ -722,7 +723,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index e76b24bb8828..22c23f3a691e 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -6,6 +6,7 @@
 #include <linux/debugfs.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 
@@ -148,15 +149,15 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV),
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPIDX));
 	seq_printf(m, "MMU:        %s\n",
-		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
+		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
 	seq_printf(m, "TFU:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
 	seq_printf(m, "TSY:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
 	seq_printf(m, "MSO:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
 	seq_printf(m, "L3C:        %s (%dkb)\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
 		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
 
 	for (core = 0; core < cores; core++) {
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index b6954e2f75e6..c7f675721840 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -22,6 +22,7 @@
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 #include <drm/drm_file.h>
@@ -31,7 +32,7 @@
 static void virtio_gpu_add_bool(struct seq_file *m, const char *name,
 				bool value)
 {
-	seq_printf(m, "%-16s : %s\n", name, value ? "yes" : "no");
+	seq_printf(m, "%-16s : %s\n", name, yesno(value));
 }
 
 static void virtio_gpu_add_int(struct seq_file *m, const char *name, int value)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Nouveau] [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19  7:24   ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  7:24 UTC (permalink / raw)
  To: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

linux/string_helpers.h provides a helper to return "yes"/"no"
strings. Replace the open coded versions with yesno(). The places were
identified with the following semantic patch:

	@@
	expression b;
	@@

	- b ? "yes" : "no"
	+ yesno(b)

Then the includes were added, so we include-what-we-use, and parenthesis
adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
still see the same binary sizes:

   text    data     bss     dec     hex filename
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
 411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/amd/amdgpu/atom.c             |  3 ++-
 drivers/gpu/drm/drm_client_modeset.c          |  3 ++-
 drivers/gpu/drm/drm_dp_helper.c               |  3 ++-
 drivers/gpu/drm/drm_gem.c                     |  3 ++-
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c |  4 +++-
 drivers/gpu/drm/radeon/atom.c                 |  3 ++-
 drivers/gpu/drm/v3d/v3d_debugfs.c             | 11 ++++++-----
 drivers/gpu/drm/virtio/virtgpu_debugfs.c      |  3 ++-
 8 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 6fa2229b7229..3d7d0f4cfc05 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 #include <asm/unaligned.h>
 
 #include <drm/drm_util.h>
@@ -740,7 +741,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index ced09c7c06f9..3c55156a75fa 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_client.h>
@@ -241,7 +242,7 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
 		connector = connectors[i];
 		enabled[i] = drm_connector_enabled(connector, true);
 		DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
-			      connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+			      connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));
 
 		any_enabled |= enabled[i];
 	}
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 4d0d1e8e51fa..f600616839f3 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_print.h>
@@ -1122,7 +1123,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
 	bool branch_device = drm_dp_is_branch(dpcd);
 
 	seq_printf(m, "\tDP branch device present: %s\n",
-		   branch_device ? "yes" : "no");
+		   yesno(branch_device));
 
 	if (!branch_device)
 		return;
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4dcdec6487bb..6436876341bb 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -39,6 +39,7 @@
 #include <linux/dma-buf-map.h>
 #include <linux/mem_encrypt.h>
 #include <linux/pagevec.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm.h>
 #include <drm/drm_device.h>
@@ -1145,7 +1146,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
 			  drm_vma_node_start(&obj->vma_node));
 	drm_printf_indent(p, indent, "size=%zu\n", obj->size);
 	drm_printf_indent(p, indent, "imported=%s\n",
-			  obj->import_attach ? "yes" : "no");
+			  yesno(obj->import_attach));
 
 	if (obj->funcs->print_info)
 		obj->funcs->print_info(p, indent, obj);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index a11637b0f6cc..d39a9c1a2a6e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -21,6 +21,8 @@
  *
  * Authors: Ben Skeggs
  */
+#include <linux/string_helpers.h>
+
 #include "aux.h"
 #include "pad.h"
 
@@ -94,7 +96,7 @@ void
 nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)
 {
 	struct nvkm_i2c_pad *pad = aux->pad;
-	AUX_TRACE(aux, "monitor: %s", monitor ? "yes" : "no");
+	AUX_TRACE(aux, "monitor: %s", yesno(monitor));
 	if (monitor)
 		nvkm_i2c_pad_mode(pad, NVKM_I2C_PAD_AUX);
 	else
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index f15b20da5315..77ef7d136530 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/string_helpers.h>
 
 #include <asm/unaligned.h>
 
@@ -722,7 +723,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
 		break;
 	}
 	if (arg != ATOM_COND_ALWAYS)
-		SDEBUG("   taken: %s\n", execute ? "yes" : "no");
+		SDEBUG("   taken: %s\n", yesno(execute));
 	SDEBUG("   target: 0x%04X\n", target);
 	if (execute) {
 		if (ctx->last_jump == (ctx->start + target)) {
diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index e76b24bb8828..22c23f3a691e 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -6,6 +6,7 @@
 #include <linux/debugfs.h>
 #include <linux/pm_runtime.h>
 #include <linux/seq_file.h>
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 
@@ -148,15 +149,15 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV),
 		   V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPIDX));
 	seq_printf(m, "MMU:        %s\n",
-		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
+		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
 	seq_printf(m, "TFU:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
 	seq_printf(m, "TSY:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
 	seq_printf(m, "MSO:        %s\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
 	seq_printf(m, "L3C:        %s (%dkb)\n",
-		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
+		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
 		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
 
 	for (core = 0; core < cores; core++) {
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index b6954e2f75e6..c7f675721840 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -22,6 +22,7 @@
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 #include <drm/drm_file.h>
@@ -31,7 +32,7 @@
 static void virtio_gpu_add_bool(struct seq_file *m, const char *name,
 				bool value)
 {
-	seq_printf(m, "%-16s : %s\n", name, value ? "yes" : "no");
+	seq_printf(m, "%-16s : %s\n", name, yesno(value));
 }
 
 static void virtio_gpu_add_int(struct seq_file *m, const char *name, int value)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 160+ messages in thread

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
                   ` (6 preceding siblings ...)
  (?)
@ 2022-01-19  7:34 ` Patchwork
  -1 siblings, 0 replies; 160+ messages in thread
From: Patchwork @ 2022-01-19  7:34 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

== Series Details ==

Series: lib/string_helpers: Add a few string helpers
URL   : https://patchwork.freedesktop.org/series/99030/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
034eadde40c9 lib/string_helpers: Consolidate yesno() implementation
89d43a829163 lib/string_helpers: Add helpers for enable[d]/disable[d]
e313af85bf87 drm: Convert open yes/no strings to yesno()
-:23: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#23: 
1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old

-:92: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#92: FILE: drivers/gpu/drm/drm_client_modeset.c:245:
+			      connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));

total: 0 errors, 2 warnings, 0 checks, 133 lines checked



^ permalink raw reply	[flat|nested] 160+ messages in thread

* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
                   ` (7 preceding siblings ...)
  (?)
@ 2022-01-19  7:37 ` Patchwork
  -1 siblings, 0 replies; 160+ messages in thread
From: Patchwork @ 2022-01-19  7:37 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

== Series Details ==

Series: lib/string_helpers: Add a few string helpers
URL   : https://patchwork.freedesktop.org/series/99030/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-19  8:02   ` Jani Nikula
  -1 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19  8:02 UTC (permalink / raw)
  To: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

On Tue, 18 Jan 2022, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.

Thanks for picking this up again. I agree with the approach here.

Acked-by: Jani Nikula <jani.nikula@intel.com>

>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.
>
> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  8:02   ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19  8:02 UTC (permalink / raw)
  To: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Alex Deucher, Andrew Morton, Andy Shevchenko, Andy Shevchenko,
	Ben Skeggs, Christian König, 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, Petr Mladek, Rahul Lakkireddy,
	Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi, Sakari Ailus,
	Sergey Senozhatsky, Steven Rostedt, Vishal Kulkarni

On Tue, 18 Jan 2022, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.

Thanks for picking this up again. I agree with the approach here.

Acked-by: Jani Nikula <jani.nikula@intel.com>

>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.
>
> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  8:02   ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19  8:02 UTC (permalink / raw)
  To: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, Christian König, Sergey Senozhatsky,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

On Tue, 18 Jan 2022, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.

Thanks for picking this up again. I agree with the approach here.

Acked-by: Jani Nikula <jani.nikula@intel.com>

>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.
>
> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  8:02   ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19  8:02 UTC (permalink / raw)
  To: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Rasmus Villemoes, Chris Wilson,
	Vishal Kulkarni, Francis Laniel, Kentaro Takeda, Andy Shevchenko,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Raju Rangoju,
	Alex Deucher, Andrew Morton, David S . Miller

On Tue, 18 Jan 2022, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.

Thanks for picking this up again. I agree with the approach here.

Acked-by: Jani Nikula <jani.nikula@intel.com>

>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.
>
> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  8:02   ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19  8:02 UTC (permalink / raw)
  To: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev
  Cc: Emma Anholt, David Airlie, Joonas Lahtinen, Rasmus Villemoes,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Andy Shevchenko, Andy Shevchenko, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	Christian König, Sergey Senozhatsky, Daniel Vetter,
	Raju Rangoju, Alex Deucher, Andrew Morton, David S . Miller

On Tue, 18 Jan 2022, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.

Thanks for picking this up again. I agree with the approach here.

Acked-by: Jani Nikula <jani.nikula@intel.com>

>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.
>
> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* [Intel-gfx] ✓ Fi.CI.BAT: success for lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
                   ` (9 preceding siblings ...)
  (?)
@ 2022-01-19  8:05 ` Patchwork
  -1 siblings, 0 replies; 160+ messages in thread
From: Patchwork @ 2022-01-19  8:05 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 10924 bytes --]

== Series Details ==

Series: lib/string_helpers: Add a few string helpers
URL   : https://patchwork.freedesktop.org/series/99030/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_11094 -> Patchwork_22020
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/index.html

Participating hosts (46 -> 44)
------------------------------

  Additional (3): fi-kbl-soraka fi-icl-u2 bat-adls-5 
  Missing    (5): shard-tglu fi-bsw-cyan shard-rkl shard-dg1 fi-bdw-samus 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_22020:

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@gem_exec_suspend@basic-s3@smem:
    - {bat-adls-5}:       NOTRUN -> [INCOMPLETE][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/bat-adls-5/igt@gem_exec_suspend@basic-s3@smem.html

  
Known issues
------------

  Here are the changes found in Patchwork_22020 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@semaphore:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][2] ([fdo#109271]) +31 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-bdw-5557u/igt@amdgpu/amd_basic@semaphore.html

  * igt@amdgpu/amd_cs_nop@fork-gfx0:
    - fi-icl-u2:          NOTRUN -> [SKIP][3] ([fdo#109315]) +17 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@amdgpu/amd_cs_nop@fork-gfx0.html

  * igt@amdgpu/amd_cs_nop@sync-fork-compute0:
    - fi-snb-2600:        NOTRUN -> [SKIP][4] ([fdo#109271]) +17 similar issues
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-snb-2600/igt@amdgpu/amd_cs_nop@sync-fork-compute0.html

  * igt@gem_exec_fence@basic-busy@bcs0:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][5] ([fdo#109271]) +8 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-kbl-soraka/igt@gem_exec_fence@basic-busy@bcs0.html

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#2190])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html
    - fi-icl-u2:          NOTRUN -> [SKIP][7] ([i915#2190])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@parallel-random-engines:
    - fi-icl-u2:          NOTRUN -> [SKIP][8] ([i915#4613]) +3 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@gem_lmem_swapping@parallel-random-engines.html
    - fi-kbl-soraka:      NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#4613]) +3 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-kbl-soraka/igt@gem_lmem_swapping@parallel-random-engines.html

  * igt@i915_selftest@live@execlists:
    - fi-bsw-nick:        [PASS][10] -> [INCOMPLETE][11] ([i915#2940])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-bsw-nick/igt@i915_selftest@live@execlists.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-bsw-nick/igt@i915_selftest@live@execlists.html

  * igt@i915_selftest@live@gt_pm:
    - fi-kbl-soraka:      NOTRUN -> [DMESG-FAIL][12] ([i915#1886] / [i915#2291])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@gtt:
    - fi-snb-2520m:       [PASS][13] -> [DMESG-FAIL][14] ([i915#4610])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-snb-2520m/igt@i915_selftest@live@gtt.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-snb-2520m/igt@i915_selftest@live@gtt.html

  * igt@kms_chamelium@dp-edid-read:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-kbl-soraka/igt@kms_chamelium@dp-edid-read.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-icl-u2:          NOTRUN -> [SKIP][16] ([fdo#111827]) +8 similar issues
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_chamelium@vga-edid-read:
    - fi-bdw-5557u:       NOTRUN -> [SKIP][17] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-bdw-5557u/igt@kms_chamelium@vga-edid-read.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
    - fi-icl-u2:          NOTRUN -> [SKIP][18] ([fdo#109278]) +2 similar issues
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html

  * igt@kms_force_connector_basic@force-load-detect:
    - fi-icl-u2:          NOTRUN -> [SKIP][19] ([fdo#109285])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][20] ([fdo#109271] / [i915#533])
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-kbl-soraka/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  * igt@kms_pipe_crc_basic@read-crc-pipe-b:
    - fi-cfl-8109u:       [PASS][21] -> [DMESG-WARN][22] ([i915#295]) +12 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-cfl-8109u/igt@kms_pipe_crc_basic@read-crc-pipe-b.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-cfl-8109u/igt@kms_pipe_crc_basic@read-crc-pipe-b.html

  * igt@prime_vgem@basic-userptr:
    - fi-skl-6600u:       NOTRUN -> [SKIP][23] ([fdo#109271]) +18 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-skl-6600u/igt@prime_vgem@basic-userptr.html
    - fi-icl-u2:          NOTRUN -> [SKIP][24] ([i915#3301])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-icl-u2/igt@prime_vgem@basic-userptr.html

  * igt@runner@aborted:
    - fi-snb-2520m:       NOTRUN -> [FAIL][25] ([i915#2426] / [i915#4312])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-snb-2520m/igt@runner@aborted.html
    - fi-bsw-nick:        NOTRUN -> [FAIL][26] ([fdo#109271] / [i915#1436] / [i915#3428] / [i915#4312])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-bsw-nick/igt@runner@aborted.html

  
#### Possible fixes ####

  * igt@gem_exec_suspend@basic-s3@smem:
    - fi-bdw-5557u:       [INCOMPLETE][27] ([i915#146]) -> [PASS][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-bdw-5557u/igt@gem_exec_suspend@basic-s3@smem.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-bdw-5557u/igt@gem_exec_suspend@basic-s3@smem.html

  * igt@i915_selftest@live@gt_heartbeat:
    - {fi-tgl-dsi}:       [INCOMPLETE][29] -> [PASS][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-tgl-dsi/igt@i915_selftest@live@gt_heartbeat.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-tgl-dsi/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@hangcheck:
    - bat-dg1-6:          [DMESG-FAIL][31] ([i915#4494]) -> [PASS][32]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/bat-dg1-6/igt@i915_selftest@live@hangcheck.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/bat-dg1-6/igt@i915_selftest@live@hangcheck.html
    - fi-snb-2600:        [INCOMPLETE][33] ([i915#3921]) -> [PASS][34]
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-snb-2600/igt@i915_selftest@live@hangcheck.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-snb-2600/igt@i915_selftest@live@hangcheck.html

  * igt@kms_psr@primary_page_flip:
    - fi-skl-6600u:       [FAIL][35] ([i915#4547]) -> [PASS][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/fi-skl-6600u/igt@kms_psr@primary_page_flip.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/fi-skl-6600u/igt@kms_psr@primary_page_flip.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
  [i915#146]: https://gitlab.freedesktop.org/drm/intel/issues/146
  [i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
  [i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
  [i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
  [i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
  [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
  [i915#3428]: https://gitlab.freedesktop.org/drm/intel/issues/3428
  [i915#3921]: https://gitlab.freedesktop.org/drm/intel/issues/3921
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4494]: https://gitlab.freedesktop.org/drm/intel/issues/4494
  [i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
  [i915#4610]: https://gitlab.freedesktop.org/drm/intel/issues/4610
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4898]: https://gitlab.freedesktop.org/drm/intel/issues/4898
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533


Build changes
-------------

  * Linux: CI_DRM_11094 -> Patchwork_22020

  CI-20190529: 20190529
  CI_DRM_11094: 6ce31c986ee8beaa0f98fd4e200b7a421fd4adf9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6327: 0d559158c2d3b5723abbfc2cb4b04532e28663b2 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_22020: e313af85bf87c0bb8eaf5dce4f1bb1aa5d698aef @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

e313af85bf87 drm: Convert open yes/no strings to yesno()
89d43a829163 lib/string_helpers: Add helpers for enable[d]/disable[d]
034eadde40c9 lib/string_helpers: Consolidate yesno() implementation

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/index.html

[-- Attachment #2: Type: text/html, Size: 12949 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19  7:24   ` Lucas De Marchi
  (?)
  (?)
@ 2022-01-19  9:15     ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:15 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

[-- Attachment #1: Type: text/plain, Size: 7424 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> There are a few implementations of yesno() in the tree. Consolidate them
> in include/linux/string_helpers.h.  Quite a few users of open coded
> yesno() could later be converted to the new function:
>
> $ git grep '?\s*"yes"\s*' | wc -l
> 286
> $ git grep '?\s*"no"\s*' | wc -l
> 20
>
> The inlined function should keep the const strings local to each
> compilation unit, the same way it's now, thus not changing the current
> behavior.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/i915/i915_utils.h              |  5 -----
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  2 ++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  7 files changed, 8 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 9d43ecb1f692..b59760f91bf6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -23,6 +23,7 @@
>   *
>   */
>
> +#include <linux/string_helpers.h>
>  #include <linux/uaccess.h>
>
>  #include "dc.h"
> @@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
>         uint32_t param1;
>  };
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  /* parse_write_buffer_into_params - Helper function to parse debugfs
> write buffer into an array
>   *
>   * Function takes in attributes passed to debugfs write entry
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 7a5925072466..2a8781cc648b 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long
> timestamp_jiffies, int to_wait_ms)
>  #define MBps(x) KBps(1000 * (x))
>  #define GBps(x) ((u64)1000 * MBps((x)))
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  static inline const char *onoff(bool v)
>  {
>         return v ? "on" : "off";
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> index 7d49fd4edc9e..61a04d7abc1f 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> @@ -2015,17 +2015,6 @@ static const struct file_operations
> rss_debugfs_fops = {
>  /* RSS Configuration.
>   */
>
> -/* Small utility function to return the strings "yes" or "no" if the
> supplied
> - * argument is non-zero.
> - */
> -static const char *yesno(int x)
> -{
> -       static const char *yes = "yes";
> -       static const char *no = "no";
> -
> -       return x ? yes : no;
> -}
> -
>  static int rss_config_show(struct seq_file *seq, void *v)
>  {
>         struct adapter *adapter = seq->private;
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index 4ba39e1403b2..e980dec05d31 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>
>  void kfree_strarray(char **array, size_t n);
>
> +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }



Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
(enable/disable) it will not be possible to keep on one line. And hence
style will be broken among similar functions.


Also it needs to be rebased and resend after -rc1, I expect conflict here.



> +
>  #endif
> diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
> index d79bf07e16be..1458e27361e8 100644
> --- a/security/tomoyo/audit.c
> +++ b/security/tomoyo/audit.c
> @@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct
> tomoyo_request_info *r)
>                        "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s
> granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u
> egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
>                        stamp.year, stamp.month, stamp.day, stamp.hour,
>                        stamp.min, stamp.sec, r->profile,
> tomoyo_mode[r->mode],
> -                      tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
> +                      yesno(r->granted), gpid, tomoyo_sys_getpid(),
>                        tomoyo_sys_getppid(),
>                        from_kuid(&init_user_ns, current_uid()),
>                        from_kgid(&init_user_ns, current_gid()),
> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index 5c64927bf2b3..304ed0f426dd 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -8,6 +8,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/slab.h>
>  #include <linux/security.h>
> +#include <linux/string_helpers.h>
>  #include "common.h"
>
>  /* String table for operation mode. */
> @@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
>
>  /* Utility functions. */
>
> -/**
> - * tomoyo_yesno - Return "yes" or "no".
> - *
> - * @value: Bool value.
> - */
> -const char *tomoyo_yesno(const unsigned int value)
> -{
> -       return value ? "yes" : "no";
> -}
> -
>  /**
>   * tomoyo_addprintf - strncat()-like-snprintf().
>   *
> @@ -730,8 +721,8 @@ static void tomoyo_print_config(struct
> tomoyo_io_buffer *head, const u8 config)
>  {
>         tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
>                          tomoyo_mode[config & 3],
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_GRANT_LOG),
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_REJECT_LOG));
> +                        yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
> +                        yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
>  }
>
>  /**
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct
> tomoyo_io_buffer *head,
>         case 3:
>                 if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>                         tomoyo_io_printf(head, " grant_log=%s",
> -                                        tomoyo_yesno(cond->grant_log ==
> -
>  TOMOYO_GRANTLOG_YES));
> +                                        yesno(cond->grant_log ==
> TOMOYO_GRANTLOG_YES));
>                 tomoyo_set_lf(head);
>                 return true;
>         }
> diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
> index 85246b9df7ca..ca285f362705 100644
> --- a/security/tomoyo/common.h
> +++ b/security/tomoyo/common.h
> @@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param
> *param);
>  char *tomoyo_realpath_from_path(const struct path *path);
>  char *tomoyo_realpath_nofollow(const char *pathname);
>  const char *tomoyo_get_exe(void);
> -const char *tomoyo_yesno(const unsigned int value);
>  const struct tomoyo_path_info *tomoyo_compare_name_union
>  (const struct tomoyo_path_info *name, const struct tomoyo_name_union
> *ptr);
>  const struct tomoyo_path_info *tomoyo_get_domainname
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 9310 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:15     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:15 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

[-- Attachment #1: Type: text/plain, Size: 7424 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> There are a few implementations of yesno() in the tree. Consolidate them
> in include/linux/string_helpers.h.  Quite a few users of open coded
> yesno() could later be converted to the new function:
>
> $ git grep '?\s*"yes"\s*' | wc -l
> 286
> $ git grep '?\s*"no"\s*' | wc -l
> 20
>
> The inlined function should keep the const strings local to each
> compilation unit, the same way it's now, thus not changing the current
> behavior.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/i915/i915_utils.h              |  5 -----
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  2 ++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  7 files changed, 8 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 9d43ecb1f692..b59760f91bf6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -23,6 +23,7 @@
>   *
>   */
>
> +#include <linux/string_helpers.h>
>  #include <linux/uaccess.h>
>
>  #include "dc.h"
> @@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
>         uint32_t param1;
>  };
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  /* parse_write_buffer_into_params - Helper function to parse debugfs
> write buffer into an array
>   *
>   * Function takes in attributes passed to debugfs write entry
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 7a5925072466..2a8781cc648b 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long
> timestamp_jiffies, int to_wait_ms)
>  #define MBps(x) KBps(1000 * (x))
>  #define GBps(x) ((u64)1000 * MBps((x)))
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  static inline const char *onoff(bool v)
>  {
>         return v ? "on" : "off";
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> index 7d49fd4edc9e..61a04d7abc1f 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> @@ -2015,17 +2015,6 @@ static const struct file_operations
> rss_debugfs_fops = {
>  /* RSS Configuration.
>   */
>
> -/* Small utility function to return the strings "yes" or "no" if the
> supplied
> - * argument is non-zero.
> - */
> -static const char *yesno(int x)
> -{
> -       static const char *yes = "yes";
> -       static const char *no = "no";
> -
> -       return x ? yes : no;
> -}
> -
>  static int rss_config_show(struct seq_file *seq, void *v)
>  {
>         struct adapter *adapter = seq->private;
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index 4ba39e1403b2..e980dec05d31 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>
>  void kfree_strarray(char **array, size_t n);
>
> +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }



Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
(enable/disable) it will not be possible to keep on one line. And hence
style will be broken among similar functions.


Also it needs to be rebased and resend after -rc1, I expect conflict here.



> +
>  #endif
> diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
> index d79bf07e16be..1458e27361e8 100644
> --- a/security/tomoyo/audit.c
> +++ b/security/tomoyo/audit.c
> @@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct
> tomoyo_request_info *r)
>                        "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s
> granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u
> egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
>                        stamp.year, stamp.month, stamp.day, stamp.hour,
>                        stamp.min, stamp.sec, r->profile,
> tomoyo_mode[r->mode],
> -                      tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
> +                      yesno(r->granted), gpid, tomoyo_sys_getpid(),
>                        tomoyo_sys_getppid(),
>                        from_kuid(&init_user_ns, current_uid()),
>                        from_kgid(&init_user_ns, current_gid()),
> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index 5c64927bf2b3..304ed0f426dd 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -8,6 +8,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/slab.h>
>  #include <linux/security.h>
> +#include <linux/string_helpers.h>
>  #include "common.h"
>
>  /* String table for operation mode. */
> @@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
>
>  /* Utility functions. */
>
> -/**
> - * tomoyo_yesno - Return "yes" or "no".
> - *
> - * @value: Bool value.
> - */
> -const char *tomoyo_yesno(const unsigned int value)
> -{
> -       return value ? "yes" : "no";
> -}
> -
>  /**
>   * tomoyo_addprintf - strncat()-like-snprintf().
>   *
> @@ -730,8 +721,8 @@ static void tomoyo_print_config(struct
> tomoyo_io_buffer *head, const u8 config)
>  {
>         tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
>                          tomoyo_mode[config & 3],
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_GRANT_LOG),
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_REJECT_LOG));
> +                        yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
> +                        yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
>  }
>
>  /**
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct
> tomoyo_io_buffer *head,
>         case 3:
>                 if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>                         tomoyo_io_printf(head, " grant_log=%s",
> -                                        tomoyo_yesno(cond->grant_log ==
> -
>  TOMOYO_GRANTLOG_YES));
> +                                        yesno(cond->grant_log ==
> TOMOYO_GRANTLOG_YES));
>                 tomoyo_set_lf(head);
>                 return true;
>         }
> diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
> index 85246b9df7ca..ca285f362705 100644
> --- a/security/tomoyo/common.h
> +++ b/security/tomoyo/common.h
> @@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param
> *param);
>  char *tomoyo_realpath_from_path(const struct path *path);
>  char *tomoyo_realpath_nofollow(const char *pathname);
>  const char *tomoyo_get_exe(void);
> -const char *tomoyo_yesno(const unsigned int value);
>  const struct tomoyo_path_info *tomoyo_compare_name_union
>  (const struct tomoyo_path_info *name, const struct tomoyo_name_union
> *ptr);
>  const struct tomoyo_path_info *tomoyo_get_domainname
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 9310 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:15     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:15 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Julia Lawall, Rahul Lakkireddy, Steven Rostedt,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

[-- Attachment #1: Type: text/plain, Size: 7424 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> There are a few implementations of yesno() in the tree. Consolidate them
> in include/linux/string_helpers.h.  Quite a few users of open coded
> yesno() could later be converted to the new function:
>
> $ git grep '?\s*"yes"\s*' | wc -l
> 286
> $ git grep '?\s*"no"\s*' | wc -l
> 20
>
> The inlined function should keep the const strings local to each
> compilation unit, the same way it's now, thus not changing the current
> behavior.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/i915/i915_utils.h              |  5 -----
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  2 ++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  7 files changed, 8 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 9d43ecb1f692..b59760f91bf6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -23,6 +23,7 @@
>   *
>   */
>
> +#include <linux/string_helpers.h>
>  #include <linux/uaccess.h>
>
>  #include "dc.h"
> @@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
>         uint32_t param1;
>  };
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  /* parse_write_buffer_into_params - Helper function to parse debugfs
> write buffer into an array
>   *
>   * Function takes in attributes passed to debugfs write entry
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 7a5925072466..2a8781cc648b 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long
> timestamp_jiffies, int to_wait_ms)
>  #define MBps(x) KBps(1000 * (x))
>  #define GBps(x) ((u64)1000 * MBps((x)))
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  static inline const char *onoff(bool v)
>  {
>         return v ? "on" : "off";
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> index 7d49fd4edc9e..61a04d7abc1f 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> @@ -2015,17 +2015,6 @@ static const struct file_operations
> rss_debugfs_fops = {
>  /* RSS Configuration.
>   */
>
> -/* Small utility function to return the strings "yes" or "no" if the
> supplied
> - * argument is non-zero.
> - */
> -static const char *yesno(int x)
> -{
> -       static const char *yes = "yes";
> -       static const char *no = "no";
> -
> -       return x ? yes : no;
> -}
> -
>  static int rss_config_show(struct seq_file *seq, void *v)
>  {
>         struct adapter *adapter = seq->private;
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index 4ba39e1403b2..e980dec05d31 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>
>  void kfree_strarray(char **array, size_t n);
>
> +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }



Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
(enable/disable) it will not be possible to keep on one line. And hence
style will be broken among similar functions.


Also it needs to be rebased and resend after -rc1, I expect conflict here.



> +
>  #endif
> diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
> index d79bf07e16be..1458e27361e8 100644
> --- a/security/tomoyo/audit.c
> +++ b/security/tomoyo/audit.c
> @@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct
> tomoyo_request_info *r)
>                        "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s
> granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u
> egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
>                        stamp.year, stamp.month, stamp.day, stamp.hour,
>                        stamp.min, stamp.sec, r->profile,
> tomoyo_mode[r->mode],
> -                      tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
> +                      yesno(r->granted), gpid, tomoyo_sys_getpid(),
>                        tomoyo_sys_getppid(),
>                        from_kuid(&init_user_ns, current_uid()),
>                        from_kgid(&init_user_ns, current_gid()),
> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index 5c64927bf2b3..304ed0f426dd 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -8,6 +8,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/slab.h>
>  #include <linux/security.h>
> +#include <linux/string_helpers.h>
>  #include "common.h"
>
>  /* String table for operation mode. */
> @@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
>
>  /* Utility functions. */
>
> -/**
> - * tomoyo_yesno - Return "yes" or "no".
> - *
> - * @value: Bool value.
> - */
> -const char *tomoyo_yesno(const unsigned int value)
> -{
> -       return value ? "yes" : "no";
> -}
> -
>  /**
>   * tomoyo_addprintf - strncat()-like-snprintf().
>   *
> @@ -730,8 +721,8 @@ static void tomoyo_print_config(struct
> tomoyo_io_buffer *head, const u8 config)
>  {
>         tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
>                          tomoyo_mode[config & 3],
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_GRANT_LOG),
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_REJECT_LOG));
> +                        yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
> +                        yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
>  }
>
>  /**
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct
> tomoyo_io_buffer *head,
>         case 3:
>                 if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>                         tomoyo_io_printf(head, " grant_log=%s",
> -                                        tomoyo_yesno(cond->grant_log ==
> -
>  TOMOYO_GRANTLOG_YES));
> +                                        yesno(cond->grant_log ==
> TOMOYO_GRANTLOG_YES));
>                 tomoyo_set_lf(head);
>                 return true;
>         }
> diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
> index 85246b9df7ca..ca285f362705 100644
> --- a/security/tomoyo/common.h
> +++ b/security/tomoyo/common.h
> @@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param
> *param);
>  char *tomoyo_realpath_from_path(const struct path *path);
>  char *tomoyo_realpath_nofollow(const char *pathname);
>  const char *tomoyo_get_exe(void);
> -const char *tomoyo_yesno(const unsigned int value);
>  const struct tomoyo_path_info *tomoyo_compare_name_union
>  (const struct tomoyo_path_info *name, const struct tomoyo_name_union
> *ptr);
>  const struct tomoyo_path_info *tomoyo_get_domainname
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 9310 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:15     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:15 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

[-- Attachment #1: Type: text/plain, Size: 7424 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> There are a few implementations of yesno() in the tree. Consolidate them
> in include/linux/string_helpers.h.  Quite a few users of open coded
> yesno() could later be converted to the new function:
>
> $ git grep '?\s*"yes"\s*' | wc -l
> 286
> $ git grep '?\s*"no"\s*' | wc -l
> 20
>
> The inlined function should keep the const strings local to each
> compilation unit, the same way it's now, thus not changing the current
> behavior.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/i915/i915_utils.h              |  5 -----
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  2 ++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  7 files changed, 8 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 9d43ecb1f692..b59760f91bf6 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -23,6 +23,7 @@
>   *
>   */
>
> +#include <linux/string_helpers.h>
>  #include <linux/uaccess.h>
>
>  #include "dc.h"
> @@ -49,11 +50,6 @@ struct dmub_debugfs_trace_entry {
>         uint32_t param1;
>  };
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  /* parse_write_buffer_into_params - Helper function to parse debugfs
> write buffer into an array
>   *
>   * Function takes in attributes passed to debugfs write entry
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 7a5925072466..2a8781cc648b 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -414,11 +414,6 @@ wait_remaining_ms_from_jiffies(unsigned long
> timestamp_jiffies, int to_wait_ms)
>  #define MBps(x) KBps(1000 * (x))
>  #define GBps(x) ((u64)1000 * MBps((x)))
>
> -static inline const char *yesno(bool v)
> -{
> -       return v ? "yes" : "no";
> -}
> -
>  static inline const char *onoff(bool v)
>  {
>         return v ? "on" : "off";
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> index 7d49fd4edc9e..61a04d7abc1f 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> @@ -2015,17 +2015,6 @@ static const struct file_operations
> rss_debugfs_fops = {
>  /* RSS Configuration.
>   */
>
> -/* Small utility function to return the strings "yes" or "no" if the
> supplied
> - * argument is non-zero.
> - */
> -static const char *yesno(int x)
> -{
> -       static const char *yes = "yes";
> -       static const char *no = "no";
> -
> -       return x ? yes : no;
> -}
> -
>  static int rss_config_show(struct seq_file *seq, void *v)
>  {
>         struct adapter *adapter = seq->private;
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index 4ba39e1403b2..e980dec05d31 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -102,4 +102,6 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>
>  void kfree_strarray(char **array, size_t n);
>
> +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }



Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
(enable/disable) it will not be possible to keep on one line. And hence
style will be broken among similar functions.


Also it needs to be rebased and resend after -rc1, I expect conflict here.



> +
>  #endif
> diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c
> index d79bf07e16be..1458e27361e8 100644
> --- a/security/tomoyo/audit.c
> +++ b/security/tomoyo/audit.c
> @@ -166,7 +166,7 @@ static char *tomoyo_print_header(struct
> tomoyo_request_info *r)
>                        "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s
> granted=%s (global-pid=%u) task={ pid=%u ppid=%u uid=%u gid=%u euid=%u
> egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
>                        stamp.year, stamp.month, stamp.day, stamp.hour,
>                        stamp.min, stamp.sec, r->profile,
> tomoyo_mode[r->mode],
> -                      tomoyo_yesno(r->granted), gpid, tomoyo_sys_getpid(),
> +                      yesno(r->granted), gpid, tomoyo_sys_getpid(),
>                        tomoyo_sys_getppid(),
>                        from_kuid(&init_user_ns, current_uid()),
>                        from_kgid(&init_user_ns, current_gid()),
> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index 5c64927bf2b3..304ed0f426dd 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -8,6 +8,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/slab.h>
>  #include <linux/security.h>
> +#include <linux/string_helpers.h>
>  #include "common.h"
>
>  /* String table for operation mode. */
> @@ -174,16 +175,6 @@ static bool tomoyo_manage_by_non_root;
>
>  /* Utility functions. */
>
> -/**
> - * tomoyo_yesno - Return "yes" or "no".
> - *
> - * @value: Bool value.
> - */
> -const char *tomoyo_yesno(const unsigned int value)
> -{
> -       return value ? "yes" : "no";
> -}
> -
>  /**
>   * tomoyo_addprintf - strncat()-like-snprintf().
>   *
> @@ -730,8 +721,8 @@ static void tomoyo_print_config(struct
> tomoyo_io_buffer *head, const u8 config)
>  {
>         tomoyo_io_printf(head, "={ mode=%s grant_log=%s reject_log=%s }\n",
>                          tomoyo_mode[config & 3],
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_GRANT_LOG),
> -                        tomoyo_yesno(config &
> TOMOYO_CONFIG_WANT_REJECT_LOG));
> +                        yesno(config & TOMOYO_CONFIG_WANT_GRANT_LOG),
> +                        yesno(config & TOMOYO_CONFIG_WANT_REJECT_LOG));
>  }
>
>  /**
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct
> tomoyo_io_buffer *head,
>         case 3:
>                 if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>                         tomoyo_io_printf(head, " grant_log=%s",
> -                                        tomoyo_yesno(cond->grant_log ==
> -
>  TOMOYO_GRANTLOG_YES));
> +                                        yesno(cond->grant_log ==
> TOMOYO_GRANTLOG_YES));
>                 tomoyo_set_lf(head);
>                 return true;
>         }
> diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
> index 85246b9df7ca..ca285f362705 100644
> --- a/security/tomoyo/common.h
> +++ b/security/tomoyo/common.h
> @@ -959,7 +959,6 @@ char *tomoyo_read_token(struct tomoyo_acl_param
> *param);
>  char *tomoyo_realpath_from_path(const struct path *path);
>  char *tomoyo_realpath_nofollow(const char *pathname);
>  const char *tomoyo_get_exe(void);
> -const char *tomoyo_yesno(const unsigned int value);
>  const struct tomoyo_path_info *tomoyo_compare_name_union
>  (const struct tomoyo_path_info *name, const struct tomoyo_name_union
> *ptr);
>  const struct tomoyo_path_info *tomoyo_get_domainname
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 9310 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19  7:24   ` Lucas De Marchi
                       ` (2 preceding siblings ...)
  (?)
@ 2022-01-19  9:18     ` Sakari Ailus
  -1 siblings, 0 replies; 160+ messages in thread
From: Sakari Ailus @ 2022-01-19  9:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, Chris Wilson, Daniel Vetter, David Airlie,
	David S . Miller, Emma Anholt, Eryk Brol, Francis Laniel,
	Greg Kroah-Hartman, Harry Wentland, Jakub Kicinski, Jani Nikula,
	Joonas Lahtinen, Julia Lawall, Kentaro Takeda, Leo Li,
	Mikita Lipski, Petr Mladek, Rahul Lakkireddy, Raju Rangoju,
	Rasmus Villemoes, Rodrigo Vivi, Sergey Senozhatsky,
	Steven Rostedt, Vishal Kulkarni

Hi Lucas,

On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>  	case 3:
>  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>  			tomoyo_io_printf(head, " grant_log=%s",
> -					 tomoyo_yesno(cond->grant_log ==
> -						      TOMOYO_GRANTLOG_YES));
> +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));

This would be better split on two lines.

Then,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:18     ` Sakari Ailus
  0 siblings, 0 replies; 160+ messages in thread
From: Sakari Ailus @ 2022-01-19  9:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Petr Mladek, Leo Li, intel-gfx, Raju Rangoju,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

Hi Lucas,

On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>  	case 3:
>  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>  			tomoyo_io_printf(head, " grant_log=%s",
> -					 tomoyo_yesno(cond->grant_log ==
> -						      TOMOYO_GRANTLOG_YES));
> +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));

This would be better split on two lines.

Then,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:18     ` Sakari Ailus
  0 siblings, 0 replies; 160+ messages in thread
From: Sakari Ailus @ 2022-01-19  9:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Leo Li, intel-gfx,
	Raju Rangoju, Julia Lawall, Rahul Lakkireddy, Steven Rostedt,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

Hi Lucas,

On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>  	case 3:
>  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>  			tomoyo_io_printf(head, " grant_log=%s",
> -					 tomoyo_yesno(cond->grant_log ==
> -						      TOMOYO_GRANTLOG_YES));
> +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));

This would be better split on two lines.

Then,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:18     ` Sakari Ailus
  0 siblings, 0 replies; 160+ messages in thread
From: Sakari Ailus @ 2022-01-19  9:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

Hi Lucas,

On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>  	case 3:
>  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>  			tomoyo_io_printf(head, " grant_log=%s",
> -					 tomoyo_yesno(cond->grant_log ==
> -						      TOMOYO_GRANTLOG_YES));
> +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));

This would be better split on two lines.

Then,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19  9:18     ` Sakari Ailus
  0 siblings, 0 replies; 160+ messages in thread
From: Sakari Ailus @ 2022-01-19  9:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

Hi Lucas,

On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>  	case 3:
>  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>  			tomoyo_io_printf(head, " grant_log=%s",
> -					 tomoyo_yesno(cond->grant_log ==
> -						      TOMOYO_GRANTLOG_YES));
> +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));

This would be better split on two lines.

Then,

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
  2022-01-19  7:24   ` Lucas De Marchi
  (?)
  (?)
@ 2022-01-19  9:20     ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:20 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Follow the yes/no logic and add helpers for enabled/disabled and
> enable/disable - those are not so common throughout the kernel,
> but they give a nice way to reuse the strings to log things as
> enabled/disabled or enable/disable.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>  include/linux/string_helpers.h    |  2 ++
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 2a8781cc648b..cbec79bae0d2 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>         return v ? "on" : "off";
>  }
>
> -static inline const char *enabledisable(bool v)
> -{
> -       return v ? "enable" : "disable";
> -}
> -
> -static inline const char *enableddisabled(bool v)
> -{
> -       return v ? "enabled" : "disabled";
> -}
> -
>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>  static inline void __add_taint_for_CI(unsigned int taint)
>  {
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index e980dec05d31..e4b82f364ee1 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>  void kfree_strarray(char **array, size_t n);
>
>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> +static inline const char *enabledisable(bool v) { return v ? "enable" :
> "disable"; }
> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
> : "disabled"; }


Looks not readable even if takes 80 characters. Please, keep original style.


I believe you wanted to have nice negative statistics from day 1, then you
may add more patches in the series to cleanup more users.




>
>  #endif
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 2891 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  9:20     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:20 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Follow the yes/no logic and add helpers for enabled/disabled and
> enable/disable - those are not so common throughout the kernel,
> but they give a nice way to reuse the strings to log things as
> enabled/disabled or enable/disable.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>  include/linux/string_helpers.h    |  2 ++
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 2a8781cc648b..cbec79bae0d2 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>         return v ? "on" : "off";
>  }
>
> -static inline const char *enabledisable(bool v)
> -{
> -       return v ? "enable" : "disable";
> -}
> -
> -static inline const char *enableddisabled(bool v)
> -{
> -       return v ? "enabled" : "disabled";
> -}
> -
>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>  static inline void __add_taint_for_CI(unsigned int taint)
>  {
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index e980dec05d31..e4b82f364ee1 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>  void kfree_strarray(char **array, size_t n);
>
>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> +static inline const char *enabledisable(bool v) { return v ? "enable" :
> "disable"; }
> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
> : "disabled"; }


Looks not readable even if takes 80 characters. Please, keep original style.


I believe you wanted to have nice negative statistics from day 1, then you
may add more patches in the series to cleanup more users.




>
>  #endif
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 2891 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  9:20     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:20 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Julia Lawall, Rahul Lakkireddy, Steven Rostedt,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Follow the yes/no logic and add helpers for enabled/disabled and
> enable/disable - those are not so common throughout the kernel,
> but they give a nice way to reuse the strings to log things as
> enabled/disabled or enable/disable.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>  include/linux/string_helpers.h    |  2 ++
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 2a8781cc648b..cbec79bae0d2 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>         return v ? "on" : "off";
>  }
>
> -static inline const char *enabledisable(bool v)
> -{
> -       return v ? "enable" : "disable";
> -}
> -
> -static inline const char *enableddisabled(bool v)
> -{
> -       return v ? "enabled" : "disabled";
> -}
> -
>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>  static inline void __add_taint_for_CI(unsigned int taint)
>  {
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index e980dec05d31..e4b82f364ee1 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>  void kfree_strarray(char **array, size_t n);
>
>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> +static inline const char *enabledisable(bool v) { return v ? "enable" :
> "disable"; }
> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
> : "disabled"; }


Looks not readable even if takes 80 characters. Please, keep original style.


I believe you wanted to have nice negative statistics from day 1, then you
may add more patches in the series to cleanup more users.




>
>  #endif
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 2891 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  9:20     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:20 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Follow the yes/no logic and add helpers for enabled/disabled and
> enable/disable - those are not so common throughout the kernel,
> but they give a nice way to reuse the strings to log things as
> enabled/disabled or enable/disable.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>  include/linux/string_helpers.h    |  2 ++
>  2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_utils.h
> b/drivers/gpu/drm/i915/i915_utils.h
> index 2a8781cc648b..cbec79bae0d2 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>         return v ? "on" : "off";
>  }
>
> -static inline const char *enabledisable(bool v)
> -{
> -       return v ? "enable" : "disable";
> -}
> -
> -static inline const char *enableddisabled(bool v)
> -{
> -       return v ? "enabled" : "disabled";
> -}
> -
>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>  static inline void __add_taint_for_CI(unsigned int taint)
>  {
> diff --git a/include/linux/string_helpers.h b/include/linux/string_
> helpers.h
> index e980dec05d31..e4b82f364ee1 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
> gfp);
>  void kfree_strarray(char **array, size_t n);
>
>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> +static inline const char *enabledisable(bool v) { return v ? "enable" :
> "disable"; }
> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
> : "disabled"; }


Looks not readable even if takes 80 characters. Please, keep original style.


I believe you wanted to have nice negative statistics from day 1, then you
may add more patches in the series to cleanup more users.




>
>  #endif
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 2891 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
  (?)
  (?)
@ 2022-01-19  9:28   ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:28 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

[-- Attachment #1: Type: text/plain, Size: 5627 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.
> nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.
> shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.



I believe the best if we go via drm-misc with the entire series.

I have couple of comments, after addressing them:

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)
>
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 8522 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  9:28   ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:28 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

[-- Attachment #1: Type: text/plain, Size: 5627 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.
> nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.
> shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.



I believe the best if we go via drm-misc with the entire series.

I have couple of comments, after addressing them:

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)
>
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 8522 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  9:28   ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:28 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Julia Lawall, Rahul Lakkireddy, Steven Rostedt,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

[-- Attachment #1: Type: text/plain, Size: 5627 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.
> nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.
> shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.



I believe the best if we go via drm-misc with the entire series.

I have couple of comments, after addressing them:

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)
>
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 8522 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19  9:28   ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19  9:28 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

[-- Attachment #1: Type: text/plain, Size: 5627 bytes --]

On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
wrote:

> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
>
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.
> nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.
> shevchenko@linux.intel.com/#t
>
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
>
> a. This version should be a drop-in replacement for what is currently in
>    the tree, with no change in behavior or binary size. For binary
>    size what I checked wat that the linked objects in the end have the
>    same size (gcc 11). From comments in the previous attempts this seems
>    also the case for earlier compiler versions
>
> b. I didn't change the function name to choice_* as suggested by Andrew
>    Morton in 20191023155619.43e0013f0c8c673a5c508c1e@linux-foundation.org
>    because other people argumented in favor of shorter names for these
>    simple helpers - if they are long and people simply not use due to
>    that, we failed
>
> c. Use string_helper.h for these helpers - pulling string.h in the
>    compilations units was one of the concerns and I think re-using this
>    already existing header is better than creating a new string-choice.h
>
> 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  <someprefix>
>    try to find a short one
>
> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]
>
> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
>
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
>
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.



I believe the best if we go via drm-misc with the entire series.

I have couple of comments, after addressing them:

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> thanks
> Lucas De Marchi
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Emma Anholt <emma@anholt.net>
> Cc: Eryk Brol <eryk.brol@amd.com>
> Cc: Francis Laniel <laniel_francis@privacyrequired.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Cc: Raju Rangoju <rajur@chelsio.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Vishal Kulkarni <vishal@chelsio.com>
>
> Lucas De Marchi (3):
>   lib/string_helpers: Consolidate yesno() implementation
>   lib/string_helpers: Add helpers for enable[d]/disable[d]
>   drm: Convert open yes/no strings to yesno()
>
>  drivers/gpu/drm/amd/amdgpu/atom.c              |  3 ++-
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c  |  6 +-----
>  drivers/gpu/drm/drm_client_modeset.c           |  3 ++-
>  drivers/gpu/drm/drm_dp_helper.c                |  3 ++-
>  drivers/gpu/drm/drm_gem.c                      |  3 ++-
>  drivers/gpu/drm/i915/i915_utils.h              | 15 ---------------
>  drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  4 +++-
>  drivers/gpu/drm/radeon/atom.c                  |  3 ++-
>  drivers/gpu/drm/v3d/v3d_debugfs.c              | 11 ++++++-----
>  drivers/gpu/drm/virtio/virtgpu_debugfs.c       |  3 ++-
>  .../net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 -----------
>  include/linux/string_helpers.h                 |  4 ++++
>  security/tomoyo/audit.c                        |  2 +-
>  security/tomoyo/common.c                       | 18 ++++--------------
>  security/tomoyo/common.h                       |  1 -
>  15 files changed, 31 insertions(+), 59 deletions(-)
>
> --
> 2.34.1
>
>

-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 8522 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* [Intel-gfx] ✗ Fi.CI.IGT: failure for lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
                   ` (11 preceding siblings ...)
  (?)
@ 2022-01-19  9:39 ` Patchwork
  -1 siblings, 0 replies; 160+ messages in thread
From: Patchwork @ 2022-01-19  9:39 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 30267 bytes --]

== Series Details ==

Series: lib/string_helpers: Add a few string helpers
URL   : https://patchwork.freedesktop.org/series/99030/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11094_full -> Patchwork_22020_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_22020_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_22020_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  

Participating hosts (13 -> 13)
------------------------------

  No changes in participating hosts

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_22020_full:

### IGT changes ###

#### Possible regressions ####

  * igt@kms_flip@busy-flip@a-edp1:
    - shard-skl:          [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-skl7/igt@kms_flip@busy-flip@a-edp1.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl2/igt@kms_flip@busy-flip@a-edp1.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@gem_exec_schedule@preempt-queue-contexts-chain@vcs1:
    - {shard-tglu}:       [PASS][3] -> [DMESG-WARN][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglu-7/igt@gem_exec_schedule@preempt-queue-contexts-chain@vcs1.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglu-7/igt@gem_exec_schedule@preempt-queue-contexts-chain@vcs1.html

  * igt@gem_exec_schedule@u-fairslice-all:
    - {shard-tglu}:       [PASS][5] -> [INCOMPLETE][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglu-7/igt@gem_exec_schedule@u-fairslice-all.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglu-7/igt@gem_exec_schedule@u-fairslice-all.html

  
Known issues
------------

  Here are the changes found in Patchwork_22020_full that come from known issues:

### CI changes ###

#### Issues hit ####

  * boot:
    - shard-glk:          ([PASS][7], [PASS][8], [PASS][9], [PASS][10], [PASS][11], [PASS][12], [PASS][13], [PASS][14], [PASS][15], [PASS][16], [PASS][17], [PASS][18], [PASS][19], [PASS][20], [PASS][21], [PASS][22], [PASS][23], [PASS][24], [PASS][25], [PASS][26], [PASS][27], [PASS][28], [PASS][29], [PASS][30], [PASS][31]) -> ([PASS][32], [FAIL][33], [PASS][34], [PASS][35], [PASS][36], [PASS][37], [PASS][38], [PASS][39], [PASS][40], [PASS][41], [PASS][42], [PASS][43], [PASS][44], [PASS][45], [PASS][46], [PASS][47], [PASS][48], [PASS][49], [PASS][50], [PASS][51], [PASS][52], [PASS][53], [PASS][54], [PASS][55], [PASS][56]) ([i915#4392])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk7/boot.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk1/boot.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk1/boot.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk1/boot.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk2/boot.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk2/boot.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk3/boot.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk3/boot.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk3/boot.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk4/boot.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk4/boot.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk5/boot.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk5/boot.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk5/boot.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk6/boot.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk6/boot.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk6/boot.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk7/boot.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk7/boot.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk8/boot.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk8/boot.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk8/boot.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk9/boot.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk9/boot.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk9/boot.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk9/boot.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk9/boot.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk9/boot.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk9/boot.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk8/boot.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk8/boot.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk7/boot.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk7/boot.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk6/boot.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk6/boot.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk5/boot.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk5/boot.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk4/boot.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk4/boot.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk4/boot.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk3/boot.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk3/boot.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk3/boot.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk2/boot.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk2/boot.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk2/boot.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk2/boot.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk1/boot.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk1/boot.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk1/boot.html

  

### IGT changes ###

#### Issues hit ####

  * igt@gem_eio@in-flight-10ms:
    - shard-tglb:         [PASS][57] -> [TIMEOUT][58] ([i915#3063])
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglb6/igt@gem_eio@in-flight-10ms.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglb3/igt@gem_eio@in-flight-10ms.html

  * igt@gem_exec_balancer@parallel-keep-submit-fence:
    - shard-iclb:         [PASS][59] -> [SKIP][60] ([i915#4525])
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-iclb2/igt@gem_exec_balancer@parallel-keep-submit-fence.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb3/igt@gem_exec_balancer@parallel-keep-submit-fence.html

  * igt@gem_exec_capture@pi@vcs0:
    - shard-skl:          NOTRUN -> [INCOMPLETE][61] ([i915#4547])
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl7/igt@gem_exec_capture@pi@vcs0.html

  * igt@gem_exec_fair@basic-deadline:
    - shard-skl:          NOTRUN -> [FAIL][62] ([i915#2846])
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl9/igt@gem_exec_fair@basic-deadline.html

  * igt@gem_exec_fair@basic-none@vcs0:
    - shard-kbl:          NOTRUN -> [FAIL][63] ([i915#2842])
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@gem_exec_fair@basic-none@vcs0.html

  * igt@gem_exec_fair@basic-none@vcs1:
    - shard-iclb:         NOTRUN -> [FAIL][64] ([i915#2842])
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb1/igt@gem_exec_fair@basic-none@vcs1.html

  * igt@gem_exec_fair@basic-pace@vcs0:
    - shard-kbl:          [PASS][65] -> [FAIL][66] ([i915#2842])
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-kbl1/igt@gem_exec_fair@basic-pace@vcs0.html
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@gem_exec_fair@basic-pace@vcs0.html

  * igt@gem_huc_copy@huc-copy:
    - shard-kbl:          NOTRUN -> [SKIP][67] ([fdo#109271] / [i915#2190])
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl4/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@heavy-verify-random:
    - shard-skl:          NOTRUN -> [SKIP][68] ([fdo#109271] / [i915#4613]) +5 similar issues
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl9/igt@gem_lmem_swapping@heavy-verify-random.html

  * igt@gem_lmem_swapping@parallel-random-verify:
    - shard-kbl:          NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#4613]) +1 similar issue
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@gem_lmem_swapping@parallel-random-verify.html

  * igt@gem_pread@exhaustion:
    - shard-kbl:          NOTRUN -> [WARN][70] ([i915#2658])
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@gem_pread@exhaustion.html

  * igt@gem_pwrite@basic-exhaustion:
    - shard-skl:          NOTRUN -> [WARN][71] ([i915#2658])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl10/igt@gem_pwrite@basic-exhaustion.html

  * igt@gem_render_copy@x-tiled-to-vebox-yf-tiled:
    - shard-kbl:          NOTRUN -> [SKIP][72] ([fdo#109271]) +158 similar issues
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@gem_render_copy@x-tiled-to-vebox-yf-tiled.html

  * igt@gem_userptr_blits@dmabuf-sync:
    - shard-kbl:          NOTRUN -> [SKIP][73] ([fdo#109271] / [i915#3323])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl3/igt@gem_userptr_blits@dmabuf-sync.html

  * igt@gem_userptr_blits@vma-merge:
    - shard-skl:          NOTRUN -> [FAIL][74] ([i915#3318])
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl6/igt@gem_userptr_blits@vma-merge.html

  * igt@i915_pm_dc@dc6-psr:
    - shard-iclb:         [PASS][75] -> [FAIL][76] ([i915#454])
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-iclb7/igt@i915_pm_dc@dc6-psr.html
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb6/igt@i915_pm_dc@dc6-psr.html
    - shard-skl:          NOTRUN -> [FAIL][77] ([i915#454])
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl4/igt@i915_pm_dc@dc6-psr.html

  * igt@i915_selftest@live@gem_contexts:
    - shard-tglb:         [PASS][78] -> [DMESG-WARN][79] ([i915#2867]) +14 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglb8/igt@i915_selftest@live@gem_contexts.html
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglb8/igt@i915_selftest@live@gem_contexts.html

  * igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-0-async-flip:
    - shard-skl:          NOTRUN -> [FAIL][80] ([i915#3743]) +2 similar issues
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl10/igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-0-async-flip.html

  * igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip:
    - shard-skl:          NOTRUN -> [SKIP][81] ([fdo#109271] / [i915#3777]) +3 similar issues
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl10/igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip:
    - shard-kbl:          NOTRUN -> [SKIP][82] ([fdo#109271] / [i915#3777])
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl4/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip.html

  * igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs:
    - shard-apl:          NOTRUN -> [SKIP][83] ([fdo#109271]) +18 similar issues
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-apl8/igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs.html

  * igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
    - shard-kbl:          NOTRUN -> [SKIP][84] ([fdo#109271] / [i915#3886]) +5 similar issues
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl4/igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

  * igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_mc_ccs:
    - shard-skl:          NOTRUN -> [SKIP][85] ([fdo#109271] / [i915#3886]) +12 similar issues
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl6/igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html

  * igt@kms_color@pipe-a-ctm-0-75:
    - shard-skl:          NOTRUN -> [DMESG-WARN][86] ([i915#1982])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl4/igt@kms_color@pipe-a-ctm-0-75.html

  * igt@kms_color_chamelium@pipe-a-ctm-0-75:
    - shard-kbl:          NOTRUN -> [SKIP][87] ([fdo#109271] / [fdo#111827]) +12 similar issues
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@kms_color_chamelium@pipe-a-ctm-0-75.html

  * igt@kms_color_chamelium@pipe-b-ctm-limited-range:
    - shard-apl:          NOTRUN -> [SKIP][88] ([fdo#109271] / [fdo#111827]) +1 similar issue
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-apl7/igt@kms_color_chamelium@pipe-b-ctm-limited-range.html

  * igt@kms_color_chamelium@pipe-b-ctm-max:
    - shard-skl:          NOTRUN -> [SKIP][89] ([fdo#109271] / [fdo#111827]) +36 similar issues
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl6/igt@kms_color_chamelium@pipe-b-ctm-max.html

  * igt@kms_flip@flip-vs-expired-vblank@c-edp1:
    - shard-skl:          NOTRUN -> [FAIL][90] ([i915#79])
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl4/igt@kms_flip@flip-vs-expired-vblank@c-edp1.html

  * igt@kms_flip@flip-vs-suspend@d-edp1:
    - shard-tglb:         [PASS][91] -> [DMESG-WARN][92] ([i915#2411] / [i915#2867])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglb8/igt@kms_flip@flip-vs-suspend@d-edp1.html
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglb8/igt@kms_flip@flip-vs-suspend@d-edp1.html

  * igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-64bpp-ytile-upscaling:
    - shard-skl:          NOTRUN -> [INCOMPLETE][93] ([i915#3701])
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl7/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-64bpp-ytile-upscaling.html

  * igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile-downscaling:
    - shard-iclb:         [PASS][94] -> [SKIP][95] ([i915#3701])
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-iclb6/igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile-downscaling.html
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb2/igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile-downscaling.html

  * igt@kms_frontbuffer_tracking@fbc-1p-shrfb-fliptrack-mmap-gtt:
    - shard-skl:          NOTRUN -> [SKIP][96] ([fdo#109271]) +475 similar issues
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl10/igt@kms_frontbuffer_tracking@fbc-1p-shrfb-fliptrack-mmap-gtt.html

  * igt@kms_frontbuffer_tracking@fbc-suspend:
    - shard-apl:          [PASS][97] -> [DMESG-WARN][98] ([i915#180]) +2 similar issues
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-apl4/igt@kms_frontbuffer_tracking@fbc-suspend.html
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-apl2/igt@kms_frontbuffer_tracking@fbc-suspend.html

  * igt@kms_hdr@bpc-switch-dpms:
    - shard-skl:          NOTRUN -> [FAIL][99] ([i915#1188]) +1 similar issue
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl9/igt@kms_hdr@bpc-switch-dpms.html

  * igt@kms_hdr@bpc-switch-suspend:
    - shard-skl:          [PASS][100] -> [FAIL][101] ([i915#1188])
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-skl8/igt@kms_hdr@bpc-switch-suspend.html
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl4/igt@kms_hdr@bpc-switch-suspend.html

  * igt@kms_pipe_crc_basic@hang-read-crc-pipe-d:
    - shard-skl:          NOTRUN -> [SKIP][102] ([fdo#109271] / [i915#533]) +3 similar issues
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl9/igt@kms_pipe_crc_basic@hang-read-crc-pipe-d.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - shard-kbl:          [PASS][103] -> [DMESG-WARN][104] ([i915#180]) +1 similar issue
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-kbl3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl6/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-d:
    - shard-kbl:          NOTRUN -> [SKIP][105] ([fdo#109271] / [i915#533]) +1 similar issue
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl4/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-d.html

  * igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
    - shard-skl:          NOTRUN -> [FAIL][106] ([fdo#108145] / [i915#265]) +6 similar issues
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl10/igt@kms_plane_alpha_blend@pipe-a-alpha-7efc.html

  * igt@kms_plane_alpha_blend@pipe-a-alpha-transparent-fb:
    - shard-skl:          NOTRUN -> [FAIL][107] ([i915#265]) +1 similar issue
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl6/igt@kms_plane_alpha_blend@pipe-a-alpha-transparent-fb.html

  * igt@kms_psr2_sf@cursor-plane-update-sf:
    - shard-kbl:          NOTRUN -> [SKIP][108] ([fdo#109271] / [i915#658])
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@kms_psr2_sf@cursor-plane-update-sf.html

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area:
    - shard-skl:          NOTRUN -> [SKIP][109] ([fdo#109271] / [i915#658]) +5 similar issues
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl6/igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area.html

  * igt@kms_psr@psr2_cursor_plane_onoff:
    - shard-iclb:         [PASS][110] -> [SKIP][111] ([fdo#109441])
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-iclb2/igt@kms_psr@psr2_cursor_plane_onoff.html
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb1/igt@kms_psr@psr2_cursor_plane_onoff.html

  * igt@kms_writeback@writeback-check-output:
    - shard-skl:          NOTRUN -> [SKIP][112] ([fdo#109271] / [i915#2437])
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl10/igt@kms_writeback@writeback-check-output.html

  * igt@perf@polling-parameterized:
    - shard-apl:          [PASS][113] -> [FAIL][114] ([i915#1542])
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-apl1/igt@perf@polling-parameterized.html
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-apl7/igt@perf@polling-parameterized.html

  * igt@perf_pmu@module-unload:
    - shard-tglb:         [PASS][115] -> [DMESG-WARN][116] ([i915#262] / [i915#2867])
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglb8/igt@perf_pmu@module-unload.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglb8/igt@perf_pmu@module-unload.html

  * igt@sysfs_clients@fair-0:
    - shard-skl:          NOTRUN -> [SKIP][117] ([fdo#109271] / [i915#2994]) +5 similar issues
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl7/igt@sysfs_clients@fair-0.html

  * igt@sysfs_clients@split-50:
    - shard-kbl:          NOTRUN -> [SKIP][118] ([fdo#109271] / [i915#2994]) +2 similar issues
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl1/igt@sysfs_clients@split-50.html

  
#### Possible fixes ####

  * igt@gem_ctx_persistence@smoketest:
    - {shard-dg1}:        [DMESG-WARN][119] ([i915#4892]) -> [PASS][120]
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-dg1-19/igt@gem_ctx_persistence@smoketest.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-dg1-18/igt@gem_ctx_persistence@smoketest.html

  * igt@gem_eio@in-flight-contexts-1us:
    - shard-tglb:         [TIMEOUT][121] ([i915#3063]) -> [PASS][122]
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglb8/igt@gem_eio@in-flight-contexts-1us.html
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglb8/igt@gem_eio@in-flight-contexts-1us.html

  * igt@gem_exec_balancer@parallel:
    - shard-iclb:         [SKIP][123] ([i915#4525]) -> [PASS][124]
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-iclb8/igt@gem_exec_balancer@parallel.html
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb1/igt@gem_exec_balancer@parallel.html

  * igt@gem_exec_create@forked@smem:
    - {shard-tglu}:       [INCOMPLETE][125] -> [PASS][126]
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglu-7/igt@gem_exec_create@forked@smem.html
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglu-2/igt@gem_exec_create@forked@smem.html

  * igt@gem_exec_fair@basic-flow@rcs0:
    - shard-tglb:         [FAIL][127] ([i915#2842]) -> [PASS][128]
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-tglb2/igt@gem_exec_fair@basic-flow@rcs0.html
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-tglb5/igt@gem_exec_fair@basic-flow@rcs0.html

  * igt@gem_exec_fair@basic-none-vip@rcs0:
    - shard-kbl:          [FAIL][129] ([i915#2842]) -> [PASS][130] +1 similar issue
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-kbl4/igt@gem_exec_fair@basic-none-vip@rcs0.html
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-kbl6/igt@gem_exec_fair@basic-none-vip@rcs0.html

  * igt@gem_exec_suspend@basic-s3@smem:
    - shard-apl:          [DMESG-WARN][131] ([i915#180]) -> [PASS][132] +2 similar issues
   [131]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-apl1/igt@gem_exec_suspend@basic-s3@smem.html
   [132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-apl7/igt@gem_exec_suspend@basic-s3@smem.html

  * igt@gem_exec_whisper@basic-contexts-all:
    - shard-glk:          [DMESG-WARN][133] ([i915#118]) -> [PASS][134]
   [133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-glk3/igt@gem_exec_whisper@basic-contexts-all.html
   [134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-glk5/igt@gem_exec_whisper@basic-contexts-all.html

  * igt@gem_lmem_swapping@smem-oom@lmem0:
    - {shard-dg1}:        [DMESG-WARN][135] ([i915#4936]) -> [PASS][136]
   [135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-dg1-15/igt@gem_lmem_swapping@smem-oom@lmem0.html
   [136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-dg1-12/igt@gem_lmem_swapping@smem-oom@lmem0.html

  * igt@gem_mmap_offset@close-race:
    - {shard-rkl}:        [INCOMPLETE][137] -> [PASS][138]
   [137]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@gem_mmap_offset@close-race.html
   [138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@gem_mmap_offset@close-race.html

  * igt@gen9_exec_parse@allowed-all:
    - shard-skl:          [DMESG-WARN][139] ([i915#1436] / [i915#716]) -> [PASS][140]
   [139]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-skl7/igt@gen9_exec_parse@allowed-all.html
   [140]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl9/igt@gen9_exec_parse@allowed-all.html

  * igt@i915_pm_dc@dc6-dpms:
    - shard-iclb:         [FAIL][141] ([i915#454]) -> [PASS][142]
   [141]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-iclb3/igt@i915_pm_dc@dc6-dpms.html
   [142]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-iclb6/igt@i915_pm_dc@dc6-dpms.html

  * igt@i915_pm_rpm@dpms-lpsp:
    - {shard-rkl}:        ([SKIP][143], [SKIP][144]) ([i915#1397]) -> [PASS][145]
   [143]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-4/igt@i915_pm_rpm@dpms-lpsp.html
   [144]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@i915_pm_rpm@dpms-lpsp.html
   [145]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@i915_pm_rpm@dpms-lpsp.html

  * igt@i915_pm_rpm@modeset-lpsp:
    - {shard-rkl}:        [SKIP][146] ([i915#1397]) -> [PASS][147] +1 similar issue
   [146]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@i915_pm_rpm@modeset-lpsp.html
   [147]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@i915_pm_rpm@modeset-lpsp.html

  * igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait:
    - {shard-dg1}:        [SKIP][148] ([i915#1397]) -> [PASS][149] +1 similar issue
   [148]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-dg1-19/igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait.html
   [149]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-dg1-18/igt@i915_pm_rpm@modeset-non-lpsp-stress-no-wait.html

  * igt@i915_pm_rps@min-max-config-idle:
    - {shard-rkl}:        ([FAIL][150], [PASS][151]) ([i915#4016]) -> [PASS][152]
   [150]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-2/igt@i915_pm_rps@min-max-config-idle.html
   [151]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-4/igt@i915_pm_rps@min-max-config-idle.html
   [152]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@i915_pm_rps@min-max-config-idle.html

  * igt@i915_selftest@live@execlists:
    - shard-skl:          [INCOMPLETE][153] -> [PASS][154]
   [153]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-skl9/igt@i915_selftest@live@execlists.html
   [154]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-skl2/igt@i915_selftest@live@execlists.html

  * igt@kms_big_fb@linear-max-hw-stride-64bpp-rotate-180:
    - {shard-rkl}:        ([SKIP][155], [SKIP][156]) ([i915#1845]) -> [PASS][157] +2 similar issues
   [155]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-2/igt@kms_big_fb@linear-max-hw-stride-64bpp-rotate-180.html
   [156]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-4/igt@kms_big_fb@linear-max-hw-stride-64bpp-rotate-180.html
   [157]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_big_fb@linear-max-hw-stride-64bpp-rotate-180.html

  * igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-0:
    - {shard-rkl}:        [SKIP][158] ([i915#1845]) -> [PASS][159] +17 similar issues
   [158]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-0.html
   [159]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-0.html

  * igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_rc_ccs:
    - {shard-rkl}:        [SKIP][160] ([i915#1845] / [i915#4098]) -> [PASS][161] +1 similar issue
   [160]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-2/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_rc_ccs.html
   [161]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_rc_ccs.html

  * igt@kms_color@pipe-a-ctm-0-5:
    - {shard-rkl}:        [SKIP][162] ([i915#1149] / [i915#1849]) -> [PASS][163] +1 similar issue
   [162]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@kms_color@pipe-a-ctm-0-5.html
   [163]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_color@pipe-a-ctm-0-5.html

  * igt@kms_cursor_crc@pipe-a-cursor-64x21-offscreen:
    - {shard-rkl}:        [SKIP][164] ([fdo#112022] / [i915#4070]) -> [PASS][165]
   [164]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-2/igt@kms_cursor_crc@pipe-a-cursor-64x21-offscreen.html
   [165]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_cursor_crc@pipe-a-cursor-64x21-offscreen.html

  * igt@kms_cursor_crc@pipe-a-cursor-64x21-rapid-movement:
    - {shard-rkl}:        ([SKIP][166], [SKIP][167]) ([fdo#112022]) -> [PASS][168]
   [166]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@kms_cursor_crc@pipe-a-cursor-64x21-rapid-movement.html
   [167]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-4/igt@kms_cursor_crc@pipe-a-cursor-64x21-rapid-movement.html
   [168]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_cursor_crc@pipe-a-cursor-64x21-rapid-movement.html

  * igt@kms_cursor_crc@pipe-b-cursor-128x42-rapid-movement:
    - {shard-rkl}:        [SKIP][169] ([fdo#112022]) -> [PASS][170]
   [169]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11094/shard-rkl-5/igt@kms_cursor_crc@pipe-b-cursor-128x42-rapid-movement.html
   [170]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/shard-rkl-6/igt@kms_cursor_c

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22020/index.html

[-- Attachment #2: Type: text/html, Size: 33347 bytes --]

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
  2022-01-19  9:20     ` Andy Shevchenko
  (?)
  (?)
@ 2022-01-19  9:42       ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  9:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 11:20:38AM +0200, Andy Shevchenko wrote:
>On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
>wrote:
>
>> Follow the yes/no logic and add helpers for enabled/disabled and
>> enable/disable - those are not so common throughout the kernel,
>> but they give a nice way to reuse the strings to log things as
>> enabled/disabled or enable/disable.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>>  include/linux/string_helpers.h    |  2 ++
>>  2 files changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_utils.h
>> b/drivers/gpu/drm/i915/i915_utils.h
>> index 2a8781cc648b..cbec79bae0d2 100644
>> --- a/drivers/gpu/drm/i915/i915_utils.h
>> +++ b/drivers/gpu/drm/i915/i915_utils.h
>> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>>         return v ? "on" : "off";
>>  }
>>
>> -static inline const char *enabledisable(bool v)
>> -{
>> -       return v ? "enable" : "disable";
>> -}
>> -
>> -static inline const char *enableddisabled(bool v)
>> -{
>> -       return v ? "enabled" : "disabled";
>> -}
>> -
>>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>>  static inline void __add_taint_for_CI(unsigned int taint)
>>  {
>> diff --git a/include/linux/string_helpers.h b/include/linux/string_
>> helpers.h
>> index e980dec05d31..e4b82f364ee1 100644
>> --- a/include/linux/string_helpers.h
>> +++ b/include/linux/string_helpers.h
>> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
>> gfp);
>>  void kfree_strarray(char **array, size_t n);
>>
>>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
>> +static inline const char *enabledisable(bool v) { return v ? "enable" :
>> "disable"; }
>> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
>> : "disabled"; }
>
>
>Looks not readable even if takes 80 characters. Please, keep original style.
>
>
>I believe you wanted to have nice negative statistics from day 1, then you
>may add more patches in the series to cleanup more users.

not really the reason... it was just "this is small enough and
checkpatch doesn't complain" (it checks for 100 chars nowadays). But yes,
I can keep it in 4 lines.

thanks
Lucas De Marchi

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  9:42       ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  9:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, Andy Shevchenko, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Petr Mladek, Leo Li, intel-gfx, Steven Rostedt,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel, David S . Miller,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus,
	Raju Rangoju, Alex Deucher, Andrew Morton, Christian König

On Wed, Jan 19, 2022 at 11:20:38AM +0200, Andy Shevchenko wrote:
>On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
>wrote:
>
>> Follow the yes/no logic and add helpers for enabled/disabled and
>> enable/disable - those are not so common throughout the kernel,
>> but they give a nice way to reuse the strings to log things as
>> enabled/disabled or enable/disable.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>>  include/linux/string_helpers.h    |  2 ++
>>  2 files changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_utils.h
>> b/drivers/gpu/drm/i915/i915_utils.h
>> index 2a8781cc648b..cbec79bae0d2 100644
>> --- a/drivers/gpu/drm/i915/i915_utils.h
>> +++ b/drivers/gpu/drm/i915/i915_utils.h
>> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>>         return v ? "on" : "off";
>>  }
>>
>> -static inline const char *enabledisable(bool v)
>> -{
>> -       return v ? "enable" : "disable";
>> -}
>> -
>> -static inline const char *enableddisabled(bool v)
>> -{
>> -       return v ? "enabled" : "disabled";
>> -}
>> -
>>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>>  static inline void __add_taint_for_CI(unsigned int taint)
>>  {
>> diff --git a/include/linux/string_helpers.h b/include/linux/string_
>> helpers.h
>> index e980dec05d31..e4b82f364ee1 100644
>> --- a/include/linux/string_helpers.h
>> +++ b/include/linux/string_helpers.h
>> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
>> gfp);
>>  void kfree_strarray(char **array, size_t n);
>>
>>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
>> +static inline const char *enabledisable(bool v) { return v ? "enable" :
>> "disable"; }
>> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
>> : "disabled"; }
>
>
>Looks not readable even if takes 80 characters. Please, keep original style.
>
>
>I believe you wanted to have nice negative statistics from day 1, then you
>may add more patches in the series to cleanup more users.

not really the reason... it was just "this is small enough and
checkpatch doesn't complain" (it checks for 100 chars nowadays). But yes,
I can keep it in 4 lines.

thanks
Lucas De Marchi

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  9:42       ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  9:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, Andy Shevchenko, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Petr Mladek, Leo Li, intel-gfx, Steven Rostedt,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, David S . Miller,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus,
	Raju Rangoju, Alex Deucher, Andrew Morton, Christian König

On Wed, Jan 19, 2022 at 11:20:38AM +0200, Andy Shevchenko wrote:
>On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
>wrote:
>
>> Follow the yes/no logic and add helpers for enabled/disabled and
>> enable/disable - those are not so common throughout the kernel,
>> but they give a nice way to reuse the strings to log things as
>> enabled/disabled or enable/disable.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>>  include/linux/string_helpers.h    |  2 ++
>>  2 files changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_utils.h
>> b/drivers/gpu/drm/i915/i915_utils.h
>> index 2a8781cc648b..cbec79bae0d2 100644
>> --- a/drivers/gpu/drm/i915/i915_utils.h
>> +++ b/drivers/gpu/drm/i915/i915_utils.h
>> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>>         return v ? "on" : "off";
>>  }
>>
>> -static inline const char *enabledisable(bool v)
>> -{
>> -       return v ? "enable" : "disable";
>> -}
>> -
>> -static inline const char *enableddisabled(bool v)
>> -{
>> -       return v ? "enabled" : "disabled";
>> -}
>> -
>>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>>  static inline void __add_taint_for_CI(unsigned int taint)
>>  {
>> diff --git a/include/linux/string_helpers.h b/include/linux/string_
>> helpers.h
>> index e980dec05d31..e4b82f364ee1 100644
>> --- a/include/linux/string_helpers.h
>> +++ b/include/linux/string_helpers.h
>> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
>> gfp);
>>  void kfree_strarray(char **array, size_t n);
>>
>>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
>> +static inline const char *enabledisable(bool v) { return v ? "enable" :
>> "disable"; }
>> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
>> : "disabled"; }
>
>
>Looks not readable even if takes 80 characters. Please, keep original style.
>
>
>I believe you wanted to have nice negative statistics from day 1, then you
>may add more patches in the series to cleanup more users.

not really the reason... it was just "this is small enough and
checkpatch doesn't complain" (it checks for 100 chars nowadays). But yes,
I can keep it in 4 lines.

thanks
Lucas De Marchi

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d]
@ 2022-01-19  9:42       ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19  9:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, Andy Shevchenko, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Petr Mladek, Leo Li, intel-gfx, Steven Rostedt,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel, David S . Miller,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus,
	Raju Rangoju, Alex Deucher, Andrew Morton, Christian König

On Wed, Jan 19, 2022 at 11:20:38AM +0200, Andy Shevchenko wrote:
>On Wednesday, January 19, 2022, Lucas De Marchi <lucas.demarchi@intel.com>
>wrote:
>
>> Follow the yes/no logic and add helpers for enabled/disabled and
>> enable/disable - those are not so common throughout the kernel,
>> but they give a nice way to reuse the strings to log things as
>> enabled/disabled or enable/disable.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_utils.h | 10 ----------
>>  include/linux/string_helpers.h    |  2 ++
>>  2 files changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_utils.h
>> b/drivers/gpu/drm/i915/i915_utils.h
>> index 2a8781cc648b..cbec79bae0d2 100644
>> --- a/drivers/gpu/drm/i915/i915_utils.h
>> +++ b/drivers/gpu/drm/i915/i915_utils.h
>> @@ -419,16 +419,6 @@ static inline const char *onoff(bool v)
>>         return v ? "on" : "off";
>>  }
>>
>> -static inline const char *enabledisable(bool v)
>> -{
>> -       return v ? "enable" : "disable";
>> -}
>> -
>> -static inline const char *enableddisabled(bool v)
>> -{
>> -       return v ? "enabled" : "disabled";
>> -}
>> -
>>  void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint);
>>  static inline void __add_taint_for_CI(unsigned int taint)
>>  {
>> diff --git a/include/linux/string_helpers.h b/include/linux/string_
>> helpers.h
>> index e980dec05d31..e4b82f364ee1 100644
>> --- a/include/linux/string_helpers.h
>> +++ b/include/linux/string_helpers.h
>> @@ -103,5 +103,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t
>> gfp);
>>  void kfree_strarray(char **array, size_t n);
>>
>>  static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
>> +static inline const char *enabledisable(bool v) { return v ? "enable" :
>> "disable"; }
>> +static inline const char *enableddisabled(bool v) { return v ? "enabled"
>> : "disabled"; }
>
>
>Looks not readable even if takes 80 characters. Please, keep original style.
>
>
>I believe you wanted to have nice negative statistics from day 1, then you
>may add more patches in the series to cleanup more users.

not really the reason... it was just "this is small enough and
checkpatch doesn't complain" (it checks for 100 chars nowadays). But yes,
I can keep it in 4 lines.

thanks
Lucas De Marchi

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19  7:24 ` Lucas De Marchi
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 13:18   ` Petr Mladek
  -1 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-19 13:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, Chris Wilson, Daniel Vetter, David Airlie,
	David S . Miller, Emma Anholt, Eryk Brol, Francis Laniel,
	Greg Kroah-Hartman, Harry Wentland, Jakub Kicinski, Jani Nikula,
	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

On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
> 
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> 
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
> 
> 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  <someprefix>
>    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 <prefix>_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... ;-)


> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]

Thanks for not going this way :-)

> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
> 
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
> 
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.

I agree with Andy that it should go via drm tree. It would make it
easier to handle potential conflicts.

Just in case, you decide to go with str_yes_no() or something similar.
Mass changes are typically done at the end on the merge window.
The best solution is when it can be done by a script.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 13:18   ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-19 13:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
> 
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> 
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
> 
> 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  <someprefix>
>    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 <prefix>_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... ;-)


> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]

Thanks for not going this way :-)

> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
> 
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
> 
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.

I agree with Andy that it should go via drm tree. It would make it
easier to handle potential conflicts.

Just in case, you decide to go with str_yes_no() or something similar.
Mass changes are typically done at the end on the merge window.
The best solution is when it can be done by a script.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 13:18   ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-19 13:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Julia Lawall, Rahul Lakkireddy, Steven Rostedt,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
> 
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> 
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
> 
> 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  <someprefix>
>    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 <prefix>_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... ;-)


> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]

Thanks for not going this way :-)

> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
> 
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
> 
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.

I agree with Andy that it should go via drm tree. It would make it
easier to handle potential conflicts.

Just in case, you decide to go with str_yes_no() or something similar.
Mass changes are typically done at the end on the merge window.
The best solution is when it can be done by a script.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 13:18   ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-19 13:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
> 
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> 
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
> 
> 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  <someprefix>
>    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 <prefix>_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... ;-)


> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]

Thanks for not going this way :-)

> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
> 
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
> 
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.

I agree with Andy that it should go via drm tree. It would make it
easier to handle potential conflicts.

Just in case, you decide to go with str_yes_no() or something similar.
Mass changes are typically done at the end on the merge window.
The best solution is when it can be done by a script.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 13:18   ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-19 13:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> Add some helpers under lib/string_helpers.h so they can be used
> throughout the kernel. When I started doing this there were 2 other
> previous attempts I know of, not counting the iterations each of them
> had:
> 
> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> 
> Going through the comments I tried to find some common ground and
> justification for what is in here, addressing some of the concerns
> raised.
> 
> 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  <someprefix>
>    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 <prefix>_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... ;-)


> e. One alternative to all of this suggested by Christian König
>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>    printk format. But besides the comment, he also seemed to like
>    the common function. This brought the argument from others that the
>    simple yesno()/enabledisable() already used in the code is easier to
>    remember and use than e.g. %py[DOY]

Thanks for not going this way :-)

> Last patch also has some additional conversion of open coded cases. I
> preferred starting with drm/ since this is "closer to home".
> 
> I hope this is a good summary of the previous attempts and a way we can
> move forward.
> 
> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> proposal is to take first 2 patches either through mm tree or maybe
> vsprintf. Last patch can be taken later through drm.

I agree with Andy that it should go via drm tree. It would make it
easier to handle potential conflicts.

Just in case, you decide to go with str_yes_no() or something similar.
Mass changes are typically done at the end on the merge window.
The best solution is when it can be done by a script.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19 13:18   ` Petr Mladek
                       ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 14:16     ` Jani Nikula
  -1 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19 14:16 UTC (permalink / raw)
  To: Petr Mladek, Lucas De Marchi
  Cc: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, 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

On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> Add some helpers under lib/string_helpers.h so they can be used
>> throughout the kernel. When I started doing this there were 2 other
>> previous attempts I know of, not counting the iterations each of them
>> had:
>> 
>> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> 
>> Going through the comments I tried to find some common ground and
>> justification for what is in here, addressing some of the concerns
>> raised.
>> 
>> 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  <someprefix>
>>    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 <prefix>_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.

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.

>
>
>> e. One alternative to all of this suggested by Christian König
>>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>>    printk format. But besides the comment, he also seemed to like
>>    the common function. This brought the argument from others that the
>>    simple yesno()/enabledisable() already used in the code is easier to
>>    remember and use than e.g. %py[DOY]
>
> Thanks for not going this way :-)
>
>> Last patch also has some additional conversion of open coded cases. I
>> preferred starting with drm/ since this is "closer to home".
>> 
>> I hope this is a good summary of the previous attempts and a way we can
>> move forward.
>> 
>> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
>> proposal is to take first 2 patches either through mm tree or maybe
>> vsprintf. Last patch can be taken later through drm.
>
> I agree with Andy that it should go via drm tree. It would make it
> easier to handle potential conflicts.
>
> Just in case, you decide to go with str_yes_no() or something similar.
> Mass changes are typically done at the end on the merge window.
> The best solution is when it can be done by a script.
>
> Best Regards,
> Petr

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 14:16     ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19 14:16 UTC (permalink / raw)
  To: Petr Mladek, Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Steven Rostedt,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> Add some helpers under lib/string_helpers.h so they can be used
>> throughout the kernel. When I started doing this there were 2 other
>> previous attempts I know of, not counting the iterations each of them
>> had:
>> 
>> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> 
>> Going through the comments I tried to find some common ground and
>> justification for what is in here, addressing some of the concerns
>> raised.
>> 
>> 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  <someprefix>
>>    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 <prefix>_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.

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.

>
>
>> e. One alternative to all of this suggested by Christian König
>>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>>    printk format. But besides the comment, he also seemed to like
>>    the common function. This brought the argument from others that the
>>    simple yesno()/enabledisable() already used in the code is easier to
>>    remember and use than e.g. %py[DOY]
>
> Thanks for not going this way :-)
>
>> Last patch also has some additional conversion of open coded cases. I
>> preferred starting with drm/ since this is "closer to home".
>> 
>> I hope this is a good summary of the previous attempts and a way we can
>> move forward.
>> 
>> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
>> proposal is to take first 2 patches either through mm tree or maybe
>> vsprintf. Last patch can be taken later through drm.
>
> I agree with Andy that it should go via drm tree. It would make it
> easier to handle potential conflicts.
>
> Just in case, you decide to go with str_yes_no() or something similar.
> Mass changes are typically done at the end on the merge window.
> The best solution is when it can be done by a script.
>
> Best Regards,
> Petr

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 14:16     ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19 14:16 UTC (permalink / raw)
  To: Petr Mladek, Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> Add some helpers under lib/string_helpers.h so they can be used
>> throughout the kernel. When I started doing this there were 2 other
>> previous attempts I know of, not counting the iterations each of them
>> had:
>> 
>> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> 
>> Going through the comments I tried to find some common ground and
>> justification for what is in here, addressing some of the concerns
>> raised.
>> 
>> 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  <someprefix>
>>    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 <prefix>_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.

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.

>
>
>> e. One alternative to all of this suggested by Christian König
>>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>>    printk format. But besides the comment, he also seemed to like
>>    the common function. This brought the argument from others that the
>>    simple yesno()/enabledisable() already used in the code is easier to
>>    remember and use than e.g. %py[DOY]
>
> Thanks for not going this way :-)
>
>> Last patch also has some additional conversion of open coded cases. I
>> preferred starting with drm/ since this is "closer to home".
>> 
>> I hope this is a good summary of the previous attempts and a way we can
>> move forward.
>> 
>> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
>> proposal is to take first 2 patches either through mm tree or maybe
>> vsprintf. Last patch can be taken later through drm.
>
> I agree with Andy that it should go via drm tree. It would make it
> easier to handle potential conflicts.
>
> Just in case, you decide to go with str_yes_no() or something similar.
> Mass changes are typically done at the end on the merge window.
> The best solution is when it can be done by a script.
>
> Best Regards,
> Petr

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 14:16     ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19 14:16 UTC (permalink / raw)
  To: Petr Mladek, Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> Add some helpers under lib/string_helpers.h so they can be used
>> throughout the kernel. When I started doing this there were 2 other
>> previous attempts I know of, not counting the iterations each of them
>> had:
>> 
>> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> 
>> Going through the comments I tried to find some common ground and
>> justification for what is in here, addressing some of the concerns
>> raised.
>> 
>> 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  <someprefix>
>>    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 <prefix>_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.

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.

>
>
>> e. One alternative to all of this suggested by Christian König
>>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>>    printk format. But besides the comment, he also seemed to like
>>    the common function. This brought the argument from others that the
>>    simple yesno()/enabledisable() already used in the code is easier to
>>    remember and use than e.g. %py[DOY]
>
> Thanks for not going this way :-)
>
>> Last patch also has some additional conversion of open coded cases. I
>> preferred starting with drm/ since this is "closer to home".
>> 
>> I hope this is a good summary of the previous attempts and a way we can
>> move forward.
>> 
>> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
>> proposal is to take first 2 patches either through mm tree or maybe
>> vsprintf. Last patch can be taken later through drm.
>
> I agree with Andy that it should go via drm tree. It would make it
> easier to handle potential conflicts.
>
> Just in case, you decide to go with str_yes_no() or something similar.
> Mass changes are typically done at the end on the merge window.
> The best solution is when it can be done by a script.
>
> Best Regards,
> Petr

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 14:16     ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-19 14:16 UTC (permalink / raw)
  To: Petr Mladek, Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Steven Rostedt,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> Add some helpers under lib/string_helpers.h so they can be used
>> throughout the kernel. When I started doing this there were 2 other
>> previous attempts I know of, not counting the iterations each of them
>> had:
>> 
>> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> 
>> Going through the comments I tried to find some common ground and
>> justification for what is in here, addressing some of the concerns
>> raised.
>> 
>> 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  <someprefix>
>>    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 <prefix>_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.

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.

>
>
>> e. One alternative to all of this suggested by Christian König
>>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
>>    printk format. But besides the comment, he also seemed to like
>>    the common function. This brought the argument from others that the
>>    simple yesno()/enabledisable() already used in the code is easier to
>>    remember and use than e.g. %py[DOY]
>
> Thanks for not going this way :-)
>
>> Last patch also has some additional conversion of open coded cases. I
>> preferred starting with drm/ since this is "closer to home".
>> 
>> I hope this is a good summary of the previous attempts and a way we can
>> move forward.
>> 
>> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
>> proposal is to take first 2 patches either through mm tree or maybe
>> vsprintf. Last patch can be taken later through drm.
>
> I agree with Andy that it should go via drm tree. It would make it
> easier to handle potential conflicts.
>
> Just in case, you decide to go with str_yes_no() or something similar.
> Mass changes are typically done at the end on the merge window.
> The best solution is when it can be done by a script.
>
> Best Regards,
> Petr

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19  9:15     ` Andy Shevchenko
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 15:01       ` Steven Rostedt
  -1 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Vishal Kulkarni

On Wed, 19 Jan 2022 11:15:08 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> 
> 
> 
> Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
> (enable/disable) it will not be possible to keep on one line. And hence
> style will be broken among similar functions.

Agreed. Functions should always be of the normal format:

type func(params)
{
	body;
}

Unless it is a stub function.

type func(params) { return 0; }

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:01       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 11:15:08 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> 
> 
> 
> Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
> (enable/disable) it will not be possible to keep on one line. And hence
> style will be broken among similar functions.

Agreed. Functions should always be of the normal format:

type func(params)
{
	body;
}

Unless it is a stub function.

type func(params) { return 0; }

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:01       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 11:15:08 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> 
> 
> 
> Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
> (enable/disable) it will not be possible to keep on one line. And hence
> style will be broken among similar functions.

Agreed. Functions should always be of the normal format:

type func(params)
{
	body;
}

Unless it is a stub function.

type func(params) { return 0; }

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:01       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Julia Lawall, Rahul Lakkireddy,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 11:15:08 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> 
> 
> 
> Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
> (enable/disable) it will not be possible to keep on one line. And hence
> style will be broken among similar functions.

Agreed. Functions should always be of the normal format:

type func(params)
{
	body;
}

Unless it is a stub function.

type func(params) { return 0; }

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:01       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:01 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 11:15:08 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> 
> 
> 
> Perhaps keep it on 4 lines? Yes, yes/no is short, but if we add others
> (enable/disable) it will not be possible to keep on one line. And hence
> style will be broken among similar functions.

Agreed. Functions should always be of the normal format:

type func(params)
{
	body;
}

Unless it is a stub function.

type func(params) { return 0; }

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19  9:18     ` Sakari Ailus
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 15:06       ` Steven Rostedt
  -1 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:06 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, Chris Wilson, Daniel Vetter, David Airlie,
	David S . Miller, Emma Anholt, Eryk Brol, Francis Laniel,
	Greg Kroah-Hartman, Harry Wentland, Jakub Kicinski, Jani Nikula,
	Joonas Lahtinen, Julia Lawall, Kentaro Takeda, Leo Li,
	Mikita Lipski, Petr Mladek, Rahul Lakkireddy, Raju Rangoju,
	Rasmus Villemoes, Rodrigo Vivi, Sergey Senozhatsky,
	Vishal Kulkarni

On Wed, 19 Jan 2022 11:18:59 +0200
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> >  	case 3:
> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> >  			tomoyo_io_printf(head, " grant_log=%s",
> > -					 tomoyo_yesno(cond->grant_log ==
> > -						      TOMOYO_GRANTLOG_YES));
> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> 
> This would be better split on two lines.

Really? Yuck!

I thought the "max line size" guideline was going to grow to a 100, but I
still see it as 80. But anyway...

	cond->grant_log ==
	TOMOYO_GRANTLOG_YES

is not readable at all. Not compared to

	cond->grant_log == TOMOYO_GRANTLOG_YES

I say keep it one line!

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> 
> Then,
> 
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:06       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:06 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 11:18:59 +0200
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> >  	case 3:
> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> >  			tomoyo_io_printf(head, " grant_log=%s",
> > -					 tomoyo_yesno(cond->grant_log ==
> > -						      TOMOYO_GRANTLOG_YES));
> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> 
> This would be better split on two lines.

Really? Yuck!

I thought the "max line size" guideline was going to grow to a 100, but I
still see it as 80. But anyway...

	cond->grant_log ==
	TOMOYO_GRANTLOG_YES

is not readable at all. Not compared to

	cond->grant_log == TOMOYO_GRANTLOG_YES

I say keep it one line!

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> 
> Then,
> 
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:06       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:06 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Petr Mladek, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 11:18:59 +0200
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> >  	case 3:
> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> >  			tomoyo_io_printf(head, " grant_log=%s",
> > -					 tomoyo_yesno(cond->grant_log ==
> > -						      TOMOYO_GRANTLOG_YES));
> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> 
> This would be better split on two lines.

Really? Yuck!

I thought the "max line size" guideline was going to grow to a 100, but I
still see it as 80. But anyway...

	cond->grant_log ==
	TOMOYO_GRANTLOG_YES

is not readable at all. Not compared to

	cond->grant_log == TOMOYO_GRANTLOG_YES

I say keep it one line!

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> 
> Then,
> 
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:06       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:06 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Julia Lawall, Rahul Lakkireddy,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 11:18:59 +0200
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> >  	case 3:
> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> >  			tomoyo_io_printf(head, " grant_log=%s",
> > -					 tomoyo_yesno(cond->grant_log ==
> > -						      TOMOYO_GRANTLOG_YES));
> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> 
> This would be better split on two lines.

Really? Yuck!

I thought the "max line size" guideline was going to grow to a 100, but I
still see it as 80. But anyway...

	cond->grant_log ==
	TOMOYO_GRANTLOG_YES

is not readable at all. Not compared to

	cond->grant_log == TOMOYO_GRANTLOG_YES

I say keep it one line!

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> 
> Then,
> 
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 15:06       ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 15:06 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 11:18:59 +0200
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> >  	case 3:
> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> >  			tomoyo_io_printf(head, " grant_log=%s",
> > -					 tomoyo_yesno(cond->grant_log ==
> > -						      TOMOYO_GRANTLOG_YES));
> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> 
> This would be better split on two lines.

Really? Yuck!

I thought the "max line size" guideline was going to grow to a 100, but I
still see it as 80. But anyway...

	cond->grant_log ==
	TOMOYO_GRANTLOG_YES

is not readable at all. Not compared to

	cond->grant_log == TOMOYO_GRANTLOG_YES

I say keep it one line!

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> 
> Then,
> 
> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19 14:16     ` [Nouveau] " Jani Nikula
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 16:15       ` Daniel Vetter
  -1 siblings, 0 replies; 160+ messages in thread
From: Daniel Vetter @ 2022-01-19 16:15 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Petr Mladek, Lucas De Marchi, linux-kernel, intel-gfx, dri-devel,
	amd-gfx, linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, 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

On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> >> Add some helpers under lib/string_helpers.h so they can be used
> >> throughout the kernel. When I started doing this there were 2 other
> >> previous attempts I know of, not counting the iterations each of them
> >> had:
> >> 
> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> >> 
> >> Going through the comments I tried to find some common ground and
> >> justification for what is in here, addressing some of the concerns
> >> raised.
> >> 
> >> 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  <someprefix>
> >>    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 <prefix>_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.
> 
> 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 we can sed this anytime later we want to, but we need to get the foot
in the door. There's also a pile more of these all over.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on the series, maybe it helps? And yes let's merge this through drm-misc.
-Daniel

> 
> >
> >
> >> e. One alternative to all of this suggested by Christian König
> >>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
> >>    printk format. But besides the comment, he also seemed to like
> >>    the common function. This brought the argument from others that the
> >>    simple yesno()/enabledisable() already used in the code is easier to
> >>    remember and use than e.g. %py[DOY]
> >
> > Thanks for not going this way :-)
> >
> >> Last patch also has some additional conversion of open coded cases. I
> >> preferred starting with drm/ since this is "closer to home".
> >> 
> >> I hope this is a good summary of the previous attempts and a way we can
> >> move forward.
> >> 
> >> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> >> proposal is to take first 2 patches either through mm tree or maybe
> >> vsprintf. Last patch can be taken later through drm.
> >
> > I agree with Andy that it should go via drm tree. It would make it
> > easier to handle potential conflicts.
> >
> > Just in case, you decide to go with str_yes_no() or something similar.
> > Mass changes are typically done at the end on the merge window.
> > The best solution is when it can be done by a script.
> >
> > Best Regards,
> > Petr
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 16:15       ` Daniel Vetter
  0 siblings, 0 replies; 160+ messages in thread
From: Daniel Vetter @ 2022-01-19 16:15 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Rodrigo Vivi, Andy Shevchenko, Eryk Brol, netdev, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, Greg Kroah-Hartman, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> >> Add some helpers under lib/string_helpers.h so they can be used
> >> throughout the kernel. When I started doing this there were 2 other
> >> previous attempts I know of, not counting the iterations each of them
> >> had:
> >> 
> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> >> 
> >> Going through the comments I tried to find some common ground and
> >> justification for what is in here, addressing some of the concerns
> >> raised.
> >> 
> >> 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  <someprefix>
> >>    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 <prefix>_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.
> 
> 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 we can sed this anytime later we want to, but we need to get the foot
in the door. There's also a pile more of these all over.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on the series, maybe it helps? And yes let's merge this through drm-misc.
-Daniel

> 
> >
> >
> >> e. One alternative to all of this suggested by Christian König
> >>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
> >>    printk format. But besides the comment, he also seemed to like
> >>    the common function. This brought the argument from others that the
> >>    simple yesno()/enabledisable() already used in the code is easier to
> >>    remember and use than e.g. %py[DOY]
> >
> > Thanks for not going this way :-)
> >
> >> Last patch also has some additional conversion of open coded cases. I
> >> preferred starting with drm/ since this is "closer to home".
> >> 
> >> I hope this is a good summary of the previous attempts and a way we can
> >> move forward.
> >> 
> >> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> >> proposal is to take first 2 patches either through mm tree or maybe
> >> vsprintf. Last patch can be taken later through drm.
> >
> > I agree with Andy that it should go via drm tree. It would make it
> > easier to handle potential conflicts.
> >
> > Just in case, you decide to go with str_yes_no() or something similar.
> > Mass changes are typically done at the end on the merge window.
> > The best solution is when it can be done by a script.
> >
> > Best Regards,
> > Petr
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 16:15       ` Daniel Vetter
  0 siblings, 0 replies; 160+ messages in thread
From: Daniel Vetter @ 2022-01-19 16:15 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Andy Shevchenko, Eryk Brol,
	netdev, linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, Greg Kroah-Hartman, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> >> Add some helpers under lib/string_helpers.h so they can be used
> >> throughout the kernel. When I started doing this there were 2 other
> >> previous attempts I know of, not counting the iterations each of them
> >> had:
> >> 
> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> >> 
> >> Going through the comments I tried to find some common ground and
> >> justification for what is in here, addressing some of the concerns
> >> raised.
> >> 
> >> 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  <someprefix>
> >>    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 <prefix>_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.
> 
> 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 we can sed this anytime later we want to, but we need to get the foot
in the door. There's also a pile more of these all over.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on the series, maybe it helps? And yes let's merge this through drm-misc.
-Daniel

> 
> >
> >
> >> e. One alternative to all of this suggested by Christian König
> >>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
> >>    printk format. But besides the comment, he also seemed to like
> >>    the common function. This brought the argument from others that the
> >>    simple yesno()/enabledisable() already used in the code is easier to
> >>    remember and use than e.g. %py[DOY]
> >
> > Thanks for not going this way :-)
> >
> >> Last patch also has some additional conversion of open coded cases. I
> >> preferred starting with drm/ since this is "closer to home".
> >> 
> >> I hope this is a good summary of the previous attempts and a way we can
> >> move forward.
> >> 
> >> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> >> proposal is to take first 2 patches either through mm tree or maybe
> >> vsprintf. Last patch can be taken later through drm.
> >
> > I agree with Andy that it should go via drm tree. It would make it
> > easier to handle potential conflicts.
> >
> > Just in case, you decide to go with str_yes_no() or something similar.
> > Mass changes are typically done at the end on the merge window.
> > The best solution is when it can be done by a script.
> >
> > Best Regards,
> > Petr
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 16:15       ` Daniel Vetter
  0 siblings, 0 replies; 160+ messages in thread
From: Daniel Vetter @ 2022-01-19 16:15 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Steven Rostedt,
	Julia Lawall, Rahul Lakkireddy, Andy Shevchenko, Eryk Brol,
	netdev, linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, Greg Kroah-Hartman, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> >> Add some helpers under lib/string_helpers.h so they can be used
> >> throughout the kernel. When I started doing this there were 2 other
> >> previous attempts I know of, not counting the iterations each of them
> >> had:
> >> 
> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> >> 
> >> Going through the comments I tried to find some common ground and
> >> justification for what is in here, addressing some of the concerns
> >> raised.
> >> 
> >> 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  <someprefix>
> >>    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 <prefix>_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.
> 
> 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 we can sed this anytime later we want to, but we need to get the foot
in the door. There's also a pile more of these all over.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on the series, maybe it helps? And yes let's merge this through drm-misc.
-Daniel

> 
> >
> >
> >> e. One alternative to all of this suggested by Christian König
> >>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
> >>    printk format. But besides the comment, he also seemed to like
> >>    the common function. This brought the argument from others that the
> >>    simple yesno()/enabledisable() already used in the code is easier to
> >>    remember and use than e.g. %py[DOY]
> >
> > Thanks for not going this way :-)
> >
> >> Last patch also has some additional conversion of open coded cases. I
> >> preferred starting with drm/ since this is "closer to home".
> >> 
> >> I hope this is a good summary of the previous attempts and a way we can
> >> move forward.
> >> 
> >> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> >> proposal is to take first 2 patches either through mm tree or maybe
> >> vsprintf. Last patch can be taken later through drm.
> >
> > I agree with Andy that it should go via drm tree. It would make it
> > easier to handle potential conflicts.
> >
> > Just in case, you decide to go with str_yes_no() or something similar.
> > Mass changes are typically done at the end on the merge window.
> > The best solution is when it can be done by a script.
> >
> > Best Regards,
> > Petr
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 16:15       ` Daniel Vetter
  0 siblings, 0 replies; 160+ messages in thread
From: Daniel Vetter @ 2022-01-19 16:15 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Rodrigo Vivi, Andy Shevchenko, Eryk Brol, netdev, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, Greg Kroah-Hartman, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
> >> Add some helpers under lib/string_helpers.h so they can be used
> >> throughout the kernel. When I started doing this there were 2 other
> >> previous attempts I know of, not counting the iterations each of them
> >> had:
> >> 
> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
> >> 
> >> Going through the comments I tried to find some common ground and
> >> justification for what is in here, addressing some of the concerns
> >> raised.
> >> 
> >> 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  <someprefix>
> >>    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 <prefix>_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.
> 
> 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 we can sed this anytime later we want to, but we need to get the foot
in the door. There's also a pile more of these all over.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on the series, maybe it helps? And yes let's merge this through drm-misc.
-Daniel

> 
> >
> >
> >> e. One alternative to all of this suggested by Christian König
> >>    (43456ba7-c372-84cc-4949-dcb817188e21@amd.com) would be to add a
> >>    printk format. But besides the comment, he also seemed to like
> >>    the common function. This brought the argument from others that the
> >>    simple yesno()/enabledisable() already used in the code is easier to
> >>    remember and use than e.g. %py[DOY]
> >
> > Thanks for not going this way :-)
> >
> >> Last patch also has some additional conversion of open coded cases. I
> >> preferred starting with drm/ since this is "closer to home".
> >> 
> >> I hope this is a good summary of the previous attempts and a way we can
> >> move forward.
> >> 
> >> Andrew Morton, Petr Mladek, Andy Shevchenko: if this is accepted, my
> >> proposal is to take first 2 patches either through mm tree or maybe
> >> vsprintf. Last patch can be taken later through drm.
> >
> > I agree with Andy that it should go via drm tree. It would make it
> > easier to handle potential conflicts.
> >
> > Just in case, you decide to go with str_yes_no() or something similar.
> > Mass changes are typically done at the end on the merge window.
> > The best solution is when it can be done by a script.
> >
> > Best Regards,
> > Petr
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 15:01       ` [Nouveau] " Steven Rostedt
                           ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 16:37         ` David Laight
  -1 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:37 UTC (permalink / raw)
  To: 'Steven Rostedt', Andy Shevchenko
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Vishal Kulkarni

> > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }

	return "yes\0no" + v * 4;

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:37         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:37 UTC (permalink / raw)
  To: 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

> > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }

	return "yes\0no" + v * 4;

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:37         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:37 UTC (permalink / raw)
  To: 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

> > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }

	return "yes\0no" + v * 4;

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:37         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:37 UTC (permalink / raw)
  To: 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Julia Lawall, Rahul Lakkireddy,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

> > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }

	return "yes\0no" + v * 4;

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:37         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:37 UTC (permalink / raw)
  To: 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

> > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }

	return "yes\0no" + v * 4;

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 16:37         ` [Nouveau] " David Laight
                             ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 16:38           ` David Laight
  -1 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:38 UTC (permalink / raw)
  To: David Laight, 'Steven Rostedt', Andy Shevchenko
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Vishal Kulkarni

> > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> 
> 	return "yes\0no" + v * 4;
> 
> :-)

except '"no\0\0yes" + v * 4' works a bit better.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:38           ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:38 UTC (permalink / raw)
  To: David Laight, 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Andy Shevchenko,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

> > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> 
> 	return "yes\0no" + v * 4;
> 
> :-)

except '"no\0\0yes" + v * 4' works a bit better.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:38           ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:38 UTC (permalink / raw)
  To: David Laight, 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Ben Skeggs, Jakub Kicinski,
	Harry Wentland, Petr Mladek, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Julia Lawall, Rahul Lakkireddy,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

> > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> 
> 	return "yes\0no" + v * 4;
> 
> :-)

except '"no\0\0yes" + v * 4' works a bit better.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:38           ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:38 UTC (permalink / raw)
  To: David Laight, 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

> > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> 
> 	return "yes\0no" + v * 4;
> 
> :-)

except '"no\0\0yes" + v * 4' works a bit better.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 16:38           ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 16:38 UTC (permalink / raw)
  To: David Laight, 'Steven Rostedt', Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Jani Nikula, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

> > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> 
> 	return "yes\0no" + v * 4;
> 
> :-)

except '"no\0\0yes" + v * 4' works a bit better.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 16:38           ` David Laight
                               ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 19:22             ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:22 UTC (permalink / raw)
  To: David Laight
  Cc: 'Steven Rostedt',
	Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Ben Skeggs, Christian König, Chris Wilson,
	Daniel Vetter, David Airlie, David S . Miller, Emma Anholt,
	Eryk Brol, Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Vishal Kulkarni

On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> > 
> > 	return "yes\0no" + v * 4;
> > 
> > :-)
> 
> except '"no\0\0yes" + v * 4' works a bit better.

Is it a C code obfuscation contest?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:22             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:22 UTC (permalink / raw)
  To: David Laight
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Jani Nikula, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> > 
> > 	return "yes\0no" + v * 4;
> > 
> > :-)
> 
> except '"no\0\0yes" + v * 4' works a bit better.

Is it a C code obfuscation contest?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:22             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:22 UTC (permalink / raw)
  To: David Laight
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> > 
> > 	return "yes\0no" + v * 4;
> > 
> > :-)
> 
> except '"no\0\0yes" + v * 4' works a bit better.

Is it a C code obfuscation contest?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:22             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:22 UTC (permalink / raw)
  To: David Laight
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> > 
> > 	return "yes\0no" + v * 4;
> > 
> > :-)
> 
> except '"no\0\0yes" + v * 4' works a bit better.

Is it a C code obfuscation contest?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:22             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:22 UTC (permalink / raw)
  To: David Laight
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Jani Nikula, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }
> > 
> > 	return "yes\0no" + v * 4;
> > 
> > :-)
> 
> except '"no\0\0yes" + v * 4' works a bit better.

Is it a C code obfuscation contest?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 15:06       ` [Nouveau] " Steven Rostedt
                           ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 19:25         ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:25 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 11:18:59 +0200
> Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
> > On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> > >  	case 3:
> > >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> > >  			tomoyo_io_printf(head, " grant_log=%s",
> > > -					 tomoyo_yesno(cond->grant_log ==
> > > -						      TOMOYO_GRANTLOG_YES));
> > > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> > 
> > This would be better split on two lines.
> 
> Really? Yuck!
> 
> I thought the "max line size" guideline was going to grow to a 100, but I
> still see it as 80. But anyway...
> 
> 	cond->grant_log ==
> 	TOMOYO_GRANTLOG_YES
> 
> is not readable at all. Not compared to
> 
> 	cond->grant_log == TOMOYO_GRANTLOG_YES
> 
> I say keep it one line!
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

I believe Sakari strongly follows the 80 rule, which means...

> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

...chose either of these tags and be happy with :-)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:25         ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:25 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 11:18:59 +0200
> Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
> > On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> > >  	case 3:
> > >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> > >  			tomoyo_io_printf(head, " grant_log=%s",
> > > -					 tomoyo_yesno(cond->grant_log ==
> > > -						      TOMOYO_GRANTLOG_YES));
> > > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> > 
> > This would be better split on two lines.
> 
> Really? Yuck!
> 
> I thought the "max line size" guideline was going to grow to a 100, but I
> still see it as 80. But anyway...
> 
> 	cond->grant_log ==
> 	TOMOYO_GRANTLOG_YES
> 
> is not readable at all. Not compared to
> 
> 	cond->grant_log == TOMOYO_GRANTLOG_YES
> 
> I say keep it one line!
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

I believe Sakari strongly follows the 80 rule, which means...

> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

...chose either of these tags and be happy with :-)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:25         ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:25 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 11:18:59 +0200
> Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
> > On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> > >  	case 3:
> > >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> > >  			tomoyo_io_printf(head, " grant_log=%s",
> > > -					 tomoyo_yesno(cond->grant_log ==
> > > -						      TOMOYO_GRANTLOG_YES));
> > > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> > 
> > This would be better split on two lines.
> 
> Really? Yuck!
> 
> I thought the "max line size" guideline was going to grow to a 100, but I
> still see it as 80. But anyway...
> 
> 	cond->grant_log ==
> 	TOMOYO_GRANTLOG_YES
> 
> is not readable at all. Not compared to
> 
> 	cond->grant_log == TOMOYO_GRANTLOG_YES
> 
> I say keep it one line!
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

I believe Sakari strongly follows the 80 rule, which means...

> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

...chose either of these tags and be happy with :-)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:25         ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:25 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Sakari Ailus, Lucas De Marchi, linux-kernel, intel-gfx,
	dri-devel, amd-gfx, linux-security-module, nouveau, netdev,
	Alex Deucher, Andrew Morton, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sergey Senozhatsky, Vishal Kulkarni

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 11:18:59 +0200
> Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
> > On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> > >  	case 3:
> > >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> > >  			tomoyo_io_printf(head, " grant_log=%s",
> > > -					 tomoyo_yesno(cond->grant_log ==
> > > -						      TOMOYO_GRANTLOG_YES));
> > > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> > 
> > This would be better split on two lines.
> 
> Really? Yuck!
> 
> I thought the "max line size" guideline was going to grow to a 100, but I
> still see it as 80. But anyway...
> 
> 	cond->grant_log ==
> 	TOMOYO_GRANTLOG_YES
> 
> is not readable at all. Not compared to
> 
> 	cond->grant_log == TOMOYO_GRANTLOG_YES
> 
> I say keep it one line!
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

I believe Sakari strongly follows the 80 rule, which means...

> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

...chose either of these tags and be happy with :-)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 19:25         ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:25 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 11:18:59 +0200
> Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
> > On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
> > > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
> > >  	case 3:
> > >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
> > >  			tomoyo_io_printf(head, " grant_log=%s",
> > > -					 tomoyo_yesno(cond->grant_log ==
> > > -						      TOMOYO_GRANTLOG_YES));
> > > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));  
> > 
> > This would be better split on two lines.
> 
> Really? Yuck!
> 
> I thought the "max line size" guideline was going to grow to a 100, but I
> still see it as 80. But anyway...
> 
> 	cond->grant_log ==
> 	TOMOYO_GRANTLOG_YES
> 
> is not readable at all. Not compared to
> 
> 	cond->grant_log == TOMOYO_GRANTLOG_YES
> 
> I say keep it one line!
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

I believe Sakari strongly follows the 80 rule, which means...

> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

...chose either of these tags and be happy with :-)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 3/3] drm: Convert open yes/no strings to yesno()
  2022-01-19  7:24   ` Lucas De Marchi
                       ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 19:30     ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:30 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Ben Skeggs, Christian König, Chris Wilson,
	Daniel Vetter, David Airlie, David S . Miller, Emma Anholt,
	Eryk Brol, Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Steven Rostedt,
	Vishal Kulkarni

On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
> linux/string_helpers.h provides a helper to return "yes"/"no"
> strings. Replace the open coded versions with yesno(). The places were
> identified with the following semantic patch:
> 
> 	@@
> 	expression b;
> 	@@
> 
> 	- b ? "yes" : "no"
> 	+ yesno(b)
> 
> Then the includes were added, so we include-what-we-use, and parenthesis
> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
> still see the same binary sizes:
> 
>    text    data     bss     dec     hex filename
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

...

>  #include <linux/module.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> +#include <linux/string_helpers.h>

+ blank line?

> +#include <linux/string_helpers.h>

...

>  	seq_printf(m, "\tDP branch device present: %s\n",
> -		   branch_device ? "yes" : "no");
> +		   yesno(branch_device));

Now it's possible to keep this on one line.

...

>  	drm_printf_indent(p, indent, "imported=%s\n",
> -			  obj->import_attach ? "yes" : "no");
> +			  yesno(obj->import_attach));

81 here, but anyway, ditto!

...

>   */

+blank line here?

> +#include <linux/string_helpers.h>
> +
>  #include "aux.h"
>  #include "pad.h"

...

>  	seq_printf(m, "MMU:        %s\n",
> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>  	seq_printf(m, "TFU:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>  	seq_printf(m, "TSY:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>  	seq_printf(m, "MSO:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>  	seq_printf(m, "L3C:        %s (%dkb)\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));

I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
but I believe in these cases it's very much okay).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19 19:30     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:30 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Jani Nikula, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
> linux/string_helpers.h provides a helper to return "yes"/"no"
> strings. Replace the open coded versions with yesno(). The places were
> identified with the following semantic patch:
> 
> 	@@
> 	expression b;
> 	@@
> 
> 	- b ? "yes" : "no"
> 	+ yesno(b)
> 
> Then the includes were added, so we include-what-we-use, and parenthesis
> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
> still see the same binary sizes:
> 
>    text    data     bss     dec     hex filename
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

...

>  #include <linux/module.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> +#include <linux/string_helpers.h>

+ blank line?

> +#include <linux/string_helpers.h>

...

>  	seq_printf(m, "\tDP branch device present: %s\n",
> -		   branch_device ? "yes" : "no");
> +		   yesno(branch_device));

Now it's possible to keep this on one line.

...

>  	drm_printf_indent(p, indent, "imported=%s\n",
> -			  obj->import_attach ? "yes" : "no");
> +			  yesno(obj->import_attach));

81 here, but anyway, ditto!

...

>   */

+blank line here?

> +#include <linux/string_helpers.h>
> +
>  #include "aux.h"
>  #include "pad.h"

...

>  	seq_printf(m, "MMU:        %s\n",
> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>  	seq_printf(m, "TFU:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>  	seq_printf(m, "TSY:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>  	seq_printf(m, "MSO:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>  	seq_printf(m, "L3C:        %s (%dkb)\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));

I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
but I believe in these cases it's very much okay).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19 19:30     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:30 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
> linux/string_helpers.h provides a helper to return "yes"/"no"
> strings. Replace the open coded versions with yesno(). The places were
> identified with the following semantic patch:
> 
> 	@@
> 	expression b;
> 	@@
> 
> 	- b ? "yes" : "no"
> 	+ yesno(b)
> 
> Then the includes were added, so we include-what-we-use, and parenthesis
> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
> still see the same binary sizes:
> 
>    text    data     bss     dec     hex filename
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

...

>  #include <linux/module.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> +#include <linux/string_helpers.h>

+ blank line?

> +#include <linux/string_helpers.h>

...

>  	seq_printf(m, "\tDP branch device present: %s\n",
> -		   branch_device ? "yes" : "no");
> +		   yesno(branch_device));

Now it's possible to keep this on one line.

...

>  	drm_printf_indent(p, indent, "imported=%s\n",
> -			  obj->import_attach ? "yes" : "no");
> +			  yesno(obj->import_attach));

81 here, but anyway, ditto!

...

>   */

+blank line here?

> +#include <linux/string_helpers.h>
> +
>  #include "aux.h"
>  #include "pad.h"

...

>  	seq_printf(m, "MMU:        %s\n",
> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>  	seq_printf(m, "TFU:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>  	seq_printf(m, "TSY:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>  	seq_printf(m, "MSO:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>  	seq_printf(m, "L3C:        %s (%dkb)\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));

I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
but I believe in these cases it's very much okay).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19 19:30     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:30 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
> linux/string_helpers.h provides a helper to return "yes"/"no"
> strings. Replace the open coded versions with yesno(). The places were
> identified with the following semantic patch:
> 
> 	@@
> 	expression b;
> 	@@
> 
> 	- b ? "yes" : "no"
> 	+ yesno(b)
> 
> Then the includes were added, so we include-what-we-use, and parenthesis
> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
> still see the same binary sizes:
> 
>    text    data     bss     dec     hex filename
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

...

>  #include <linux/module.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> +#include <linux/string_helpers.h>

+ blank line?

> +#include <linux/string_helpers.h>

...

>  	seq_printf(m, "\tDP branch device present: %s\n",
> -		   branch_device ? "yes" : "no");
> +		   yesno(branch_device));

Now it's possible to keep this on one line.

...

>  	drm_printf_indent(p, indent, "imported=%s\n",
> -			  obj->import_attach ? "yes" : "no");
> +			  yesno(obj->import_attach));

81 here, but anyway, ditto!

...

>   */

+blank line here?

> +#include <linux/string_helpers.h>
> +
>  #include "aux.h"
>  #include "pad.h"

...

>  	seq_printf(m, "MMU:        %s\n",
> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>  	seq_printf(m, "TFU:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>  	seq_printf(m, "TSY:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>  	seq_printf(m, "MSO:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>  	seq_printf(m, "L3C:        %s (%dkb)\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));

I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
but I believe in these cases it's very much okay).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-19 19:30     ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 19:30 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Jani Nikula, Julia Lawall,
	Rahul Lakkireddy, Steven Rostedt, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
> linux/string_helpers.h provides a helper to return "yes"/"no"
> strings. Replace the open coded versions with yesno(). The places were
> identified with the following semantic patch:
> 
> 	@@
> 	expression b;
> 	@@
> 
> 	- b ? "yes" : "no"
> 	+ yesno(b)
> 
> Then the includes were added, so we include-what-we-use, and parenthesis
> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
> still see the same binary sizes:
> 
>    text    data     bss     dec     hex filename
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old

...

>  #include <linux/module.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> +#include <linux/string_helpers.h>

+ blank line?

> +#include <linux/string_helpers.h>

...

>  	seq_printf(m, "\tDP branch device present: %s\n",
> -		   branch_device ? "yes" : "no");
> +		   yesno(branch_device));

Now it's possible to keep this on one line.

...

>  	drm_printf_indent(p, indent, "imported=%s\n",
> -			  obj->import_attach ? "yes" : "no");
> +			  yesno(obj->import_attach));

81 here, but anyway, ditto!

...

>   */

+blank line here?

> +#include <linux/string_helpers.h>
> +
>  #include "aux.h"
>  #include "pad.h"

...

>  	seq_printf(m, "MMU:        %s\n",
> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>  	seq_printf(m, "TFU:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>  	seq_printf(m, "TSY:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>  	seq_printf(m, "MSO:        %s\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>  	seq_printf(m, "L3C:        %s (%dkb)\n",
> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));

I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
but I believe in these cases it's very much okay).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 15:06       ` [Nouveau] " Steven Rostedt
  (?)
  (?)
@ 2022-01-19 20:43         ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19 20:43 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Sakari Ailus, Emma Anholt, David Airlie, nouveau,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Petr Mladek, Leo Li, intel-gfx, Raju Rangoju, Julia Lawall,
	Rahul Lakkireddy, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
>On Wed, 19 Jan 2022 11:18:59 +0200
>Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
>
>> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
>> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>> >  	case 3:
>> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>> >  			tomoyo_io_printf(head, " grant_log=%s",
>> > -					 tomoyo_yesno(cond->grant_log ==
>> > -						      TOMOYO_GRANTLOG_YES));
>> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
>>
>> This would be better split on two lines.
>
>Really? Yuck!
>
>I thought the "max line size" guideline was going to grow to a 100, but I
>still see it as 80. But anyway...

Checking that: docs still say 80, but checkpatch was changed to warn
only on 100. Commit bdc48fa11e46 ("checkpatch/coding-style: deprecate
80-column warning") is clear why the discrepancy.

Lucas De Marchi

>
>	cond->grant_log ==
>	TOMOYO_GRANTLOG_YES
>
>is not readable at all. Not compared to
>
>	cond->grant_log == TOMOYO_GRANTLOG_YES
>
>I say keep it one line!
>
>Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
>-- Steve
>
>>
>> Then,
>>
>> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:43         ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19 20:43 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, Andy Shevchenko, amd-gfx, Andy Shevchenko,
	Ben Skeggs, Jakub Kicinski, Petr Mladek, Leo Li, intel-gfx,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, David S . Miller,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus,
	Raju Rangoju, Alex Deucher, Andrew Morton, Christian König

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
>On Wed, 19 Jan 2022 11:18:59 +0200
>Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
>
>> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
>> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>> >  	case 3:
>> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>> >  			tomoyo_io_printf(head, " grant_log=%s",
>> > -					 tomoyo_yesno(cond->grant_log ==
>> > -						      TOMOYO_GRANTLOG_YES));
>> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
>>
>> This would be better split on two lines.
>
>Really? Yuck!
>
>I thought the "max line size" guideline was going to grow to a 100, but I
>still see it as 80. But anyway...

Checking that: docs still say 80, but checkpatch was changed to warn
only on 100. Commit bdc48fa11e46 ("checkpatch/coding-style: deprecate
80-column warning") is clear why the discrepancy.

Lucas De Marchi

>
>	cond->grant_log ==
>	TOMOYO_GRANTLOG_YES
>
>is not readable at all. Not compared to
>
>	cond->grant_log == TOMOYO_GRANTLOG_YES
>
>I say keep it one line!
>
>Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
>-- Steve
>
>>
>> Then,
>>
>> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:43         ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19 20:43 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, Andy Shevchenko, amd-gfx, Andy Shevchenko,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek, Leo Li,
	intel-gfx, Julia Lawall, Rahul Lakkireddy, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel, David S . Miller,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus,
	Raju Rangoju, Alex Deucher, Andrew Morton, Christian König

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
>On Wed, 19 Jan 2022 11:18:59 +0200
>Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
>
>> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
>> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>> >  	case 3:
>> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>> >  			tomoyo_io_printf(head, " grant_log=%s",
>> > -					 tomoyo_yesno(cond->grant_log ==
>> > -						      TOMOYO_GRANTLOG_YES));
>> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
>>
>> This would be better split on two lines.
>
>Really? Yuck!
>
>I thought the "max line size" guideline was going to grow to a 100, but I
>still see it as 80. But anyway...

Checking that: docs still say 80, but checkpatch was changed to warn
only on 100. Commit bdc48fa11e46 ("checkpatch/coding-style: deprecate
80-column warning") is clear why the discrepancy.

Lucas De Marchi

>
>	cond->grant_log ==
>	TOMOYO_GRANTLOG_YES
>
>is not readable at all. Not compared to
>
>	cond->grant_log == TOMOYO_GRANTLOG_YES
>
>I say keep it one line!
>
>Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
>-- Steve
>
>>
>> Then,
>>
>> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:43         ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19 20:43 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, Andy Shevchenko, amd-gfx, Andy Shevchenko,
	Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek, Leo Li,
	intel-gfx, Julia Lawall, Rahul Lakkireddy, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel, David S . Miller,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus,
	Raju Rangoju, Alex Deucher, Andrew Morton, Christian König

On Wed, Jan 19, 2022 at 10:06:35AM -0500, Steven Rostedt wrote:
>On Wed, 19 Jan 2022 11:18:59 +0200
>Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
>
>> On Tue, Jan 18, 2022 at 11:24:48PM -0800, Lucas De Marchi wrote:
>> > @@ -1354,8 +1345,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
>> >  	case 3:
>> >  		if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
>> >  			tomoyo_io_printf(head, " grant_log=%s",
>> > -					 tomoyo_yesno(cond->grant_log ==
>> > -						      TOMOYO_GRANTLOG_YES));
>> > +					 yesno(cond->grant_log == TOMOYO_GRANTLOG_YES));
>>
>> This would be better split on two lines.
>
>Really? Yuck!
>
>I thought the "max line size" guideline was going to grow to a 100, but I
>still see it as 80. But anyway...

Checking that: docs still say 80, but checkpatch was changed to warn
only on 100. Commit bdc48fa11e46 ("checkpatch/coding-style: deprecate
80-column warning") is clear why the discrepancy.

Lucas De Marchi

>
>	cond->grant_log ==
>	TOMOYO_GRANTLOG_YES
>
>is not readable at all. Not compared to
>
>	cond->grant_log == TOMOYO_GRANTLOG_YES
>
>I say keep it one line!
>
>Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
>-- Steve
>
>>
>> Then,
>>
>> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19 16:15       ` [Nouveau] " Daniel Vetter
@ 2022-01-19 20:53         ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19 20:53 UTC (permalink / raw)
  To: Jani Nikula, Petr Mladek, linux-kernel, intel-gfx, dri-devel,
	amd-gfx, linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, Chris Wilson, 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

On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
>On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
>> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> >> Add some helpers under lib/string_helpers.h so they can be used
>> >> throughout the kernel. When I started doing this there were 2 other
>> >> previous attempts I know of, not counting the iterations each of them
>> >> had:
>> >>
>> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> >>
>> >> Going through the comments I tried to find some common ground and
>> >> justification for what is in here, addressing some of the concerns
>> >> raised.
>> >>
>> >> 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  <someprefix>
>> >>    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 <prefix>_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.
>>
>> 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 we can sed this anytime later we want to, but we need to get the foot
>in the door. There's also a pile more of these all over.
>
>Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
>on the series, maybe it helps? And yes let's merge this through drm-misc.

Ok, it seems we are reaching some agreement here then:

- Change it to use str_ prefix
- Wait -rc1 to avoid conflict
- Merge through drm-misc

I will re-send the series again soon.

Lucas De Marchi

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 20:53         ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-19 20:53 UTC (permalink / raw)
  To: Jani Nikula, Petr Mladek, linux-kernel, intel-gfx, dri-devel,
	amd-gfx, linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, Chris Wilson, 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

On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
>On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
>> > On Tue 2022-01-18 23:24:47, Lucas De Marchi wrote:
>> >> Add some helpers under lib/string_helpers.h so they can be used
>> >> throughout the kernel. When I started doing this there were 2 other
>> >> previous attempts I know of, not counting the iterations each of them
>> >> had:
>> >>
>> >> 1) https://lore.kernel.org/all/20191023131308.9420-1-jani.nikula@intel.com/
>> >> 2) https://lore.kernel.org/all/20210215142137.64476-1-andriy.shevchenko@linux.intel.com/#t
>> >>
>> >> Going through the comments I tried to find some common ground and
>> >> justification for what is in here, addressing some of the concerns
>> >> raised.
>> >>
>> >> 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  <someprefix>
>> >>    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 <prefix>_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.
>>
>> 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 we can sed this anytime later we want to, but we need to get the foot
>in the door. There's also a pile more of these all over.
>
>Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
>on the series, maybe it helps? And yes let's merge this through drm-misc.

Ok, it seems we are reaching some agreement here then:

- Change it to use str_ prefix
- Wait -rc1 to avoid conflict
- Merge through drm-misc

I will re-send the series again soon.

Lucas De Marchi

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 19:22             ` [Nouveau] " Andy Shevchenko
                                 ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 20:58               ` Steven Rostedt
  -1 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 20:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Laight, Lucas De Marchi, linux-kernel, intel-gfx,
	dri-devel, amd-gfx, linux-security-module, nouveau, netdev,
	Alex Deucher, Andrew Morton, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Vishal Kulkarni

On Wed, 19 Jan 2022 21:22:57 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> > > 
> > > 	return "yes\0no" + v * 4;
> > > 
> > > :-)  
> > 
> > except '"no\0\0yes" + v * 4' works a bit better.  
> 
> Is it a C code obfuscation contest?
> 

	return '/'/'/';

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:58               ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 20:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	David Laight, Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 21:22:57 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> > > 
> > > 	return "yes\0no" + v * 4;
> > > 
> > > :-)  
> > 
> > except '"no\0\0yes" + v * 4' works a bit better.  
> 
> Is it a C code obfuscation contest?
> 

	return '/'/'/';

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:58               ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 20:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, David Laight, netdev,
	Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 21:22:57 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> > > 
> > > 	return "yes\0no" + v * 4;
> > > 
> > > :-)  
> > 
> > except '"no\0\0yes" + v * 4' works a bit better.  
> 
> Is it a C code obfuscation contest?
> 

	return '/'/'/';

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:58               ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 20:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, David Laight, netdev,
	Alex Deucher, Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 21:22:57 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> > > 
> > > 	return "yes\0no" + v * 4;
> > > 
> > > :-)  
> > 
> > except '"no\0\0yes" + v * 4' works a bit better.  
> 
> Is it a C code obfuscation contest?
> 

	return '/'/'/';

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 20:58               ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 20:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	David Laight, Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 21:22:57 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, Jan 19, 2022 at 04:38:26PM +0000, David Laight wrote:
> > > > > > +static inline const char *yesno(bool v) { return v ? "yes" : "no"; }  
> > > 
> > > 	return "yes\0no" + v * 4;
> > > 
> > > :-)  
> > 
> > except '"no\0\0yes" + v * 4' works a bit better.  
> 
> Is it a C code obfuscation contest?
> 

	return '/'/'/';

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 19:25         ` Andy Shevchenko
                             ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 21:00           ` Steven Rostedt
  -1 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 21:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Sakari Ailus, Lucas De Marchi, linux-kernel, intel-gfx,
	dri-devel, amd-gfx, linux-security-module, nouveau, netdev,
	Alex Deucher, Andrew Morton, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sergey Senozhatsky, Vishal Kulkarni

On Wed, 19 Jan 2022 21:25:08 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > I say keep it one line!
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> 
> I believe Sakari strongly follows the 80 rule, which means...

Checkpatch says "100" I think we need to simply update the docs (the
documentation always lags the code ;-)

	bdc48fa11e46f

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:00           ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 21:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 21:25:08 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > I say keep it one line!
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> 
> I believe Sakari strongly follows the 80 rule, which means...

Checkpatch says "100" I think we need to simply update the docs (the
documentation always lags the code ;-)

	bdc48fa11e46f

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:00           ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 21:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 21:25:08 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > I say keep it one line!
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> 
> I believe Sakari strongly follows the 80 rule, which means...

Checkpatch says "100" I think we need to simply update the docs (the
documentation always lags the code ;-)

	bdc48fa11e46f

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:00           ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 21:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, 19 Jan 2022 21:25:08 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > I say keep it one line!
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> 
> I believe Sakari strongly follows the 80 rule, which means...

Checkpatch says "100" I think we need to simply update the docs (the
documentation always lags the code ;-)

	bdc48fa11e46f

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:00           ` Steven Rostedt
  0 siblings, 0 replies; 160+ messages in thread
From: Steven Rostedt @ 2022-01-19 21:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 19 Jan 2022 21:25:08 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > I say keep it one line!
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> 
> I believe Sakari strongly follows the 80 rule, which means...

Checkpatch says "100" I think we need to simply update the docs (the
documentation always lags the code ;-)

	bdc48fa11e46f

-- Steve

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 21:00           ` [Nouveau] " Steven Rostedt
                               ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 21:04             ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:04 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Sakari Ailus, Lucas De Marchi, linux-kernel, intel-gfx,
	dri-devel, amd-gfx, linux-security-module, nouveau, netdev,
	Alex Deucher, Andrew Morton, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sergey Senozhatsky, Vishal Kulkarni

On Wed, Jan 19, 2022 at 04:00:17PM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

The idea of checkpatch change is for old code to avoid tons of patches
to satisfy 80 rule in (mostly) staging code. Some maintainers started /
have been using relaxed approach.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:04             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:04 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 04:00:17PM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

The idea of checkpatch change is for old code to avoid tons of patches
to satisfy 80 rule in (mostly) staging code. Some maintainers started /
have been using relaxed approach.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:04             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:04 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 04:00:17PM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

The idea of checkpatch change is for old code to avoid tons of patches
to satisfy 80 rule in (mostly) staging code. Some maintainers started /
have been using relaxed approach.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:04             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:04 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 04:00:17PM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

The idea of checkpatch change is for old code to avoid tons of patches
to satisfy 80 rule in (mostly) staging code. Some maintainers started /
have been using relaxed approach.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 21:04             ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:04 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, Jan 19, 2022 at 04:00:17PM -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

The idea of checkpatch change is for old code to avoid tons of patches
to satisfy 80 rule in (mostly) staging code. Some maintainers started /
have been using relaxed approach.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19 20:53         ` [Nouveau] " Lucas De Marchi
                             ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 21:07           ` Andy Shevchenko
  -1 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:07 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Jani Nikula, Petr Mladek, linux-kernel, intel-gfx, dri-devel,
	amd-gfx, linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Ben Skeggs, Christian König, Chris Wilson,
	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

On Wed, Jan 19, 2022 at 12:53:43PM -0800, Lucas De Marchi wrote:
> On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
> > On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:

...

> > Yeah we can sed this anytime later we want to, but we need to get the foot
> > in the door. There's also a pile more of these all over.
> > 
> > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > on the series, maybe it helps? And yes let's merge this through drm-misc.
> 
> Ok, it seems we are reaching some agreement here then:

> - Change it to use str_ prefix

Not sure about this (*), but have no strong argument against. Up to you.
Ah, yes, Jani said about additional churn this change will make if goes
together with this series. Perhaps it can be done separately?

> - Wait -rc1 to avoid conflict
> - Merge through drm-misc

*) E.g. yesno() to me doesn't sound too bad to misunderstand its meaning,
   esp.when it's used as an argument to the printf() functions.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 21:07           ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:07 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Leo Li, intel-gfx,
	Raju Rangoju, Jani Nikula, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus, netdev,
	Alex Deucher, Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 12:53:43PM -0800, Lucas De Marchi wrote:
> On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
> > On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:

...

> > Yeah we can sed this anytime later we want to, but we need to get the foot
> > in the door. There's also a pile more of these all over.
> > 
> > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > on the series, maybe it helps? And yes let's merge this through drm-misc.
> 
> Ok, it seems we are reaching some agreement here then:

> - Change it to use str_ prefix

Not sure about this (*), but have no strong argument against. Up to you.
Ah, yes, Jani said about additional churn this change will make if goes
together with this series. Perhaps it can be done separately?

> - Wait -rc1 to avoid conflict
> - Merge through drm-misc

*) E.g. yesno() to me doesn't sound too bad to misunderstand its meaning,
   esp.when it's used as an argument to the printf() functions.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 21:07           ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:07 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Leo Li,
	intel-gfx, Raju Rangoju, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus, netdev,
	Alex Deucher, Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 12:53:43PM -0800, Lucas De Marchi wrote:
> On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
> > On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:

...

> > Yeah we can sed this anytime later we want to, but we need to get the foot
> > in the door. There's also a pile more of these all over.
> > 
> > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > on the series, maybe it helps? And yes let's merge this through drm-misc.
> 
> Ok, it seems we are reaching some agreement here then:

> - Change it to use str_ prefix

Not sure about this (*), but have no strong argument against. Up to you.
Ah, yes, Jani said about additional churn this change will make if goes
together with this series. Perhaps it can be done separately?

> - Wait -rc1 to avoid conflict
> - Merge through drm-misc

*) E.g. yesno() to me doesn't sound too bad to misunderstand its meaning,
   esp.when it's used as an argument to the printf() functions.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 21:07           ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:07 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Leo Li, intel-gfx, Raju Rangoju, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Mikita Lipski, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, Sakari Ailus, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 12:53:43PM -0800, Lucas De Marchi wrote:
> On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
> > On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:

...

> > Yeah we can sed this anytime later we want to, but we need to get the foot
> > in the door. There's also a pile more of these all over.
> > 
> > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > on the series, maybe it helps? And yes let's merge this through drm-misc.
> 
> Ok, it seems we are reaching some agreement here then:

> - Change it to use str_ prefix

Not sure about this (*), but have no strong argument against. Up to you.
Ah, yes, Jani said about additional churn this change will make if goes
together with this series. Perhaps it can be done separately?

> - Wait -rc1 to avoid conflict
> - Merge through drm-misc

*) E.g. yesno() to me doesn't sound too bad to misunderstand its meaning,
   esp.when it's used as an argument to the printf() functions.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-19 21:07           ` Andy Shevchenko
  0 siblings, 0 replies; 160+ messages in thread
From: Andy Shevchenko @ 2022-01-19 21:07 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Leo Li, intel-gfx,
	Raju Rangoju, Jani Nikula, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, Sakari Ailus, netdev,
	Alex Deucher, Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 12:53:43PM -0800, Lucas De Marchi wrote:
> On Wed, Jan 19, 2022 at 05:15:02PM +0100, Daniel Vetter wrote:
> > On Wed, Jan 19, 2022 at 04:16:12PM +0200, Jani Nikula wrote:

...

> > Yeah we can sed this anytime later we want to, but we need to get the foot
> > in the door. There's also a pile more of these all over.
> > 
> > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > on the series, maybe it helps? And yes let's merge this through drm-misc.
> 
> Ok, it seems we are reaching some agreement here then:

> - Change it to use str_ prefix

Not sure about this (*), but have no strong argument against. Up to you.
Ah, yes, Jani said about additional churn this change will make if goes
together with this series. Perhaps it can be done separately?

> - Wait -rc1 to avoid conflict
> - Merge through drm-misc

*) E.g. yesno() to me doesn't sound too bad to misunderstand its meaning,
   esp.when it's used as an argument to the printf() functions.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 19:22             ` [Nouveau] " Andy Shevchenko
                                 ` (2 preceding siblings ...)
  (?)
@ 2022-01-19 22:25               ` David Laight
  -1 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 22:25 UTC (permalink / raw)
  To: 'Andy Shevchenko'
  Cc: 'Steven Rostedt',
	Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Ben Skeggs, Christian König, Chris Wilson,
	Daniel Vetter, David Airlie, David S . Miller, Emma Anholt,
	Eryk Brol, Francis Laniel, Greg Kroah-Hartman, Harry Wentland,
	Jakub Kicinski, Jani Nikula, Joonas Lahtinen, Julia Lawall,
	Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sakari Ailus, Sergey Senozhatsky, Vishal Kulkarni

> > except '"no\0\0yes" + v * 4' works a bit better.
> 
> Is it a C code obfuscation contest?

That would be:
	return &(v * 3)["no\0yes"];

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 22:25               ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 22:25 UTC (permalink / raw)
  To: 'Andy Shevchenko'
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Jani Nikula, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

> > except '"no\0\0yes" + v * 4' works a bit better.
> 
> Is it a C code obfuscation contest?

That would be:
	return &(v * 3)["no\0yes"];

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 22:25               ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 22:25 UTC (permalink / raw)
  To: 'Andy Shevchenko'
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

> > except '"no\0\0yes" + v * 4' works a bit better.
> 
> Is it a C code obfuscation contest?

That would be:
	return &(v * 3)["no\0yes"];

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 22:25               ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 22:25 UTC (permalink / raw)
  To: 'Andy Shevchenko'
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

> > except '"no\0\0yes" + v * 4' works a bit better.
> 
> Is it a C code obfuscation contest?

That would be:
	return &(v * 3)["no\0yes"];

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-19 22:25               ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-19 22:25 UTC (permalink / raw)
  To: 'Andy Shevchenko'
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	'Steven Rostedt',
	Julia Lawall, Rahul Lakkireddy, Jani Nikula, Rodrigo Vivi,
	Mikita Lipski, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

> > except '"no\0\0yes" + v * 4' works a bit better.
> 
> Is it a C code obfuscation contest?

That would be:
	return &(v * 3)["no\0yes"];

:-)

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-19 14:16     ` [Nouveau] " Jani Nikula
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-20  8:38       ` Petr Mladek
  -1 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20  8:38 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, 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

On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
> >>    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 <prefix>_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:

now:

- contition ? "yes" : "no"
+ yesno(condition)

a few moths later:

- yesno(condition)
+ str_yes_no(condition)


Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  8:38       ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20  8:38 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Rodrigo Vivi, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
> >>    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 <prefix>_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:

now:

- contition ? "yes" : "no"
+ yesno(condition)

a few moths later:

- yesno(condition)
+ str_yes_no(condition)


Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  8:38       ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20  8:38 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
> >>    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 <prefix>_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:

now:

- contition ? "yes" : "no"
+ yesno(condition)

a few moths later:

- yesno(condition)
+ str_yes_no(condition)


Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  8:38       ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20  8:38 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
> >>    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 <prefix>_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:

now:

- contition ? "yes" : "no"
+ yesno(condition)

a few moths later:

- yesno(condition)
+ str_yes_no(condition)


Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  8:38       ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20  8:38 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
> >>    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 <prefix>_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:

now:

- contition ? "yes" : "no"
+ yesno(condition)

a few moths later:

- yesno(condition)
+ str_yes_no(condition)


Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-20  8:38       ` Petr Mladek
                           ` (2 preceding siblings ...)
  (?)
@ 2022-01-20  9:12         ` David Laight
  -1 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-20  9:12 UTC (permalink / raw)
  To: 'Petr Mladek', Jani Nikula
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, 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

...
> 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"

Indeed - you need to look the former up, wasting brain time.

> 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:
> 
> now:
> 
> - contition ? "yes" : "no"
> + yesno(condition)
> 
> a few moths later:
> 
> - yesno(condition)
> + str_yes_no(condition)

Followed by:
- str_yes_no(x)
+ no_yes_str(x)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-20  9:12 UTC (permalink / raw)
  To: 'Petr Mladek', Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

...
> 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"

Indeed - you need to look the former up, wasting brain time.

> 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:
> 
> now:
> 
> - contition ? "yes" : "no"
> + yesno(condition)
> 
> a few moths later:
> 
> - yesno(condition)
> + str_yes_no(condition)

Followed by:
- str_yes_no(x)
+ no_yes_str(x)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-20  9:12 UTC (permalink / raw)
  To: 'Petr Mladek', Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Rodrigo Vivi, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

...
> 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"

Indeed - you need to look the former up, wasting brain time.

> 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:
> 
> now:
> 
> - contition ? "yes" : "no"
> + yesno(condition)
> 
> a few moths later:
> 
> - yesno(condition)
> + str_yes_no(condition)

Followed by:
- str_yes_no(x)
+ no_yes_str(x)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-20  9:12 UTC (permalink / raw)
  To: 'Petr Mladek', Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

...
> 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"

Indeed - you need to look the former up, wasting brain time.

> 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:
> 
> now:
> 
> - contition ? "yes" : "no"
> + yesno(condition)
> 
> a few moths later:
> 
> - yesno(condition)
> + str_yes_no(condition)

Followed by:
- str_yes_no(x)
+ no_yes_str(x)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* RE: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` David Laight
  0 siblings, 0 replies; 160+ messages in thread
From: David Laight @ 2022-01-20  9:12 UTC (permalink / raw)
  To: 'Petr Mladek', Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

...
> 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"

Indeed - you need to look the former up, wasting brain time.

> 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:
> 
> now:
> 
> - contition ? "yes" : "no"
> + yesno(condition)
> 
> a few moths later:
> 
> - yesno(condition)
> + str_yes_no(condition)

Followed by:
- str_yes_no(x)
+ no_yes_str(x)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-20  8:38       ` Petr Mladek
                           ` (2 preceding siblings ...)
  (?)
@ 2022-01-20  9:12         ` Jani Nikula
  -1 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-20  9:12 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, 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

On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
>> >>    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 <prefix>_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

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-20  9:12 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
>> >>    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 <prefix>_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

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-20  9:12 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Rodrigo Vivi, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
>> >>    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 <prefix>_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

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-20  9:12 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
>> >>    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 <prefix>_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

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20  9:12         ` Jani Nikula
  0 siblings, 0 replies; 160+ messages in thread
From: Jani Nikula @ 2022-01-20  9:12 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> On Wed 2022-01-19 16:16:12, Jani Nikula wrote:
>> On Wed, 19 Jan 2022, Petr Mladek <pmladek@suse.com> 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  <someprefix>
>> >>    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 <prefix>_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

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
  2022-01-20  9:12         ` [Nouveau] " Jani Nikula
                             ` (2 preceding siblings ...)
  (?)
@ 2022-01-20 10:45           ` Petr Mladek
  -1 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20 10:45 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Lucas De Marchi, linux-kernel, intel-gfx, dri-devel, amd-gfx,
	linux-security-module, nouveau, netdev, Alex Deucher,
	Andrew Morton, Andy Shevchenko, Andy Shevchenko, Ben Skeggs,
	Christian König, 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

On Thu 2022-01-20 11:12:27, Jani Nikula wrote:
> On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > 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!

Huh, this sound alarming.

Cosmetic changes just complicate history. They make "git blame" useless.
They also complicate backports. I know that it is not problem for
mainline. But there are supported stable branches, ...

There should be a good reason for such changes. They should not be
done light-heartedly.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20 10:45           ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20 10:45 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju,
	Lucas De Marchi, Steven Rostedt, Julia Lawall, Rahul Lakkireddy,
	Rodrigo Vivi, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu 2022-01-20 11:12:27, Jani Nikula wrote:
> On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > 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!

Huh, this sound alarming.

Cosmetic changes just complicate history. They make "git blame" useless.
They also complicate backports. I know that it is not problem for
mainline. But there are supported stable branches, ...

There should be a good reason for such changes. They should not be
done light-heartedly.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20 10:45           ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20 10:45 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	Mikita Lipski, amd-gfx, Andy Shevchenko, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Sakari Ailus, Leo Li, intel-gfx,
	Raju Rangoju, Lucas De Marchi, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman,
	linux-kernel, Christian König, Sergey Senozhatsky,
	linux-security-module, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu 2022-01-20 11:12:27, Jani Nikula wrote:
> On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > 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!

Huh, this sound alarming.

Cosmetic changes just complicate history. They make "git blame" useless.
They also complicate backports. I know that it is not problem for
mainline. But there are supported stable branches, ...

There should be a good reason for such changes. They should not be
done light-heartedly.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20 10:45           ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20 10:45 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu 2022-01-20 11:12:27, Jani Nikula wrote:
> On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > 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!

Huh, this sound alarming.

Cosmetic changes just complicate history. They make "git blame" useless.
They also complicate backports. I know that it is not problem for
mainline. But there are supported stable branches, ...

There should be a good reason for such changes. They should not be
done light-heartedly.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 0/3] lib/string_helpers: Add a few string helpers
@ 2022-01-20 10:45           ` Petr Mladek
  0 siblings, 0 replies; 160+ messages in thread
From: Petr Mladek @ 2022-01-20 10:45 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, Mikita Lipski, amd-gfx,
	Andy Shevchenko, Ben Skeggs, Jakub Kicinski, Harry Wentland,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Steven Rostedt, Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi,
	Andy Shevchenko, Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Thu 2022-01-20 11:12:27, Jani Nikula wrote:
> On Thu, 20 Jan 2022, Petr Mladek <pmladek@suse.com> wrote:
> > 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!

Huh, this sound alarming.

Cosmetic changes just complicate history. They make "git blame" useless.
They also complicate backports. I know that it is not problem for
mainline. But there are supported stable branches, ...

There should be a good reason for such changes. They should not be
done light-heartedly.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
  2022-01-19 21:00           ` [Nouveau] " Steven Rostedt
                               ` (2 preceding siblings ...)
  (?)
@ 2022-01-21  1:37             ` Joe Perches
  -1 siblings, 0 replies; 160+ messages in thread
From: Joe Perches @ 2022-01-21  1:37 UTC (permalink / raw)
  To: Steven Rostedt, Andy Shevchenko
  Cc: Sakari Ailus, Lucas De Marchi, linux-kernel, intel-gfx,
	dri-devel, amd-gfx, linux-security-module, nouveau, netdev,
	Alex Deucher, Andrew Morton, Ben Skeggs, Christian König,
	Chris Wilson, Daniel Vetter, David Airlie, David S . Miller,
	Emma Anholt, Eryk Brol, Francis Laniel, Greg Kroah-Hartman,
	Harry Wentland, Jakub Kicinski, Jani Nikula, Joonas Lahtinen,
	Julia Lawall, Kentaro Takeda, Leo Li, Mikita Lipski, Petr Mladek,
	Rahul Lakkireddy, Raju Rangoju, Rasmus Villemoes, Rodrigo Vivi,
	Sergey Senozhatsky, Vishal Kulkarni

On Wed, 2022-01-19 at 16:00 -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

checkpatch doesn't say anything normally, it's a stupid script.
It just mindlessly bleats a message when a line exceeds 100 chars...

Just fyi: I think it's nicer on a single line too.



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-21  1:37             ` Joe Perches
  0 siblings, 0 replies; 160+ messages in thread
From: Joe Perches @ 2022-01-21  1:37 UTC (permalink / raw)
  To: Steven Rostedt, Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, 2022-01-19 at 16:00 -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

checkpatch doesn't say anything normally, it's a stupid script.
It just mindlessly bleats a message when a line exceeds 100 chars...

Just fyi: I think it's nicer on a single line too.



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-21  1:37             ` Joe Perches
  0 siblings, 0 replies; 160+ messages in thread
From: Joe Perches @ 2022-01-21  1:37 UTC (permalink / raw)
  To: Steven Rostedt, Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 2022-01-19 at 16:00 -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

checkpatch doesn't say anything normally, it's a stupid script.
It just mindlessly bleats a message when a line exceeds 100 chars...

Just fyi: I think it's nicer on a single line too.



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-21  1:37             ` Joe Perches
  0 siblings, 0 replies; 160+ messages in thread
From: Joe Perches @ 2022-01-21  1:37 UTC (permalink / raw)
  To: Steven Rostedt, Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Harry Wentland, Petr Mladek,
	Sakari Ailus, Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi,
	Julia Lawall, Rahul Lakkireddy, Mikita Lipski, Eryk Brol,
	Greg Kroah-Hartman, linux-kernel, Christian König,
	Sergey Senozhatsky, linux-security-module, netdev, Alex Deucher,
	Andrew Morton, David S . Miller

On Wed, 2022-01-19 at 16:00 -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

checkpatch doesn't say anything normally, it's a stupid script.
It just mindlessly bleats a message when a line exceeds 100 chars...

Just fyi: I think it's nicer on a single line too.



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation
@ 2022-01-21  1:37             ` Joe Perches
  0 siblings, 0 replies; 160+ messages in thread
From: Joe Perches @ 2022-01-21  1:37 UTC (permalink / raw)
  To: Steven Rostedt, Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Joonas Lahtinen,
	Rasmus Villemoes, dri-devel, Chris Wilson, Vishal Kulkarni,
	Francis Laniel, Kentaro Takeda, amd-gfx, Ben Skeggs,
	Jakub Kicinski, Harry Wentland, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Lucas De Marchi, Jani Nikula,
	Julia Lawall, Rahul Lakkireddy, Rodrigo Vivi, Mikita Lipski,
	Eryk Brol, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	Daniel Vetter, netdev, Alex Deucher, Andrew Morton,
	David S . Miller

On Wed, 2022-01-19 at 16:00 -0500, Steven Rostedt wrote:
> On Wed, 19 Jan 2022 21:25:08 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > > I say keep it one line!
> > > 
> > > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>  
> > 
> > I believe Sakari strongly follows the 80 rule, which means...
> 
> Checkpatch says "100" I think we need to simply update the docs (the
> documentation always lags the code ;-)

checkpatch doesn't say anything normally, it's a stupid script.
It just mindlessly bleats a message when a line exceeds 100 chars...

Just fyi: I think it's nicer on a single line too.



^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 3/3] drm: Convert open yes/no strings to yesno()
  2022-01-19 19:30     ` [Nouveau] " Andy Shevchenko
  (?)
  (?)
@ 2022-01-26  9:05       ` Lucas De Marchi
  -1 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-26  9:05 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, Francis Laniel, Kentaro Takeda,
	amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek, Sakari Ailus,
	Leo Li, intel-gfx, Raju Rangoju, Julia Lawall, Rahul Lakkireddy,
	Steven Rostedt, Rodrigo Vivi, Greg Kroah-Hartman, linux-kernel,
	Christian König, Sergey Senozhatsky, linux-security-module,
	netdev, Alex Deucher, Andrew Morton, David S . Miller

On Wed, Jan 19, 2022 at 09:30:47PM +0200, Andy Shevchenko wrote:
>On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
>> linux/string_helpers.h provides a helper to return "yes"/"no"
>> strings. Replace the open coded versions with yesno(). The places were
>> identified with the following semantic patch:
>>
>> 	@@
>> 	expression b;
>> 	@@
>>
>> 	- b ? "yes" : "no"
>> 	+ yesno(b)
>>
>> Then the includes were added, so we include-what-we-use, and parenthesis
>> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
>> still see the same binary sizes:
>>
>>    text    data     bss     dec     hex filename
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old
>
>...
>
>>  #include <linux/module.h>
>>  #include <linux/sched.h>
>>  #include <linux/slab.h>
>> +#include <linux/string_helpers.h>
>
>+ blank line?
>
>> +#include <linux/string_helpers.h>
>
>...
>
>>  	seq_printf(m, "\tDP branch device present: %s\n",
>> -		   branch_device ? "yes" : "no");
>> +		   yesno(branch_device));
>
>Now it's possible to keep this on one line.
>
>...
>
>>  	drm_printf_indent(p, indent, "imported=%s\n",
>> -			  obj->import_attach ? "yes" : "no");
>> +			  yesno(obj->import_attach));
>
>81 here, but anyway, ditto!
>
>...
>
>>   */
>
>+blank line here?
>
>> +#include <linux/string_helpers.h>
>> +
>>  #include "aux.h"
>>  #include "pad.h"
>
>...
>
>>  	seq_printf(m, "MMU:        %s\n",
>> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
>> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>>  	seq_printf(m, "TFU:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>>  	seq_printf(m, "TSY:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>>  	seq_printf(m, "MSO:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>>  	seq_printf(m, "L3C:        %s (%dkb)\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
>
>I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
>but I believe in these cases it's very much okay).

now that we are converting to str_yes_no(), we will have a few more
chars. Some maintainers may be more strict on the 80 or 100 chars. I
will assume whatever is in the code base is the preferred form.

thanks
Lucas De Marchi

>
>-- 
>With Best Regards,
>Andy Shevchenko
>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-26  9:05       ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-26  9:05 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Leo Li, intel-gfx, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Greg Kroah-Hartman, linux-kernel,
	David S . Miller, Sergey Senozhatsky, linux-security-module,
	Sakari Ailus, Raju Rangoju, Alex Deucher, Andrew Morton,
	Christian König

On Wed, Jan 19, 2022 at 09:30:47PM +0200, Andy Shevchenko wrote:
>On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
>> linux/string_helpers.h provides a helper to return "yes"/"no"
>> strings. Replace the open coded versions with yesno(). The places were
>> identified with the following semantic patch:
>>
>> 	@@
>> 	expression b;
>> 	@@
>>
>> 	- b ? "yes" : "no"
>> 	+ yesno(b)
>>
>> Then the includes were added, so we include-what-we-use, and parenthesis
>> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
>> still see the same binary sizes:
>>
>>    text    data     bss     dec     hex filename
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old
>
>...
>
>>  #include <linux/module.h>
>>  #include <linux/sched.h>
>>  #include <linux/slab.h>
>> +#include <linux/string_helpers.h>
>
>+ blank line?
>
>> +#include <linux/string_helpers.h>
>
>...
>
>>  	seq_printf(m, "\tDP branch device present: %s\n",
>> -		   branch_device ? "yes" : "no");
>> +		   yesno(branch_device));
>
>Now it's possible to keep this on one line.
>
>...
>
>>  	drm_printf_indent(p, indent, "imported=%s\n",
>> -			  obj->import_attach ? "yes" : "no");
>> +			  yesno(obj->import_attach));
>
>81 here, but anyway, ditto!
>
>...
>
>>   */
>
>+blank line here?
>
>> +#include <linux/string_helpers.h>
>> +
>>  #include "aux.h"
>>  #include "pad.h"
>
>...
>
>>  	seq_printf(m, "MMU:        %s\n",
>> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
>> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>>  	seq_printf(m, "TFU:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>>  	seq_printf(m, "TSY:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>>  	seq_printf(m, "MSO:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>>  	seq_printf(m, "L3C:        %s (%dkb)\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
>
>I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
>but I believe in these cases it's very much okay).

now that we are converting to str_yes_no(), we will have a few more
chars. Some maintainers may be more strict on the 80 or 100 chars. I
will assume whatever is in the code base is the preferred form.

thanks
Lucas De Marchi

>
>-- 
>With Best Regards,
>Andy Shevchenko
>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Intel-gfx] [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-26  9:05       ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-26  9:05 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Leo Li, intel-gfx, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Greg Kroah-Hartman, linux-kernel,
	David S . Miller, Sergey Senozhatsky, linux-security-module,
	Sakari Ailus, Raju Rangoju, Alex Deucher, Andrew Morton,
	Christian König

On Wed, Jan 19, 2022 at 09:30:47PM +0200, Andy Shevchenko wrote:
>On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
>> linux/string_helpers.h provides a helper to return "yes"/"no"
>> strings. Replace the open coded versions with yesno(). The places were
>> identified with the following semantic patch:
>>
>> 	@@
>> 	expression b;
>> 	@@
>>
>> 	- b ? "yes" : "no"
>> 	+ yesno(b)
>>
>> Then the includes were added, so we include-what-we-use, and parenthesis
>> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
>> still see the same binary sizes:
>>
>>    text    data     bss     dec     hex filename
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old
>
>...
>
>>  #include <linux/module.h>
>>  #include <linux/sched.h>
>>  #include <linux/slab.h>
>> +#include <linux/string_helpers.h>
>
>+ blank line?
>
>> +#include <linux/string_helpers.h>
>
>...
>
>>  	seq_printf(m, "\tDP branch device present: %s\n",
>> -		   branch_device ? "yes" : "no");
>> +		   yesno(branch_device));
>
>Now it's possible to keep this on one line.
>
>...
>
>>  	drm_printf_indent(p, indent, "imported=%s\n",
>> -			  obj->import_attach ? "yes" : "no");
>> +			  yesno(obj->import_attach));
>
>81 here, but anyway, ditto!
>
>...
>
>>   */
>
>+blank line here?
>
>> +#include <linux/string_helpers.h>
>> +
>>  #include "aux.h"
>>  #include "pad.h"
>
>...
>
>>  	seq_printf(m, "MMU:        %s\n",
>> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
>> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>>  	seq_printf(m, "TFU:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>>  	seq_printf(m, "TSY:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>>  	seq_printf(m, "MSO:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>>  	seq_printf(m, "L3C:        %s (%dkb)\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
>
>I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
>but I believe in these cases it's very much okay).

now that we are converting to str_yes_no(), we will have a few more
chars. Some maintainers may be more strict on the 80 or 100 chars. I
will assume whatever is in the code base is the preferred form.

thanks
Lucas De Marchi

>
>-- 
>With Best Regards,
>Andy Shevchenko
>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

* Re: [Nouveau] [PATCH 3/3] drm: Convert open yes/no strings to yesno()
@ 2022-01-26  9:05       ` Lucas De Marchi
  0 siblings, 0 replies; 160+ messages in thread
From: Lucas De Marchi @ 2022-01-26  9:05 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Emma Anholt, David Airlie, nouveau, Rasmus Villemoes, dri-devel,
	Chris Wilson, Vishal Kulkarni, netdev, Francis Laniel,
	Kentaro Takeda, amd-gfx, Ben Skeggs, Jakub Kicinski, Petr Mladek,
	Leo Li, intel-gfx, Steven Rostedt, Julia Lawall,
	Rahul Lakkireddy, Rodrigo Vivi, Greg Kroah-Hartman, linux-kernel,
	David S . Miller, Sergey Senozhatsky, linux-security-module,
	Sakari Ailus, Raju Rangoju, Alex Deucher, Andrew Morton,
	Christian König

On Wed, Jan 19, 2022 at 09:30:47PM +0200, Andy Shevchenko wrote:
>On Tue, Jan 18, 2022 at 11:24:50PM -0800, Lucas De Marchi wrote:
>> linux/string_helpers.h provides a helper to return "yes"/"no"
>> strings. Replace the open coded versions with yesno(). The places were
>> identified with the following semantic patch:
>>
>> 	@@
>> 	expression b;
>> 	@@
>>
>> 	- b ? "yes" : "no"
>> 	+ yesno(b)
>>
>> Then the includes were added, so we include-what-we-use, and parenthesis
>> adjusted in drivers/gpu/drm/v3d/v3d_debugfs.c. After the conversion we
>> still see the same binary sizes:
>>
>>    text    data     bss     dec     hex filename
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko
>> 1442171   60344     800 1503315  16f053 ./drivers/gpu/drm/radeon/radeon.ko.old
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko
>> 5985991  324439   33808 6344238  60ce2e ./drivers/gpu/drm/amd/amdgpu/amdgpu.ko.old
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko
>>  411986   10490    6176  428652   68a6c ./drivers/gpu/drm/drm.ko.old
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko
>> 1970292  109515    2352 2082159  1fc56f ./drivers/gpu/drm/nouveau/nouveau.ko.old
>
>...
>
>>  #include <linux/module.h>
>>  #include <linux/sched.h>
>>  #include <linux/slab.h>
>> +#include <linux/string_helpers.h>
>
>+ blank line?
>
>> +#include <linux/string_helpers.h>
>
>...
>
>>  	seq_printf(m, "\tDP branch device present: %s\n",
>> -		   branch_device ? "yes" : "no");
>> +		   yesno(branch_device));
>
>Now it's possible to keep this on one line.
>
>...
>
>>  	drm_printf_indent(p, indent, "imported=%s\n",
>> -			  obj->import_attach ? "yes" : "no");
>> +			  yesno(obj->import_attach));
>
>81 here, but anyway, ditto!
>
>...
>
>>   */
>
>+blank line here?
>
>> +#include <linux/string_helpers.h>
>> +
>>  #include "aux.h"
>>  #include "pad.h"
>
>...
>
>>  	seq_printf(m, "MMU:        %s\n",
>> -		   (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
>> +		   yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
>>  	seq_printf(m, "TFU:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
>>  	seq_printf(m, "TSY:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
>>  	seq_printf(m, "MSO:        %s\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
>>  	seq_printf(m, "L3C:        %s (%dkb)\n",
>> -		   (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
>> +		   yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
>>  		   V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
>
>I believe it's fine to join back to have less LOCs (yes, it will be 83 or so,
>but I believe in these cases it's very much okay).

now that we are converting to str_yes_no(), we will have a few more
chars. Some maintainers may be more strict on the 80 or 100 chars. I
will assume whatever is in the code base is the preferred form.

thanks
Lucas De Marchi

>
>-- 
>With Best Regards,
>Andy Shevchenko
>
>

^ permalink raw reply	[flat|nested] 160+ messages in thread

end of thread, other threads:[~2022-01-26 18:21 UTC | newest]

Thread overview: 160+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  7:24 [PATCH 0/3] lib/string_helpers: Add a few string helpers Lucas De Marchi
2022-01-19  7:24 ` [Nouveau] " Lucas De Marchi
2022-01-19  7:24 ` Lucas De Marchi
2022-01-19  7:24 ` [Intel-gfx] " Lucas De Marchi
2022-01-19  7:24 ` Lucas De Marchi
2022-01-19  7:24 ` [PATCH 1/3] lib/string_helpers: Consolidate yesno() implementation Lucas De Marchi
2022-01-19  7:24   ` [Nouveau] " Lucas De Marchi
2022-01-19  7:24   ` Lucas De Marchi
2022-01-19  7:24   ` [Intel-gfx] " Lucas De Marchi
2022-01-19  7:24   ` Lucas De Marchi
2022-01-19  9:15   ` [Nouveau] " Andy Shevchenko
2022-01-19  9:15     ` Andy Shevchenko
2022-01-19  9:15     ` [Intel-gfx] " Andy Shevchenko
2022-01-19  9:15     ` Andy Shevchenko
2022-01-19 15:01     ` Steven Rostedt
2022-01-19 15:01       ` Steven Rostedt
2022-01-19 15:01       ` [Intel-gfx] " Steven Rostedt
2022-01-19 15:01       ` Steven Rostedt
2022-01-19 15:01       ` [Nouveau] " Steven Rostedt
2022-01-19 16:37       ` David Laight
2022-01-19 16:37         ` David Laight
2022-01-19 16:37         ` [Intel-gfx] " David Laight
2022-01-19 16:37         ` David Laight
2022-01-19 16:37         ` [Nouveau] " David Laight
2022-01-19 16:38         ` David Laight
2022-01-19 16:38           ` [Nouveau] " David Laight
2022-01-19 16:38           ` David Laight
2022-01-19 16:38           ` [Intel-gfx] " David Laight
2022-01-19 16:38           ` David Laight
2022-01-19 19:22           ` Andy Shevchenko
2022-01-19 19:22             ` Andy Shevchenko
2022-01-19 19:22             ` [Intel-gfx] " Andy Shevchenko
2022-01-19 19:22             ` Andy Shevchenko
2022-01-19 19:22             ` [Nouveau] " Andy Shevchenko
2022-01-19 20:58             ` Steven Rostedt
2022-01-19 20:58               ` Steven Rostedt
2022-01-19 20:58               ` [Intel-gfx] " Steven Rostedt
2022-01-19 20:58               ` Steven Rostedt
2022-01-19 20:58               ` [Nouveau] " Steven Rostedt
2022-01-19 22:25             ` David Laight
2022-01-19 22:25               ` David Laight
2022-01-19 22:25               ` [Intel-gfx] " David Laight
2022-01-19 22:25               ` David Laight
2022-01-19 22:25               ` [Nouveau] " David Laight
2022-01-19  9:18   ` Sakari Ailus
2022-01-19  9:18     ` [Nouveau] " Sakari Ailus
2022-01-19  9:18     ` Sakari Ailus
2022-01-19  9:18     ` [Intel-gfx] " Sakari Ailus
2022-01-19  9:18     ` Sakari Ailus
2022-01-19 15:06     ` Steven Rostedt
2022-01-19 15:06       ` Steven Rostedt
2022-01-19 15:06       ` [Intel-gfx] " Steven Rostedt
2022-01-19 15:06       ` Steven Rostedt
2022-01-19 15:06       ` [Nouveau] " Steven Rostedt
2022-01-19 19:25       ` Andy Shevchenko
2022-01-19 19:25         ` Andy Shevchenko
2022-01-19 19:25         ` Andy Shevchenko
2022-01-19 19:25         ` [Intel-gfx] " Andy Shevchenko
2022-01-19 19:25         ` Andy Shevchenko
2022-01-19 21:00         ` Steven Rostedt
2022-01-19 21:00           ` Steven Rostedt
2022-01-19 21:00           ` [Intel-gfx] " Steven Rostedt
2022-01-19 21:00           ` Steven Rostedt
2022-01-19 21:00           ` [Nouveau] " Steven Rostedt
2022-01-19 21:04           ` Andy Shevchenko
2022-01-19 21:04             ` Andy Shevchenko
2022-01-19 21:04             ` [Intel-gfx] " Andy Shevchenko
2022-01-19 21:04             ` Andy Shevchenko
2022-01-19 21:04             ` [Nouveau] " Andy Shevchenko
2022-01-21  1:37           ` Joe Perches
2022-01-21  1:37             ` Joe Perches
2022-01-21  1:37             ` [Intel-gfx] " Joe Perches
2022-01-21  1:37             ` [Nouveau] " Joe Perches
2022-01-21  1:37             ` Joe Perches
2022-01-19 20:43       ` [Intel-gfx] " Lucas De Marchi
2022-01-19 20:43         ` [Nouveau] " Lucas De Marchi
2022-01-19 20:43         ` Lucas De Marchi
2022-01-19 20:43         ` Lucas De Marchi
2022-01-19  7:24 ` [PATCH 2/3] lib/string_helpers: Add helpers for enable[d]/disable[d] Lucas De Marchi
2022-01-19  7:24   ` [Nouveau] " Lucas De Marchi
2022-01-19  7:24   ` Lucas De Marchi
2022-01-19  7:24   ` [Intel-gfx] " Lucas De Marchi
2022-01-19  7:24   ` Lucas De Marchi
2022-01-19  9:20   ` [Nouveau] " Andy Shevchenko
2022-01-19  9:20     ` Andy Shevchenko
2022-01-19  9:20     ` [Intel-gfx] " Andy Shevchenko
2022-01-19  9:20     ` Andy Shevchenko
2022-01-19  9:42     ` Lucas De Marchi
2022-01-19  9:42       ` [Nouveau] " Lucas De Marchi
2022-01-19  9:42       ` [Intel-gfx] " Lucas De Marchi
2022-01-19  9:42       ` Lucas De Marchi
2022-01-19  7:24 ` [PATCH 3/3] drm: Convert open yes/no strings to yesno() Lucas De Marchi
2022-01-19  7:24   ` [Nouveau] " Lucas De Marchi
2022-01-19  7:24   ` Lucas De Marchi
2022-01-19  7:24   ` [Intel-gfx] " Lucas De Marchi
2022-01-19  7:24   ` Lucas De Marchi
2022-01-19 19:30   ` Andy Shevchenko
2022-01-19 19:30     ` Andy Shevchenko
2022-01-19 19:30     ` [Intel-gfx] " Andy Shevchenko
2022-01-19 19:30     ` Andy Shevchenko
2022-01-19 19:30     ` [Nouveau] " Andy Shevchenko
2022-01-26  9:05     ` Lucas De Marchi
2022-01-26  9:05       ` [Nouveau] " Lucas De Marchi
2022-01-26  9:05       ` [Intel-gfx] " Lucas De Marchi
2022-01-26  9:05       ` Lucas De Marchi
2022-01-19  7:34 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for lib/string_helpers: Add a few string helpers Patchwork
2022-01-19  7:37 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-01-19  8:02 ` [Nouveau] [PATCH 0/3] " Jani Nikula
2022-01-19  8:02   ` Jani Nikula
2022-01-19  8:02   ` [Intel-gfx] " Jani Nikula
2022-01-19  8:02   ` Jani Nikula
2022-01-19  8:02   ` Jani Nikula
2022-01-19  8:05 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-01-19  9:28 ` [Nouveau] [PATCH 0/3] " Andy Shevchenko
2022-01-19  9:28   ` Andy Shevchenko
2022-01-19  9:28   ` [Intel-gfx] " Andy Shevchenko
2022-01-19  9:28   ` Andy Shevchenko
2022-01-19  9:39 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork
2022-01-19 13:18 ` [PATCH 0/3] " Petr Mladek
2022-01-19 13:18   ` [Nouveau] " Petr Mladek
2022-01-19 13:18   ` Petr Mladek
2022-01-19 13:18   ` [Intel-gfx] " Petr Mladek
2022-01-19 13:18   ` Petr Mladek
2022-01-19 14:16   ` Jani Nikula
2022-01-19 14:16     ` Jani Nikula
2022-01-19 14:16     ` [Intel-gfx] " Jani Nikula
2022-01-19 14:16     ` Jani Nikula
2022-01-19 14:16     ` [Nouveau] " Jani Nikula
2022-01-19 16:15     ` Daniel Vetter
2022-01-19 16:15       ` Daniel Vetter
2022-01-19 16:15       ` [Intel-gfx] " Daniel Vetter
2022-01-19 16:15       ` Daniel Vetter
2022-01-19 16:15       ` [Nouveau] " Daniel Vetter
2022-01-19 20:53       ` [Intel-gfx] " Lucas De Marchi
2022-01-19 20:53         ` [Nouveau] " Lucas De Marchi
2022-01-19 21:07         ` Andy Shevchenko
2022-01-19 21:07           ` Andy Shevchenko
2022-01-19 21:07           ` Andy Shevchenko
2022-01-19 21:07           ` Andy Shevchenko
2022-01-19 21:07           ` [Nouveau] " Andy Shevchenko
2022-01-20  8:38     ` Petr Mladek
2022-01-20  8:38       ` [Nouveau] " Petr Mladek
2022-01-20  8:38       ` Petr Mladek
2022-01-20  8:38       ` [Intel-gfx] " Petr Mladek
2022-01-20  8:38       ` Petr Mladek
2022-01-20  9:12       ` David Laight
2022-01-20  9:12         ` David Laight
2022-01-20  9:12         ` [Intel-gfx] " David Laight
2022-01-20  9:12         ` David Laight
2022-01-20  9:12         ` [Nouveau] " David Laight
2022-01-20  9:12       ` Jani Nikula
2022-01-20  9:12         ` Jani Nikula
2022-01-20  9:12         ` [Intel-gfx] " Jani Nikula
2022-01-20  9:12         ` Jani Nikula
2022-01-20  9:12         ` [Nouveau] " Jani Nikula
2022-01-20 10:45         ` Petr Mladek
2022-01-20 10:45           ` Petr Mladek
2022-01-20 10:45           ` [Nouveau] " Petr Mladek
2022-01-20 10:45           ` [Intel-gfx] " Petr Mladek
2022-01-20 10:45           ` Petr Mladek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.