linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][trivial] mm/pagewalk.c break const constraint.
@ 2008-04-19  9:26 KOSAKI Motohiro
  2008-04-19  9:34 ` Vegard Nossum
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-04-19  9:26 UTC (permalink / raw)
  To: Matt Mackall, LKML, Andrew Morton, Linus Torvalds; +Cc: kosaki.motohiro

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 <kosaki.motohiro@jp.fujitsu.com>
CC: Matt Mackall <mpm@selenic.com>

---
 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,






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][trivial] mm/pagewalk.c break const constraint.
  2008-04-19  9:26 [PATCH][trivial] mm/pagewalk.c break const constraint KOSAKI Motohiro
@ 2008-04-19  9:34 ` Vegard Nossum
  2008-04-19  9:50   ` KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: Vegard Nossum @ 2008-04-19  9:34 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: Matt Mackall, LKML, Andrew Morton, Linus Torvalds

On Sat, Apr 19, 2008 at 11:26 AM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][trivial] mm/pagewalk.c break const constraint.
  2008-04-19  9:34 ` Vegard Nossum
@ 2008-04-19  9:50   ` KOSAKI Motohiro
  2008-04-19 10:04     ` [PATCH][trivial][0/2] mm/pagewalk.c break const constraint. take2 KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-04-19  9:50 UTC (permalink / raw)
  To: Vegard Nossum
  Cc: kosaki.motohiro, Matt Mackall, LKML, Andrew Morton,
	Linus Torvalds

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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH][trivial][0/2] mm/pagewalk.c break const constraint. take2
  2008-04-19  9:50   ` KOSAKI Motohiro
@ 2008-04-19 10:04     ` KOSAKI Motohiro
  2008-04-19 10:07       ` [PATCH][trivial][1/2] ia64: add constfy to pgd_offset() KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-04-19 10:04 UTC (permalink / raw)
  To: Vegard Nossum, Matt Mackall, LKML, Andrew Morton, Linus Torvalds,
	dev-etrax, Luck, Tony, linux-ia64
  Cc: kosaki.motohiro

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!



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH][trivial][1/2] ia64: add constfy to pgd_offset()
  2008-04-19 10:04     ` [PATCH][trivial][0/2] mm/pagewalk.c break const constraint. take2 KOSAKI Motohiro
@ 2008-04-19 10:07       ` KOSAKI Motohiro
  2008-04-19 10:09         ` [PATCH][trivial][2/2] cris: " KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-04-19 10:07 UTC (permalink / raw)
  To: Vegard Nossum, Matt Mackall, LKML, Andrew Morton, Linus Torvalds,
	dev-etrax, Luck, Tony, linux-ia64
  Cc: 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 <kosaki.motohiro@jp.fujitsu.com>
CC: Matt Mackall <mpm@selenic.com>
CC: "Vegard Nossum" <vegard.nossum@gmail.com>
CC: "Luck, Tony" <tony.luck@intel.com>

---
 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);
 }




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH][trivial][2/2] cris: add constfy to pgd_offset()
  2008-04-19 10:07       ` [PATCH][trivial][1/2] ia64: add constfy to pgd_offset() KOSAKI Motohiro
@ 2008-04-19 10:09         ` KOSAKI Motohiro
  2008-04-19 17:13           ` Dmitri Vorobiev
  2008-04-19 22:07           ` Jesper Nilsson
  0 siblings, 2 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-04-19 10:09 UTC (permalink / raw)
  To: Vegard Nossum, Matt Mackall, LKML, Andrew Morton, Linus Torvalds,
	dev-etrax, Mikael Starvik, Jesper Nilsson
  Cc: 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 <kosaki.motohiro@jp.fujitsu.com>
CC: Matt Mackall <mpm@selenic.com>
CC: "Vegard Nossum" <vegard.nossum@gmail.com>
CC: Mikael Starvik <starvik@axis.com>
CC: Jesper Nilsson <jesper.nilsson@axis.com>

---
 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);
 }




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][trivial][2/2] cris: add constfy to pgd_offset()
  2008-04-19 10:09         ` [PATCH][trivial][2/2] cris: " KOSAKI Motohiro
@ 2008-04-19 17:13           ` Dmitri Vorobiev
  2008-04-19 22:07           ` Jesper Nilsson
  1 sibling, 0 replies; 8+ messages in thread
From: Dmitri Vorobiev @ 2008-04-19 17:13 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Vegard Nossum, Matt Mackall, LKML, Andrew Morton, Linus Torvalds,
	dev-etrax, Mikael Starvik, Jesper Nilsson

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 <kosaki.motohiro@jp.fujitsu.com>
> CC: Matt Mackall <mpm@selenic.com>
> CC: "Vegard Nossum" <vegard.nossum@gmail.com>
> CC: Mikael Starvik <starvik@axis.com>
> CC: Jesper Nilsson <jesper.nilsson@axis.com>
> 
> ---
>  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/
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][trivial][2/2] cris: add constfy to pgd_offset()
  2008-04-19 10:09         ` [PATCH][trivial][2/2] cris: " KOSAKI Motohiro
  2008-04-19 17:13           ` Dmitri Vorobiev
@ 2008-04-19 22:07           ` Jesper Nilsson
  1 sibling, 0 replies; 8+ messages in thread
From: Jesper Nilsson @ 2008-04-19 22:07 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Vegard Nossum, Matt Mackall, LKML, Andrew Morton, Linus Torvalds,
	dev-etrax, Mikael Starvik

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 <kosaki.motohiro@jp.fujitsu.com>
> CC: Matt Mackall <mpm@selenic.com>
> CC: "Vegard Nossum" <vegard.nossum@gmail.com>
> CC: Mikael Starvik <starvik@axis.com>
> CC: Jesper Nilsson <jesper.nilsson@axis.com>
> 
> ---
>  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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-04-19 22:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-19  9:26 [PATCH][trivial] mm/pagewalk.c break const constraint KOSAKI Motohiro
2008-04-19  9:34 ` Vegard Nossum
2008-04-19  9:50   ` KOSAKI Motohiro
2008-04-19 10:04     ` [PATCH][trivial][0/2] mm/pagewalk.c break const constraint. take2 KOSAKI Motohiro
2008-04-19 10:07       ` [PATCH][trivial][1/2] ia64: add constfy to pgd_offset() KOSAKI Motohiro
2008-04-19 10:09         ` [PATCH][trivial][2/2] cris: " KOSAKI Motohiro
2008-04-19 17:13           ` Dmitri Vorobiev
2008-04-19 22:07           ` Jesper Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).