lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v8 03/15] linux/kernel.h: Add PTR_ALIGN_DOWN macro
    Date
    Add a macro for aligning down a pointer. This is useful to get an
    aligned register address when a device allows only word access and
    doesn't allow half word or byte access.

    Acked-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    ---
    include/linux/kernel.h | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/include/linux/kernel.h b/include/linux/kernel.h
    index 82d91547d122..7339a00c895e 100644
    --- a/include/linux/kernel.h
    +++ b/include/linux/kernel.h
    @@ -34,6 +34,7 @@
    #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
    #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
    #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
    +#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a)))
    #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)

    /* generic data direction definitions */
    --
    2.17.1
    \
     
     \ /
      Last update: 2020-07-22 13:05    [W:2.908 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site