iwlwifi: runtime: avoid calling debugfs read functions more than once
authorNaftali Goldstein <naftali.goldstein@intel.com>
Tue, 13 Mar 2018 18:00:35 +0000 (20:00 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 31 Aug 2018 08:38:16 +0000 (11:38 +0300)
commitdd2690579f5138e569440e5252e93d8634593190
tree606043473ea58748948f772736c87e6cd2da01c0
parentfe997b00c5b5953e48e61956ced0e73c84e9d054
iwlwifi: runtime: avoid calling debugfs read functions more than once

Upon first calling read() on a debugfs file, invoke
iwl_dbgfs_##name##_read and store the response buffer on the heap, so
subsequent read() calls don't need to invoke said function again.

This is done because cat etc will call read() repeatedly until EOF is
reached (or read() returns 0), which in the current implementation will
cause said function to be invoked multiple times.

With the current implementation this can also cause buggy behavior in
some weird edge cases where the first invocation returns a string of
length n, and the second of length m>n: The last m-n characters of
the second invocation will be printed to screen.

Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c