• Jesse Brandeburg's avatar
    ice: field prep conversion · 23eca34e
    Jesse Brandeburg authored
    Refactor ice driver to use FIELD_PREP(), which reduces lines of code
    and adds clarity of intent.
    
    This code was generated by the following coccinelle/spatch script and
    then manually repaired.
    
    Several places I changed to OR into a single variable with |= instead of
    using a multi-line statement with trailing OR operators, as it
    (subjectively) makes the code clearer.
    
    A local variable vmvf_and_timeout was created and used to avoid multiple
    logical ORs being __le16 converted, which shortened some lines and makes
    the code cleaner.
    
    Also clean up a couple of places where conversions were made to have the
    code read more clearly/consistently.
    
    @prep2@
    constant shift,mask;
    type T;
    expression a;
    @@
    -(((T)(a) << shift) & mask)
    +FIELD_PREP(mask, a)
    
    @prep@
    constant shift,mask;
    type T;
    expression a;
    @@
    -((T)((a) << shift) & mask)
    +FIELD_PREP(mask, a)
    
    Cc: Julia Lawall <Julia.Lawall@inria.fr>
    CC: Alexander Lobakin <aleksander.lobakin@intel.com>
    Reviewed-by: default avatarMarcin Szycik <marcin.szycik@linux.intel.com>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
    Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    23eca34e
ice_lib.c 106 KB