diff mbox series

[8/8] mm: Remove cast from page_to_nid()

Message ID 20240227192337.757313-9-willy@infradead.org (mailing list archive)
State New
Headers show
Series PageFlags cleanups | expand

Commit Message

Matthew Wilcox Feb. 27, 2024, 7:23 p.m. UTC
Now that PF_POISONED_CHECK() can take a const argument, we can drop
the cast.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/mm.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

David Hildenbrand March 1, 2024, 11:27 a.m. UTC | #1
On 27.02.24 20:23, Matthew Wilcox (Oracle) wrote:
> Now that PF_POISONED_CHECK() can take a const argument, we can drop
> the cast.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   include/linux/mm.h | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index c4a76520c967..21a8cfbe75aa 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1662,13 +1662,11 @@ static inline int page_zone_id(struct page *page)
>   }
>   
>   #ifdef NODE_NOT_IN_PAGE_FLAGS
> -extern int page_to_nid(const struct page *page);
> +int page_to_nid(const struct page *page);
>   #else
>   static inline int page_to_nid(const struct page *page)
>   {
> -	struct page *p = (struct page *)page;
> -
> -	return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK;
> +	return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK;
>   }
>   #endif
>   

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index c4a76520c967..21a8cfbe75aa 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1662,13 +1662,11 @@  static inline int page_zone_id(struct page *page)
 }
 
 #ifdef NODE_NOT_IN_PAGE_FLAGS
-extern int page_to_nid(const struct page *page);
+int page_to_nid(const struct page *page);
 #else
 static inline int page_to_nid(const struct page *page)
 {
-	struct page *p = (struct page *)page;
-
-	return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK;
+	return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK;
 }
 #endif