summaryrefslogtreecommitdiffstats
path: root/include/net/page_pool
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-12-15 22:29:38 +0100
committerJakub Kicinski <kuba@kernel.org>2024-12-18 02:45:17 +0100
commitd3c9510dc900e9ff3ea330189c0465c9f00fba18 (patch)
treeb94a7185d3229189c1bc99ceb8c97578fe5a2ea7 /include/net/page_pool
parentrust: net::phy scope ThisModule usage in the module_phy_driver macro (diff)
downloadlinux-d3c9510dc900e9ff3ea330189c0465c9f00fba18.tar.xz
linux-d3c9510dc900e9ff3ea330189c0465c9f00fba18.zip
net: page_pool: rename page_pool_is_last_ref()
page_pool_is_last_ref() releases a reference while the name, to me at least, suggests it just checks if the refcount is 1. The semantics of the function are the same as those of atomic_dec_and_test() and refcount_dec_and_test(), so just use the _and_test() suffix. Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Jesper Dangaard Brouer <hawk@kernel.org> Link: https://patch.msgid.link/20241215212938.99210-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/page_pool')
-rw-r--r--include/net/page_pool/helpers.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h
index e555921e5233..776a3008ac28 100644
--- a/include/net/page_pool/helpers.h
+++ b/include/net/page_pool/helpers.h
@@ -306,7 +306,7 @@ static inline void page_pool_ref_page(struct page *page)
page_pool_ref_netmem(page_to_netmem(page));
}
-static inline bool page_pool_is_last_ref(netmem_ref netmem)
+static inline bool page_pool_unref_and_test(netmem_ref netmem)
{
/* If page_pool_unref_page() returns 0, we were the last user */
return page_pool_unref_netmem(netmem, 1) == 0;
@@ -321,7 +321,7 @@ static inline void page_pool_put_netmem(struct page_pool *pool,
* allow registering MEM_TYPE_PAGE_POOL, but shield linker.
*/
#ifdef CONFIG_PAGE_POOL
- if (!page_pool_is_last_ref(netmem))
+ if (!page_pool_unref_and_test(netmem))
return;
page_pool_put_unrefed_netmem(pool, netmem, dma_sync_size, allow_direct);