[PATCH v3 0/7] refactor hostif_data_indication()

Tobin C. Harding me at tobin.cc
Mon Mar 13 06:38:15 UTC 2017


Checkpatch emits a number of checkpatch warnings, errors and
checks when parsing ks_hostif.c. We can remove a number
of these by refactoring hostif_data_indication(). Function contains a
chunk of code for handling WPA, this is a good target for refactoring.

Patch 01 refactors WPA code into a separate function, this is a cut
and paste with additional code added to pass compilation.

Patch 02 reduces the level of indentation in the new function.

Patch 03 fixes logical line continuations

Patch 04 does whitespace refactor, clearing various checkpatch warnings.

Patch 05 concatenates quoted string into one line

Patch 06 reduces the length of a comment string preserving meaning.

Patch 07 adds two variables to reduce complex access of nested data
structure. 

Patch set has not been tested. ks_hostif.c with set applied has been
checked with checkpatch.pl, Smatch, and Sparse. Program logic is not
modified by the series. Each patch in the series has been
applied and built in succession on both x86_64 and PowerPC.

Patch 01 introduces 4 new Sparse warning: cast to restricted __be16,
this is caused by the call

	unsigned short eth_proto;
        ...
	eth_proto = ntohs(eth_hdr->h_proto);

Same warnings are generated for the original function pre refactoring,
however now we make this call twice.

v2 -> v3
 - first 4 patches in v2 series were merged into staging-next.
 - Drop rename of michel -> michael, it's not directly related to
   this patch set.
 - Drop patch renaming buffers, maybe that is stylistic and not really
   a candidate for changing in a checkpatch patch set.
 - Separate changes into different patches with the aim of more
   clearly doing just one thing in each patch.

v1 -> v2:
 - Fix typo
 - Fix pointer dereference

Tobin C. Harding (7):
  staging: ks7010: move WPA code to separate function
  staging: ks7010: reduce level of indentation
  staging: ks7010: fix line continuations
  staging: ks7010: refactor newly separated function
  staging: ks7010: move quoted string onto single line
  staging: ks7010: reduce length of comment string
  staging: ks7010: add variables key, key_index

 drivers/staging/ks7010/ks_hostif.c | 168 ++++++++++++++++++++-----------------
 1 file changed, 89 insertions(+), 79 deletions(-)

-- 
2.7.4



More information about the devel mailing list