mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-04 21:49:11 +08:00
netmem: use _Generic to cover const casting for page_to_netmem()
The current page_to_netmem() doesn't cover const casting resulting in trying to cast const struct page * to const netmem_ref fails. To cover the case, change page_to_netmem() to use macro and _Generic. Signed-off-by: Byungchul Park <byungchul@sk.com> Reviewed-by: Mina Almasry <almasrymina@google.com> Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/20250702053256.4594-5-byungchul@sk.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b56ce86846
commit
4369d40da2
@@ -139,10 +139,9 @@ static inline netmem_ref net_iov_to_netmem(struct net_iov *niov)
|
||||
return (__force netmem_ref)((unsigned long)niov | NET_IOV);
|
||||
}
|
||||
|
||||
static inline netmem_ref page_to_netmem(const struct page *page)
|
||||
{
|
||||
return (__force netmem_ref)page;
|
||||
}
|
||||
#define page_to_netmem(p) (_Generic((p), \
|
||||
const struct page * : (__force const netmem_ref)(p), \
|
||||
struct page * : (__force netmem_ref)(p)))
|
||||
|
||||
/**
|
||||
* virt_to_netmem - convert virtual memory pointer to a netmem reference
|
||||
|
||||
Reference in New Issue
Block a user