mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
vc_screen: replace __get_free_pages() with kmalloc()
vcs_read() and vcs_write() allocate staging buffers with __get_free_pages(). These buffers can be allocated with kmalloc() as there's nothing special about them to go directly to the page allocator. kmalloc() provides a better API that does not require ugly casts and it's a modern way of saying "I need a page-sized buffer" Replace use of __get_free_page() with kmalloc() and drop unused now DEFINE_FREE(free_page_ptr ...) Link: https://lore.kernel.org/all/700c5a5f-3128-4671-99aa-827ca73f5cdf@kernel.org Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://patch.msgid.link/20260528-b4-tty-v1-4-9da9f7aec5f2@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
274afb49ee
commit
de96e8b27b
@@ -53,8 +53,6 @@
|
||||
#define HEADER_SIZE 4u
|
||||
#define CON_BUF_SIZE (IS_ENABLED(CONFIG_BASE_SMALL) ? 256 : PAGE_SIZE)
|
||||
|
||||
DEFINE_FREE(free_page_ptr, void *, if (_T) free_page((unsigned long)_T));
|
||||
|
||||
/*
|
||||
* Our minor space:
|
||||
*
|
||||
@@ -371,7 +369,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
loff_t pos;
|
||||
bool viewed, attr, uni_mode;
|
||||
|
||||
char *con_buf __free(free_page_ptr) = (char *)__get_free_page(GFP_KERNEL);
|
||||
char *con_buf __free(kfree) = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!con_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -596,7 +594,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
|
||||
if (use_unicode(inode))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
char *con_buf __free(free_page_ptr) = (char *)__get_free_page(GFP_KERNEL);
|
||||
char *con_buf __free(kfree) = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!con_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user