All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/23] firmware: cleanup for v4.16
@ 2017-11-20 18:23 Luis R. Rodriguez
  2017-11-20 18:23 ` [PATCH v2 01/23] firmware: rename struct firmware_priv to struct fw_sysfs Luis R. Rodriguez
                   ` (22 more replies)
  0 siblings, 23 replies; 35+ messages in thread
From: Luis R. Rodriguez @ 2017-11-20 18:23 UTC (permalink / raw)
  To: gregkh
  Cc: akpm, keescook, mfuzzey, zohar, dhowells, pali.rohar, tiwai,
	arend.vanspriel, zajec5, nbroeking, markivx, stephen.boyd,
	broonie, dmitry.torokhov, dwmw2, torvalds, Abhay_Salunke,
	bjorn.andersson, jewalt, linux-kernel, linux-fsdevel,
	Luis R. Rodriguez

Here's a series of cleanups for the firmware loader for consideration for
v4.16, *after* the traditional yearly American turkey massacre. This
depends on the few fixes I just posted for consideration for v4.15 [0].

While discussing the cleanup patch I posted last for the firmware API [1],
Greg suggested making the new data structure we use an opaque pointer so
we can avoid modifying so many call sites needing the new parameter. This
was a good suggestion, but we already have our own private opaque data
structure, it was just used for storing a few variables. We also have
our own fw_priv data structure, its however a complete misnomer given
it actually is only used now for the old sysfs firmware loading facility.

The naming mishap happened given the sysfs loader was the default loader back
in the hay day. This is no longer the case, we always directly load firmware
from the filesystem first, and only rely on the sysfs loader mechanism as
a fallback, if its enabled.

So we rename the old fw_priv to reflect its for sysfs only, and re-use the name
now for our existing opaque private data structure, which we'll extend for the
original proposed cleanup.

IMHO this ends up tidying up the code even more and makes the code *much*
easier to read.

While doing this work I also realized how with a small amount of work we
could end up testing the 3 different functional kernel builds possible for
the firmware loader with *one* kernel build with a few debugfs knobs. This
adds this as well and also paves the way to enable us to later split the
sysfs firmware loader onto its own file.

Worth discussing is how the debugfs knobs also reveal how two kernel build
configs could potentially just later end up as module params, if we're happy
to to live with implicating the fallback mechanism always when the firmware
loader is enabled. This would simplfy the kernel build considerably. I'm not
aware of anyone disabling the syfs fallback mechanism completely, given its
only a fallback mechanism now and we have a way to avoid it completely as
well for sync calls, so this very well may be worth a direction worth
evaluating forward

0-day has been happy with this. I've also hammered testing the API on the 3
different kernel builds possible, no regressions were found, and also addressed
ensuring that the selftests still works on older kernels as expected. On older
kernels we run the typical test of two scripts as usual, using whatever
whatever defaults your kernel provides and doing our best with that.

Comments and questions are, as always, welcome. 

[0] https://lkml.kernel.org/r/20171120174535.27000-1-mcgrof@kernel.org
[1] https://lkml.kernel.org/r/20170914225422.31034-1-mcgrof@kernel.org

Luis R. Rodriguez (23):
  firmware: rename struct firmware_priv to struct fw_sysfs
  firmware: rename struct firmware_buf to struct fw_priv
  firmware: rename struct fw_priv->fw_id to fw_name
  firmware: move core data structures to the top of file
  firmware: remove duplicate fw_state_aborted()
  firmware: remove unused __fw_state_is_done()
  firmware: use static inlines for state machine checking
  firmware: rename sysfs state checks with sysfs prefix
  firmware: use static inline for to_fw_priv()
  firmware: add helper to copy built-in data to pre-alloc buffer
  firmware: provide helper for FW_OPT_USERHELPER
  firmware: replace #ifdef over FW_OPT_FALLBACK with function checks
  test_firmware: wrap sysfs timeout test into helper
  test_firmware: wrap basic sysfs fallback tests into helper
  test_firmware: wrap custom sysfs load tests into helper
  test_firmware: enable custom fallback testing on limited kernel
    configs
  test_firmware: replace syfs fallback check with kconfig_has helper
  firmware: enable to split firmware_class into separate target files
  firmware: add debug facility to emulate forcing sysfs fallback
  firmware: add debug facility to emulate disabling sysfs fallback
  test_firmware: add a library for shared helpers
  test_firmware: test the 3 firmware kernel configs using debugfs
  firmware: cleanup - group and document up private firmware parameters

 drivers/base/Kconfig                               |   6 +
 drivers/base/Makefile                              |   2 +
 drivers/base/firmware_debug.c                      |  39 +
 drivers/base/firmware_debug.h                      |  58 ++
 .../base/{firmware_class.c => firmware_loader.c}   | 981 +++++++++++++--------
 tools/testing/selftests/firmware/Makefile          |   2 +-
 tools/testing/selftests/firmware/config            |   5 +
 tools/testing/selftests/firmware/fw_fallback.sh    | 207 +++--
 tools/testing/selftests/firmware/fw_filesystem.sh  |  61 +-
 tools/testing/selftests/firmware/fw_lib.sh         | 174 ++++
 tools/testing/selftests/firmware/fw_run_tests.sh   |  67 ++
 11 files changed, 1064 insertions(+), 538 deletions(-)
 create mode 100644 drivers/base/firmware_debug.c
 create mode 100644 drivers/base/firmware_debug.h
 rename drivers/base/{firmware_class.c => firmware_loader.c} (64%)
 create mode 100755 tools/testing/selftests/firmware/fw_lib.sh
 create mode 100755 tools/testing/selftests/firmware/fw_run_tests.sh

-- 
2.15.0

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

end of thread, other threads:[~2017-11-30 23:54 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-20 18:23 [PATCH v2 00/23] firmware: cleanup for v4.16 Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 01/23] firmware: rename struct firmware_priv to struct fw_sysfs Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 02/23] firmware: rename struct firmware_buf to struct fw_priv Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 03/23] firmware: rename struct fw_priv->fw_id to fw_name Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 04/23] firmware: move core data structures to the top of file Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 05/23] firmware: remove duplicate fw_state_aborted() Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 06/23] firmware: remove unused __fw_state_is_done() Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 07/23] firmware: use static inlines for state machine checking Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 08/23] firmware: rename sysfs state checks with sysfs prefix Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 09/23] firmware: use static inline for to_fw_priv() Luis R. Rodriguez
2017-11-29 10:14   ` Greg KH
2017-11-20 18:23 ` [PATCH v2 10/23] firmware: add helper to copy built-in data to pre-alloc buffer Luis R. Rodriguez
2017-11-29 10:17   ` Greg KH
2017-11-30 20:18     ` Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 11/23] firmware: provide helper for FW_OPT_USERHELPER Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 12/23] firmware: replace #ifdef over FW_OPT_FALLBACK with function checks Luis R. Rodriguez
2017-11-20 18:23 ` [PATCH v2 13/23] test_firmware: wrap sysfs timeout test into helper Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 14/23] test_firmware: wrap basic sysfs fallback tests " Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 15/23] test_firmware: wrap custom sysfs load " Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 16/23] test_firmware: enable custom fallback testing on limited kernel configs Luis R. Rodriguez
2017-11-29 10:20   ` Greg KH
2017-11-29 10:22   ` Greg KH
2017-11-30 20:31     ` Luis R. Rodriguez
2017-11-30 21:40       ` Shuah Khan
2017-11-29 10:28   ` Greg KH
2017-11-20 18:24 ` [PATCH v2 17/23] test_firmware: replace syfs fallback check with kconfig_has helper Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 18/23] firmware: enable to split firmware_class into separate target files Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 19/23] firmware: add debug facility to emulate forcing sysfs fallback Luis R. Rodriguez
2017-11-29 10:28   ` Greg KH
2017-11-30 20:35     ` Luis R. Rodriguez
2017-11-30 23:54       ` Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 20/23] firmware: add debug facility to emulate disabling " Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 21/23] test_firmware: add a library for shared helpers Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 22/23] test_firmware: test the 3 firmware kernel configs using debugfs Luis R. Rodriguez
2017-11-20 18:24 ` [PATCH v2 23/23] firmware: cleanup - group and document up private firmware parameters Luis R. Rodriguez

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.