Skip to contentSkip to conversation

powerpc: Don't use alloc_bootmem in cpm_uart_cpm2.c

RFC/PATCH Applied Mark Ware 3 participants 4 messages Jul 20, 2009 – Jul 30, 2009

lore
Share & tools
lore

Mark Ware

author
#0 lore raw

This is another alloc_bootmem() -> kzalloc() change, this time to fix the non-fatal badness caused when booting with a cpm2_uart console.

---
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/cpm_uart/cpm_uart_cpm2.c +1 -1
index 141c0a3..a9802e7 100644
@@ -132,7 +132,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
 	memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
 	    L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
 	if (is_con) {
-		mem_addr = alloc_bootmem(memsz);
+		mem_addr = kzalloc(memsz, GFP_NOWAIT);
 		dma_addr = virt_to_bus(mem_addr);
 	}
 	else
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 15 lines · Mark Ware

This is another alloc_bootmem() -> kzalloc() change, this time to fix the non-fatal badness caused when booting with a cpm2_uart console.

---
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/cpm_uart/cpm_uart_cpm2.c +0 -0
index 141c0a3..a9802e7 100644

drivers/serial/cpm_uart/cpm_uart_cpm2.c int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, · line 138

Quoted 8 lines
drivers/serial/cpm_uart/cpm_uart_cpm2.c +1 -1
@@ -132,7 +132,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, 
 unsigned int is_con)
 	memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
 	    L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
 	if (is_con) {
-		mem_addr = alloc_bootmem(memsz);
+		mem_addr = kzalloc(memsz, GFP_NOWAIT);
 		dma_addr = virt_to_bus(mem_addr);
 	}

Hmm, is dma_alloc_coherent() now available this early as well? If so, we could get rid of the separate "is_con" handling altogether.

-Scott

author
#2 lore raw
Quoted 28 lines · Scott Wood
Quoted 15 lines · Mark Ware

This is another alloc_bootmem() -> kzalloc() change, this time to fix the non-fatal badness caused when booting with a cpm2_uart console.

---
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/cpm_uart/cpm_uart_cpm2.c +0 -0
index 141c0a3..a9802e7 100644

drivers/serial/cpm_uart/cpm_uart_cpm2.c int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, · line 138

Quoted 8 lines
drivers/serial/cpm_uart/cpm_uart_cpm2.c +1 -1
@@ -132,7 +132,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, 
 unsigned int is_con)
 	memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
 	    L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
 	if (is_con) {
-		mem_addr = alloc_bootmem(memsz);
+		mem_addr = kzalloc(memsz, GFP_NOWAIT);
 		dma_addr = virt_to_bus(mem_addr);
 	}

Hmm, is dma_alloc_coherent() now available this early as well? If so, we could get rid of the separate "is_con" handling altogether.

Quoted 2 lines

-Scott

This was my first thought as well, but calling dma_alloc_coherent() on a console resulted in a hang on boot before any console output. I have no actual proof, but it seems likely that it is not available at that point in the boot.

Regards,
Mark

Applied
#3 lore raw
In reply to Mark Ware
Quoted 8 lines · Mark Ware

This is another alloc_bootmem() -> kzalloc() change, this time to fix the non-fatal badness caused when booting with a cpm2_uart console.

---
drivers/serial/cpm_uart/cpm_uart_cpm2.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)

applied to merge (had to fix up patch by hand).

- k