The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 0/4] tty: replace __get_free_pages() with kmalloc()
@ 2026-05-31  7:02 Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 1/4] serial: pch: replace __get_free_page() " Mike Rapoport (Microsoft)
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-05-31  7:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mike Rapoport, linux-kernel, linux-mm, linux-serial

This is a (tiny) part of larger work of replacing page allocator calls
with kmalloc.

Nowadays the right way to say "I need a buffer" is kmalloc() rather than
ancient and ugly __get_free_pages().

---
v2 changes:
* fix placement of include <linux/slab.h> in men_z135_uart

v1: https://patch.msgid.link/20260528-b4-tty-v1-0-9da9f7aec5f2@kernel.org

---
Mike Rapoport (Microsoft) (4):
      serial: pch: replace __get_free_page() with kmalloc()
      tty: amiserial: replace get_zeroed_page() with kzalloc()
      tty: serial: men_z135_uart: replace __get_free_page() with kmalloc()
      vc_screen: replace __get_free_pages() with kmalloc()

 drivers/tty/amiserial.c            | 14 +++++++-------
 drivers/tty/serial/men_z135_uart.c |  7 ++++---
 drivers/tty/serial/pch_uart.c      |  6 +++---
 drivers/tty/vt/vc_screen.c         |  6 ++----
 4 files changed, 16 insertions(+), 17 deletions(-)
---
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
change-id: 20260528-b4-tty-7c6e90f41d13

Best regards,
--  
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] serial: pch: replace __get_free_page() with kmalloc()
  2026-05-31  7:02 [PATCH v2 0/4] tty: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
@ 2026-05-31  7:02 ` Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-05-31  7:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mike Rapoport, linux-kernel, linux-mm, linux-serial

pch_uart_init_port() allocates a staging buffer for non-DMA receive path
using __get_free_page().

This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/tty/serial/pch_uart.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 6729d8e83c3c..07d8cdb58912 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1655,7 +1655,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	if (priv == NULL)
 		goto init_port_alloc_err;
 
-	rxbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
+	rxbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!rxbuf)
 		goto init_port_free_txbuf;
 
@@ -1728,7 +1728,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 #ifdef CONFIG_SERIAL_PCH_UART_CONSOLE
 	pch_uart_ports[board->line_no] = NULL;
 #endif
-	free_page((unsigned long)rxbuf);
+	kfree(rxbuf);
 init_port_free_txbuf:
 	kfree(priv);
 init_port_alloc_err:
@@ -1743,7 +1743,7 @@ static void pch_uart_exit_port(struct eg20t_port *priv)
 	snprintf(name, sizeof(name), "uart%d_regs", priv->port.line);
 	debugfs_lookup_and_remove(name, NULL);
 	uart_remove_one_port(&pch_uart_driver, &priv->port);
-	free_page((unsigned long)priv->rxbuf.buf);
+	kfree(priv->rxbuf.buf);
 }
 
 static void pch_uart_pci_remove(struct pci_dev *pdev)

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc()
  2026-05-31  7:02 [PATCH v2 0/4] tty: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 1/4] serial: pch: replace __get_free_page() " Mike Rapoport (Microsoft)
@ 2026-05-31  7:02 ` Mike Rapoport (Microsoft)
  2026-07-09  8:03   ` Geert Uytterhoeven
  2026-05-31  7:02 ` [PATCH v2 3/4] tty: serial: men_z135_uart: replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 4/4] vc_screen: replace __get_free_pages() " Mike Rapoport (Microsoft)
  3 siblings, 1 reply; 9+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-05-31  7:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mike Rapoport, linux-kernel, linux-mm, linux-serial

rs_startup() allocates a transmit ring buffer that is used to buffer reads
and writes from/to serial data register.

This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/tty/amiserial.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 81eaca751541..28af0fd98181 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -443,23 +443,23 @@ static int rs_startup(struct tty_struct *tty, struct serial_state *info)
 	struct tty_port *port = &info->tport;
 	unsigned long flags;
 	int	retval=0;
-	unsigned long page;
+	void *buffer;
 
-	page = get_zeroed_page(GFP_KERNEL);
-	if (!page)
+	buffer = kzalloc(PAGE_SIZE, GFP_KERNEL);
+	if (!buffer)
 		return -ENOMEM;
 
 	local_irq_save(flags);
 
 	if (tty_port_initialized(port)) {
-		free_page(page);
+		kfree(buffer);
 		goto errout;
 	}
 
 	if (info->xmit.buf)
-		free_page(page);
+		kfree(buffer);
 	else
-		info->xmit.buf = (unsigned char *) page;
+		info->xmit.buf = buffer;
 
 #ifdef SERIAL_DEBUG_OPEN
 	printk("starting up ttys%d ...", info->line);
@@ -537,7 +537,7 @@ static void rs_shutdown(struct tty_struct *tty, struct serial_state *info)
 	 */
 	free_irq(IRQ_AMIGA_VERTB, info);
 
-	free_page((unsigned long)info->xmit.buf);
+	kfree(info->xmit.buf);
 	info->xmit.buf = NULL;
 
 	info->IER = 0;

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] tty: serial: men_z135_uart: replace __get_free_page() with kmalloc()
  2026-05-31  7:02 [PATCH v2 0/4] tty: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 1/4] serial: pch: replace __get_free_page() " Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
@ 2026-05-31  7:02 ` Mike Rapoport (Microsoft)
  2026-05-31  7:02 ` [PATCH v2 4/4] vc_screen: replace __get_free_pages() " Mike Rapoport (Microsoft)
  3 siblings, 0 replies; 9+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-05-31  7:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mike Rapoport, linux-kernel, linux-mm, linux-serial

men_z135_probe() allocates a receive staging buffer filled by the
CPU via memcpy_fromio() from the device MMIO region.

This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/tty/serial/men_z135_uart.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c
index 6fad57fee912..9138fa29d301 100644
--- a/drivers/tty/serial/men_z135_uart.c
+++ b/drivers/tty/serial/men_z135_uart.c
@@ -16,6 +16,7 @@
 #include <linux/tty_flip.h>
 #include <linux/bitops.h>
 #include <linux/mcb.h>
+#include <linux/slab.h>
 
 #define MEN_Z135_MAX_PORTS		12
 #define MEN_Z135_BASECLK		29491200
@@ -811,7 +812,7 @@ static int men_z135_probe(struct mcb_device *mdev,
 	if (!uart)
 		return -ENOMEM;
 
-	uart->rxbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
+	uart->rxbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!uart->rxbuf)
 		return -ENOMEM;
 
@@ -841,7 +842,7 @@ static int men_z135_probe(struct mcb_device *mdev,
 	return 0;
 
 err:
-	free_page((unsigned long) uart->rxbuf);
+	kfree(uart->rxbuf);
 	dev_err(dev, "Failed to add UART: %d\n", err);
 
 	return err;
@@ -858,7 +859,7 @@ static void men_z135_remove(struct mcb_device *mdev)
 
 	line--;
 	uart_remove_one_port(&men_z135_driver, &uart->port);
-	free_page((unsigned long) uart->rxbuf);
+	kfree(uart->rxbuf);
 }
 
 static const struct mcb_device_id men_z135_ids[] = {

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] vc_screen: replace __get_free_pages() with kmalloc()
  2026-05-31  7:02 [PATCH v2 0/4] tty: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
                   ` (2 preceding siblings ...)
  2026-05-31  7:02 ` [PATCH v2 3/4] tty: serial: men_z135_uart: replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
@ 2026-05-31  7:02 ` Mike Rapoport (Microsoft)
  3 siblings, 0 replies; 9+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-05-31  7:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mike Rapoport, linux-kernel, linux-mm, linux-serial

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
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/tty/vt/vc_screen.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index 4d2d46c95fef..386c80efc672 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -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;
 

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc()
  2026-05-31  7:02 ` [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
@ 2026-07-09  8:03   ` Geert Uytterhoeven
  2026-07-09  8:05     ` Geert Uytterhoeven
  2026-07-09  9:07     ` Mike Rapoport
  0 siblings, 2 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2026-07-09  8:03 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-mm,
	linux-serial

Hi Mike,

On Sun, 31 May 2026 at 09:04, Mike Rapoport (Microsoft) <rppt@kernel.org> wrote:
> rs_startup() allocates a transmit ring buffer that is used to buffer reads
> and writes from/to serial data register.
>
> This buffer can be allocated with kmalloc() as there's nothing special
> about it to go directly to the page allocator.
>
> kmalloc() provides a better API that does not require ugly casts and
> kfree() does not need to know the size of the freed object.
>
> Replace use of get_zeroed_page() with kzalloc() and free_page() with
> kfree().
>
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Thanks for your patch, which is now commit d26ed502d0c7c05c ("tty:
amiserial: replace get_zeroed_page() with kzalloc()") in tty/tty-next

> --- a/drivers/tty/amiserial.c
> +++ b/drivers/tty/amiserial.c
> @@ -443,23 +443,23 @@ static int rs_startup(struct tty_struct *tty, struct serial_state *info)
>         struct tty_port *port = &info->tport;
>         unsigned long flags;
>         int     retval=0;
> -       unsigned long page;
> +       void *buffer;

"char *", to match the type of info->xmit.buf?

>
> -       page = get_zeroed_page(GFP_KERNEL);
> -       if (!page)
> +       buffer = kzalloc(PAGE_SIZE, GFP_KERNEL);
> +       if (!buffer)
>                 return -ENOMEM;
>
>         local_irq_save(flags);
>
>         if (tty_port_initialized(port)) {
> -               free_page(page);
> +               kfree(buffer);
>                 goto errout;
>         }
>
>         if (info->xmit.buf)
> -               free_page(page);
> +               kfree(buffer);
>         else
> -               info->xmit.buf = (unsigned char *) page;
> +               info->xmit.buf = buffer;
>
>  #ifdef SERIAL_DEBUG_OPEN
>         printk("starting up ttys%d ...", info->line);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc()
  2026-07-09  8:03   ` Geert Uytterhoeven
@ 2026-07-09  8:05     ` Geert Uytterhoeven
  2026-07-09  8:06       ` Geert Uytterhoeven
  2026-07-09  9:07     ` Mike Rapoport
  1 sibling, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2026-07-09  8:05 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-mm,
	linux-serial

On Thu, 9 Jul 2026 at 10:03, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Sun, 31 May 2026 at 09:04, Mike Rapoport (Microsoft) <rppt@kernel.org> wrote:
> > rs_startup() allocates a transmit ring buffer that is used to buffer reads
> > and writes from/to serial data register.
> >
> > This buffer can be allocated with kmalloc() as there's nothing special
> > about it to go directly to the page allocator.
> >
> > kmalloc() provides a better API that does not require ugly casts and
> > kfree() does not need to know the size of the freed object.
> >
> > Replace use of get_zeroed_page() with kzalloc() and free_page() with
> > kfree().
> >
> > Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
>
> Thanks for your patch, which is now commit d26ed502d0c7c05c ("tty:
> amiserial: replace get_zeroed_page() with kzalloc()") in tty/tty-next

Sorry, I replied to the work version: the applied patch is not this
v2, or the even newer v3, but v1?

> > --- a/drivers/tty/amiserial.c
> > +++ b/drivers/tty/amiserial.c
> > @@ -443,23 +443,23 @@ static int rs_startup(struct tty_struct *tty, struct serial_state *info)
> >         struct tty_port *port = &info->tport;
> >         unsigned long flags;
> >         int     retval=0;
> > -       unsigned long page;
> > +       void *buffer;
>
> "char *", to match the type of info->xmit.buf?
>
> >
> > -       page = get_zeroed_page(GFP_KERNEL);
> > -       if (!page)
> > +       buffer = kzalloc(PAGE_SIZE, GFP_KERNEL);
> > +       if (!buffer)
> >                 return -ENOMEM;
> >
> >         local_irq_save(flags);
> >
> >         if (tty_port_initialized(port)) {
> > -               free_page(page);
> > +               kfree(buffer);
> >                 goto errout;
> >         }
> >
> >         if (info->xmit.buf)
> > -               free_page(page);
> > +               kfree(buffer);
> >         else
> > -               info->xmit.buf = (unsigned char *) page;
> > +               info->xmit.buf = buffer;
> >
> >  #ifdef SERIAL_DEBUG_OPEN
> >         printk("starting up ttys%d ...", info->line);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc()
  2026-07-09  8:05     ` Geert Uytterhoeven
@ 2026-07-09  8:06       ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2026-07-09  8:06 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-mm,
	linux-serial

On Thu, 9 Jul 2026 at 10:05, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, 9 Jul 2026 at 10:03, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Sun, 31 May 2026 at 09:04, Mike Rapoport (Microsoft) <rppt@kernel.org> wrote:
> > > rs_startup() allocates a transmit ring buffer that is used to buffer reads
> > > and writes from/to serial data register.
> > >
> > > This buffer can be allocated with kmalloc() as there's nothing special
> > > about it to go directly to the page allocator.
> > >
> > > kmalloc() provides a better API that does not require ugly casts and
> > > kfree() does not need to know the size of the freed object.
> > >
> > > Replace use of get_zeroed_page() with kzalloc() and free_page() with
> > > kfree().
> > >
> > > Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> > > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> >
> > Thanks for your patch, which is now commit d26ed502d0c7c05c ("tty:
> > amiserial: replace get_zeroed_page() with kzalloc()") in tty/tty-next
>
> Sorry, I replied to the work version: the applied patch is not this
> v2, or the even newer v3, but v1?

s/work/wrong/, where is my morning coffee?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc()
  2026-07-09  8:03   ` Geert Uytterhoeven
  2026-07-09  8:05     ` Geert Uytterhoeven
@ 2026-07-09  9:07     ` Mike Rapoport
  1 sibling, 0 replies; 9+ messages in thread
From: Mike Rapoport @ 2026-07-09  9:07 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-mm,
	linux-serial

Hi Geert,

On Thu, Jul 09, 2026 at 10:03:53AM +0200, Geert Uytterhoeven wrote:
> Hi Mike,
> 
> On Sun, 31 May 2026 at 09:04, Mike Rapoport (Microsoft) <rppt@kernel.org> wrote:
> > rs_startup() allocates a transmit ring buffer that is used to buffer reads
> > and writes from/to serial data register.
> >
> > This buffer can be allocated with kmalloc() as there's nothing special
> > about it to go directly to the page allocator.
> >
> > kmalloc() provides a better API that does not require ugly casts and
> > kfree() does not need to know the size of the freed object.
> >
> > Replace use of get_zeroed_page() with kzalloc() and free_page() with
> > kfree().
> >
> > Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> 
> Thanks for your patch, which is now commit d26ed502d0c7c05c ("tty:
> amiserial: replace get_zeroed_page() with kzalloc()") in tty/tty-next
> 
> > --- a/drivers/tty/amiserial.c
> > +++ b/drivers/tty/amiserial.c
> > @@ -443,23 +443,23 @@ static int rs_startup(struct tty_struct *tty, struct serial_state *info)
> >         struct tty_port *port = &info->tport;
> >         unsigned long flags;
> >         int     retval=0;
> > -       unsigned long page;
> > +       void *buffer;
> 
> "char *", to match the type of info->xmit.buf?
 
Does it really matter that much to respin? ;-)

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-07-09  9:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-31  7:02 [PATCH v2 0/4] tty: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-05-31  7:02 ` [PATCH v2 1/4] serial: pch: replace __get_free_page() " Mike Rapoport (Microsoft)
2026-05-31  7:02 ` [PATCH v2 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
2026-07-09  8:03   ` Geert Uytterhoeven
2026-07-09  8:05     ` Geert Uytterhoeven
2026-07-09  8:06       ` Geert Uytterhoeven
2026-07-09  9:07     ` Mike Rapoport
2026-05-31  7:02 ` [PATCH v2 3/4] tty: serial: men_z135_uart: replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
2026-05-31  7:02 ` [PATCH v2 4/4] vc_screen: replace __get_free_pages() " Mike Rapoport (Microsoft)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox