lib/string_helpers: Add a few string helpers
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest11 patches 12 repliesIn review
- v13 patches 29 repliesSuperseded
Changes in v2 from the cover letter
- Use str_ prefix and separate other words with underscore: it's a little bit longer, but should improve readability
- Patches we re-split due to the rename: first patch adds all the new functions, then additional patches try to do one conversion at a time. While doing so, there were some fixes for issues already present along the way
- Style suggestions from v1 were adopted
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/11 | lib/string_helpers: Consolidate string helpers implementationinclude/ | +20 | 0 replies | |
| 2/11 | drm/i915: Fix trailing semicolondrivers/ | +1 | 1 reply | |
| 3/11 | drm/i915: Use str_yes_no()drivers/ drivers/ drivers/ +28 more | +203 | 1 reply | |
| 4/11 | drm/i915: Use str_enable_disable()drivers/ drivers/ drivers/ +3 more | +15 | 1 reply | |
| 5/11 | drm/i915: Use str_enabled_disabled()drivers/ drivers/ drivers/ +11 more | +33 | 1 reply | |
| 6/11 | drm/i915: Use str_on_off()drivers/ drivers/ drivers/ +7 more | +29 | 1 reply | |
| 7/11 | drm/amd/display: Use str_yes_no()drivers/ | +5 | 1 reply | |
| 8/11 | drm/gem: Sort includes alphabeticallydrivers/ | +10 | 1 reply | |
| 9/11 | drm: Convert open-coded yes/no strings to yesno()drivers/ drivers/ drivers/ +5 more | +24 | 4 replies | |
| 10/11 | tomoyo: Use str_yes_no()security/ security/ security/ | +6 | 0 replies | |
| 11/11 | cxgb4: Use str_yes_no()drivers/ | +137 | 0 replies |
Reviews trailers per patch
10 of 11 patches have a Reviewed-by or Acked-by.
| Patch | Andy Shevchenko | Jani Nikula | Daniel Vetter | Sakari Ailus | Harry Wentland | Matt Roper |
|---|---|---|---|---|---|---|
| 1/11 | R-b | A-b | A-b | |||
| 2/11 | R-b | |||||
| 3/11 | A-b | A-b | R-b | |||
| 4/11 | A-b | A-b | R-b | |||
| 5/11 | A-b | A-b | R-b | |||
| 6/11 | A-b | A-b | R-b | |||
| 7/11 | R-b | |||||
| 8/11 | R-b | |||||
| 9/11 | R-b | |||||
| 10/11 | R-b | |||||
| 11/11 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.
Cover letter [PATCH v2 00/11] lib/string_helpers: Add a few string helpers
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/[email protected]/
2) https://lore.kernel.org/all/[email protected]/#t
Now there is also the v1 of this same patch series:
https://lore.kernel.org/all/[email protected]/
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 was 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 [email protected] 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. However as pointed out in v1 of this patchseries, onoff(), yesno(), enabledisable(), enableddisabled() have some
issues: the last 2 are hard to read and for the first 2 it would not be hard to have the symbol to clash with variable names. From comments in v1, most people were in favor (or at least not opposed) to using str_on_off(), str_yes_no(), str_enable_disable() and str_enabled_disabled().
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. One alternative to all of this suggested by Christian König
([email protected]) 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 (or new renamed version) is easier to remember and use than e.g. %py[DOY]
Changes in v2:
- Use str_ prefix and separate other words with underscore: it's a little bit longer, but should improve readability
- Patches we re-split due to the rename: first patch adds all the new functions, then additional patches try to do one conversion at a time. While doing so, there were some fixes for issues already present along the way
- Style suggestions from v1 were adopted
In v1 it was suggested to apply this in drm-misc. I will leave this to maintainers to decide: maybe it would be simpler to merge the first patches on drm-intel-next, wait for the back merge and merge the rest through drm-misc - my fear is a big conflict with other work going in drm-intel-next since the bulk of the rename is there.
I tried to figure out acks and reviews from v1 and apply them to how the patches are now split.
thanks
Lucas De Marchi
Lucas De Marchi (11):
lib/string_helpers: Consolidate string helpers implementation drm/i915: Fix trailing semicolon
drm/i915: Use str_yes_no()
drm/i915: Use str_enable_disable()
drm/i915: Use str_enabled_disabled()
drm/i915: Use str_on_off()
drm/amd/display: Use str_yes_no()
drm/gem: Sort includes alphabetically
drm: Convert open-coded yes/no strings to yesno()
tomoyo: Use str_yes_no()
cxgb4: Use str_yes_no()
drivers/gpu/drm/amd/amdgpu/atom.c | 4 +- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 14 +- drivers/gpu/drm/dp/drm_dp.c | 3 +- drivers/gpu/drm/drm_client_modeset.c | 3 +- drivers/gpu/drm/drm_gem.c | 23 +- drivers/gpu/drm/i915/display/g4x_dp.c | 6 +- .../gpu/drm/i915/display/intel_backlight.c | 3 +- drivers/gpu/drm/i915/display/intel_ddi.c | 4 +- drivers/gpu/drm/i915/display/intel_display.c | 46 ++-- .../drm/i915/display/intel_display_debugfs.c | 74 +++--- .../drm/i915/display/intel_display_power.c | 4 +- .../drm/i915/display/intel_display_trace.h | 9 +- drivers/gpu/drm/i915/display/intel_dp.c | 20 +- drivers/gpu/drm/i915/display/intel_dpll.c | 3 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 7 +- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 7 +- drivers/gpu/drm/i915/display/intel_fbc.c | 4 +- drivers/gpu/drm/i915/display/intel_fdi.c | 8 +- drivers/gpu/drm/i915/display/intel_hdmi.c | 3 +- drivers/gpu/drm/i915/display/intel_sprite.c | 6 +- drivers/gpu/drm/i915/display/vlv_dsi_pll.c | 3 +- .../gpu/drm/i915/gem/selftests/huge_pages.c | 9 +- .../drm/i915/gem/selftests/i915_gem_context.c | 7 +- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 3 +- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 11 +- .../drm/i915/gt/intel_execlists_submission.c | 7 +- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 3 +- drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 52 ++-- drivers/gpu/drm/i915/gt/intel_rc6.c | 5 +- drivers/gpu/drm/i915/gt/intel_reset.c | 3 +- drivers/gpu/drm/i915/gt/intel_rps.c | 13 +- drivers/gpu/drm/i915/gt/intel_sseu.c | 9 +- drivers/gpu/drm/i915/gt/intel_sseu_debugfs.c | 10 +- drivers/gpu/drm/i915/gt/selftest_timeline.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 5 +- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 5 +- drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 6 +- drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 14 +- drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c | 20 +- drivers/gpu/drm/i915/i915_debugfs.c | 17 +- drivers/gpu/drm/i915/i915_driver.c | 4 +- drivers/gpu/drm/i915/i915_gpu_error.c | 9 +- drivers/gpu/drm/i915/i915_params.c | 5 +- drivers/gpu/drm/i915/i915_utils.h | 21 +- drivers/gpu/drm/i915/intel_device_info.c | 8 +- drivers/gpu/drm/i915/intel_dram.c | 10 +- drivers/gpu/drm/i915/intel_pm.c | 14 +- drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c | 4 +- drivers/gpu/drm/i915/selftests/i915_active.c | 3 +- drivers/gpu/drm/i915/vlv_suspend.c | 3 +- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c | 5 +- drivers/gpu/drm/radeon/atom.c | 3 +- drivers/gpu/drm/v3d/v3d_debugfs.c | 11 +- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 4 +- .../ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 249 ++++++++++-------- include/linux/string_helpers.h | 20 ++ security/tomoyo/audit.c | 2 +- security/tomoyo/common.c | 19 +- security/tomoyo/common.h | 1 - 60 files changed, 482 insertions(+), 373 deletions(-)
Signature · 1 line
2.34.1