mm: bring sparc pte_index() semantics inline with other platforms

pte_index() on platforms other than sparc return a numerical index.  On
sparc, it returns a pte_t*.  This presents an issue for
vm_insert_pages(), which relies on pte_index() to find the offset for a
pte within a pmd, for batched inserts.

This patch:
1. Modifies pte_index() for sparc to return a numerical index, like
   other platforms,
2. Defines pte_entry() for sparc which returns a pte_t*
   (as pte_index() used to),
3. Converts existing sparc callers for pte_index() to use pte_entry().

[ remove pte_entry and just directly modified pte_offset_kernel instead]
Signed-off-by: Arjun Roy <>
Signed-off-by: Stephen Rothwell <>
Signed-off-by: Andrew Morton <>
Reviewed-by: Mike Rapoport <>
Cc: Eric Dumazet <>
Cc: Soheil Hassas Yeganeh <>
Cc: David Miller <>
Cc: Matthew Wilcox <>
Cc: Arjun Roy <>
Cc: Jason Gunthorpe <>
Signed-off-by: Linus Torvalds <>
1 file changed