[PATCH][trivial] mm/pagewalk.c break const constraint. - Kernel

This is a discussion on [PATCH][trivial] mm/pagewalk.c break const constraint. - Kernel ; patch against 2.6.25 when compile 2.6.25, following warnings was outputed. CC mm/pagewalk.o mm/pagewalk.c: In function 'walk_page_range': mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\ ointer target type mm argument of walk_page_range() is unnecessary const restriction. this patch ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: [PATCH][trivial] mm/pagewalk.c break const constraint.

  1. [PATCH][trivial] mm/pagewalk.c break const constraint.

    patch against 2.6.25

    when compile 2.6.25, following warnings was outputed.

    CC mm/pagewalk.o
    mm/pagewalk.c: In function 'walk_page_range':
    mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    ointer target type

    mm argument of walk_page_range() is unnecessary const restriction.
    this patch is no functional change. it's only remove warning.

    Thanks!


    Signed-off-by: KOSAKI Motohiro
    CC: Matt Mackall

    ---
    include/linux/mm.h | 2 +-
    mm/pagewalk.c | 2 +-
    2 files changed, 2 insertions(+), 2 deletions(-)

    Index: b/mm/pagewalk.c
    ================================================== =================
    --- a/mm/pagewalk.c 2008-04-19 17:46:34.000000000 +0900
    +++ b/mm/pagewalk.c 2008-04-19 18:43:58.000000000 +0900
    @@ -97,7 +97,7 @@ static int walk_pud_range(pgd_t *pgd, un
    * If any callback returns a non-zero value, the walk is aborted and
    * the return value is propagated back to the caller. Otherwise 0 is returned.
    */
    -int walk_page_range(const struct mm_struct *mm,
    +int walk_page_range(struct mm_struct *mm,
    unsigned long addr, unsigned long end,
    const struct mm_walk *walk, void *private)
    {
    Index: b/include/linux/mm.h
    ================================================== =================
    --- a/include/linux/mm.h 2008-04-19 17:46:12.000000000 +0900
    +++ b/include/linux/mm.h 2008-04-19 18:44:14.000000000 +0900
    @@ -746,7 +746,7 @@ struct mm_walk {
    int (*pte_hole)(unsigned long, unsigned long, void *);
    };

    -int walk_page_range(const struct mm_struct *, unsigned long addr,
    +int walk_page_range(struct mm_struct *, unsigned long addr,
    unsigned long end, const struct mm_walk *walk,
    void *private);
    void free_pgd_range(struct mmu_gather **tlb, unsigned long addr,





    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH][trivial] mm/pagewalk.c break const constraint.

    On Sat, Apr 19, 2008 at 11:26 AM, KOSAKI Motohiro
    wrote:
    > patch against 2.6.25
    >
    > when compile 2.6.25, following warnings was outputed.
    >
    > CC mm/pagewalk.o
    > mm/pagewalk.c: In function 'walk_page_range':
    > mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    > ointer target type
    >
    > mm argument of walk_page_range() is unnecessary const restriction.
    > this patch is no functional change. it's only remove warning.


    Is this ia64 or cris? I think the correct way to resolve this is to
    make pgd_offset() take a const struct mm_struct * instead.

    Vegard


    --
    "The animistic metaphor of the bug that maliciously sneaked in while
    the programmer was not looking is intellectually dishonest as it
    disguises that the error is the programmer's own creation."
    -- E. W. Dijkstra, EWD1036
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: [PATCH][trivial] mm/pagewalk.c break const constraint.

    Hi

    > > when compile 2.6.25, following warnings was outputed.
    > >
    > > CC mm/pagewalk.o
    > > mm/pagewalk.c: In function 'walk_page_range':
    > > mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    > > ointer target type
    > >
    > > mm argument of walk_page_range() is unnecessary const restriction.
    > > this patch is no functional change. it's only remove warning.

    >
    > Is this ia64 or cris?


    Yes, I use IA64.

    > I think the correct way to resolve this is to
    > make pgd_offset() take a const struct mm_struct * instead.


    that makes sense.
    OK, I will make patch again.

    Thank you for very good opinion.



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. [PATCH][trivial][1/2] ia64: add constfy to pgd_offset()

    add constfy to pgd_offset() for avoid following warnings.

    CC mm/pagewalk.o
    mm/pagewalk.c: In function 'walk_page_range':
    mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    ointer target type




    Signed-off-by: KOSAKI Motohiro
    CC: Matt Mackall
    CC: "Vegard Nossum"
    CC: "Luck, Tony"

    ---
    include/asm-ia64/pgtable.h | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    Index: b/include/asm-ia64/pgtable.h
    ================================================== =================
    --- a/include/asm-ia64/pgtable.h 2008-04-19 17:46:11.000000000 +0900
    +++ b/include/asm-ia64/pgtable.h 2008-04-19 19:20:16.000000000 +0900
    @@ -371,7 +371,7 @@ pgd_index (unsigned long address)
    /* The offset in the 1-level directory is given by the 3 region bits
    (61..63) and the level-1 bits. */
    static inline pgd_t*
    -pgd_offset (struct mm_struct *mm, unsigned long address)
    +pgd_offset (const struct mm_struct *mm, unsigned long address)
    {
    return mm->pgd + pgd_index(address);
    }



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  5. [PATCH][trivial][0/2] mm/pagewalk.c break const constraint. take2

    this patch is against 2.6.25


    when compile 2.6.25 on ia64, following warnings was outputed.

    CC mm/pagewalk.o
    mm/pagewalk.c: In function 'walk_page_range':
    mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    ointer target type

    the type of mm argument of walk_page_range() is "const struct mm *",
    but pgd_offset() on ia64 declare "struct mm*".
    cris port has the same problems.

    I propse add const to pgd_offset() for solve this problem.

    Thanks!


    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  6. [PATCH][trivial][2/2] cris: add constfy to pgd_offset()

    add constfy to pgd_offset() for avoid following warnings.

    CC mm/pagewalk.o
    mm/pagewalk.c: In function 'walk_page_range':
    mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    ointer target type

    Signed-off-by: KOSAKI Motohiro
    CC: Matt Mackall
    CC: "Vegard Nossum"
    CC: Mikael Starvik
    CC: Jesper Nilsson

    ---
    include/asm-cris/pgtable.h | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    Index: b/include/asm-cris/pgtable.h
    ================================================== =================
    --- a/include/asm-cris/pgtable.h 2008-04-19 19:25:50.000000000 +0900
    +++ b/include/asm-cris/pgtable.h 2008-04-19 19:27:31.000000000 +0900
    @@ -229,7 +229,7 @@ static inline void pmd_set(pmd_t * pmdp,
    #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))

    /* to find an entry in a page-table-directory */
    -static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
    +static inline pgd_t * pgd_offset(const struct mm_struct * mm, unsigned long address)
    {
    return mm->pgd + pgd_index(address);
    }



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  7. Re: [PATCH][trivial][2/2] cris: add constfy to pgd_offset()

    KOSAKI Motohiro пишет:
    > add constfy to pgd_offset() for avoid following warnings.
    >
    > CC mm/pagewalk.o
    > mm/pagewalk.c: In function 'walk_page_range':
    > mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    > ointer target type
    >
    > Signed-off-by: KOSAKI Motohiro
    > CC: Matt Mackall
    > CC: "Vegard Nossum"
    > CC: Mikael Starvik
    > CC: Jesper Nilsson
    >
    > ---
    > include/asm-cris/pgtable.h | 2 +-
    > 1 file changed, 1 insertion(+), 1 deletion(-)
    >
    > Index: b/include/asm-cris/pgtable.h
    > ================================================== =================
    > --- a/include/asm-cris/pgtable.h 2008-04-19 19:25:50.000000000 +0900
    > +++ b/include/asm-cris/pgtable.h 2008-04-19 19:27:31.000000000 +0900
    > @@ -229,7 +229,7 @@ static inline void pmd_set(pmd_t * pmdp,
    > #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
    >
    > /* to find an entry in a page-table-directory */
    > -static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
    > +static inline pgd_t * pgd_offset(const struct mm_struct * mm, unsigned long address)

    ^ ^
    I think that while at it, you could also delete these superfluous spaces
    after the asterisks thereby making the code conform to the kernel coding style.

    Dmitri

    > {
    > return mm->pgd + pgd_index(address);
    > }
    >
    >
    >
    > --
    > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    > the body of a message to majordomo@vger.kernel.org
    > More majordomo info at http://vger.kernel.org/majordomo-info.html
    > Please read the FAQ at http://www.tux.org/lkml/
    >


    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  8. Re: [PATCH][trivial][2/2] cris: add constfy to pgd_offset()

    On Sat, Apr 19, 2008 at 12:09:25PM +0200, KOSAKI Motohiro wrote:
    > add constfy to pgd_offset() for avoid following warnings.
    >
    > CC mm/pagewalk.o
    > mm/pagewalk.c: In function 'walk_page_range':
    > mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
    > ointer target type
    >
    > Signed-off-by: KOSAKI Motohiro
    > CC: Matt Mackall
    > CC: "Vegard Nossum"
    > CC: Mikael Starvik
    > CC: Jesper Nilsson
    >
    > ---
    > include/asm-cris/pgtable.h | 2 +-
    > 1 file changed, 1 insertion(+), 1 deletion(-)
    >
    > Index: b/include/asm-cris/pgtable.h
    > ================================================== =================
    > --- a/include/asm-cris/pgtable.h 2008-04-19 19:25:50.000000000 +0900
    > +++ b/include/asm-cris/pgtable.h 2008-04-19 19:27:31.000000000 +0900
    > @@ -229,7 +229,7 @@ static inline void pmd_set(pmd_t * pmdp,
    > #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
    >
    > /* to find an entry in a page-table-directory */
    > -static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
    > +static inline pgd_t * pgd_offset(const struct mm_struct * mm, unsigned long address)
    > {
    > return mm->pgd + pgd_index(address);
    > }


    Thanks, I've added the following to the CRIS-tree.

    ---
    include/asm-cris/pgtable.h | 3 ++-
    1 files changed, 2 insertions(+), 1 deletions(-)

    diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
    index a260757..a307ed6 100644
    --- a/include/asm-cris/pgtable.h
    +++ b/include/asm-cris/pgtable.h
    @@ -229,7 +229,8 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
    #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))

    /* to find an entry in a page-table-directory */
    -static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
    +static inline pgd_t *pgd_offset(const struct mm_struct *mm,
    + unsigned long address)
    {
    return mm->pgd + pgd_index(address);
    }
    --
    1.5.4.2.133.g3d51e

    /^JN - Jesper Nilsson
    --
    Jesper Nilsson -- jesper.nilsson@axis.com
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread