lkml.org 
[lkml]   [2017]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 6/7] T10: Move opencoded contants to common header
    > -				if ((src->ref_tag == 0xffffffff) ||
    > - (src->app_tag == 0xffff)) {
    > + if ((src->ref_tag == T10_REF_ESCAPE) ||
    > + (src->app_tag == T10_APP_ESCAPE)) {

    Please remove the inner braces while you're at it (also later in the
    patch).

    > index 9fba9dd..c96845c 100644
    > --- a/include/linux/t10-pi.h
    > +++ b/include/linux/t10-pi.h
    > @@ -24,6 +24,9 @@ enum t10_dif_type {
    > T10_PI_TYPE3_PROTECTION = 0x3,
    > };
    >
    > +static const __be16 T10_APP_ESCAPE = (__force __be16) 0xffff;
    > +static const __be32 T10_REF_ESCAPE = (__force __be32) 0xffffffff;

    I'd do this as:

    #define T10_APP_ESCAPE cpu_to_be16(0xffff);
    #define T10_REF_ESCAPE cpu_to_be32(0xffffffff);

    This avoids relying on the compiler to merge constants, and also gets
    the endianess annotation right instead of force escaping it.

    \
     
     \ /
      Last update: 2017-04-04 09:09    [W:6.798 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site