serial: cpm_uart: Cleanup and refactoring
Subsystems (4)
cover serial: cpm_uart: Cleanup and refactoring
This series is a dust removal and cleanup of cpm_uart serial driver.
After cleaning up things we see that CPM1 and CPM2 have so much in common that it is not worth keeping separate code.
Once refactoring is done, there is only one .c and one .h in cpm_uart/ subdirectory so its worth getting rid of cpm_uart/ subdir.
The last part leads to the complete removal of include/linux/fs_uart_pd.h
Christophe Leroy (12):
serial: cpm_uart: Avoid suspicious locking
serial: cpm_uart: Remove stale prototypes and table and macros
serial: cpm_uart: Stop using fs_uart_id enum
serial: cpm_uart: Use get_baudrate() instead of uart_baudrate()
serial: cpm_uart: Deduplicate cpm_set_{brg/smc_fcr/scc_fcr}()
serial: cpm_uart: Deduplicate cpm_line_cr_cmd()
serial: cpm_uart: Refactor cpm_uart_allocbuf()/cpm_uart_freebuf()
serial: cpm_uart: Refactor cpm_uart_[un]map_pram()
serial: cpm_uart: Remove cpm_uart/ subdirectory
serial: cpm_uart: Remove stale prototype in powerpc/fsl_soc.c
serial: cpm_uart: Don't include fs_uart_pd.h when not needed
serial: cpm_uart: Remove linux/fs_uart_pd.h
arch/powerpc/include/asm/fs_pd.h | 10 --
arch/powerpc/platforms/8xx/mpc885ads_setup.c | 1 -
arch/powerpc/platforms/8xx/tqm8xx_setup.c | 1 -
arch/powerpc/sysdev/fsl_soc.c | 2 -
drivers/tty/serial/Makefile | 2 +-
.../{cpm_uart/cpm_uart_core.c => cpm_uart.c} | 157 ++++++++++++++++--
drivers/tty/serial/{cpm_uart => }/cpm_uart.h | 38 +----
drivers/tty/serial/cpm_uart/Makefile | 12 --
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 122 --------------
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h | 33 ----
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 156 -----------------
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h | 33 ----
drivers/tty/serial/ucc_uart.c | 1 -
include/linux/fs_uart_pd.h | 71 --------
14 files changed, 145 insertions(+), 494 deletions(-)
rename drivers/tty/serial/{cpm_uart/cpm_uart_core.c => cpm_uart.c} (90%)
rename drivers/tty/serial/{cpm_uart => }/cpm_uart.h (64%)
delete mode 100644 drivers/tty/serial/cpm_uart/Makefile
delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h
delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h
delete mode 100644 include/linux/fs_uart_pd.hSignature · 1 line
2.41.0
PATCH 1/12 serial: cpm_uart: Avoid suspicious locking
CHECK drivers/tty/serial/cpm_uart/cpm_uart_core.cdrivers/tty/serial/cpm_uart/cpm_uart_core.c:1271:39: warning: context imbalance in 'cpm_uart_console_write' - unexpected unlock
Allthough 'nolock' is not expected to change, sparse find the following form suspicious:
if (unlikely(nolock)) {
local_irq_save(flags);
} else {
spin_lock_irqsave(&pinfo->port.lock, flags);
}
cpm_uart_early_write(pinfo, s, count, true);
if (unlikely(nolock)) {
local_irq_restore(flags);
} else {
spin_unlock_irqrestore(&pinfo->port.lock, flags);
}Rewrite it a more obvious form:
if (unlikely(oops_in_progress)) {
local_irq_save(flags);
cpm_uart_early_write(pinfo, s, count, true);
local_irq_restore(flags);
} else {
spin_lock_irqsave(&pinfo->port.lock, flags);
cpm_uart_early_write(pinfo, s, count, true);
spin_unlock_irqrestore(&pinfo->port.lock, flags);
}--- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/tty/serial/cpm_uart/cpm_uart_core.c +4 -9
@@ -1255,19 +1255,14 @@ static void cpm_uart_console_write(struct console *co, const char *s, {struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index];unsigned long flags; -int nolock = oops_in_progress; -if (unlikely (nolock)) { +if (unlikely (oops_in_progress)) {local_irq_save (flags); - }else { -spin_lock_irqsave (&pinfo->port.lock, flags); - } - -cpm_uart_early_write (pinfo, s, count, true); - -if (unlikely (nolock)) { +cpm_uart_early_write (pinfo, s, count, true);local_irq_restore (flags); }else { +spin_lock_irqsave (&pinfo->port.lock, flags); +cpm_uart_early_write (pinfo, s, count, true);spin_unlock_irqrestore (&pinfo->port.lock, flags); } }
Signature · 1 line
2.41.0
PATCH 2/12 serial: cpm_uart: Remove stale prototypes and table and macros
In reply to Christophe Leroycpm_uart_init_portdesc()smc1_lineif()smc2_lineif()scc1_lineif()scc2_lineif()scc3_lineif()scc4_lineif()
Those functions were removed by commit 0b2a2e5b7747 ("cpm_uart: Remove !CONFIG_PPC_CPM_NEW_BINDING code"). Remove stale prototypes.
UART_SMC{1..2} and UART_SCC{1..4} and SCC_WAIT_CLOSING macros are not used anymore since the above commit.
cpm_uart_ports[] isn't used outside cpm_uart_core.c since the same commit, so make it static.
cpm_uart_init_smc() and cpm_uart_init_scc() don't need a forward declaration.
FLAG_DISCARDING and IS_DISCARDING have never been used since at least 2.6.12 and the start of git repository for kernel.
--- drivers/tty/serial/cpm_uart/cpm_uart.h | 21 --------------------- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 4 +--- 2 files changed, 1 insertion(+), 24 deletions(-)
drivers/tty/serial/cpm_uart/cpm_uart.h +0 -21
@@ -25,18 +25,9 @@ struct gpio_desc;#define SERIAL_CPM_MINOR 46#define IS_SMC (pinfo) (pinfo->flags & FLAG_SMC) -#define IS_DISCARDING (pinfo) (pinfo->flags & FLAG_DISCARDING) -#define FLAG_DISCARDING 0x00000004/* when set, don't discard */ #define FLAG_SMC 0x00000002#define FLAG_CONSOLE 0x00000001 -#define UART_SMC1 fsid_smc1_uart -#define UART_SMC2 fsid_smc2_uart -#define UART_SCC1 fsid_scc1_uart -#define UART_SCC2 fsid_scc2_uart -#define UART_SCC3 fsid_scc3_uart -#define UART_SCC4 fsid_scc4_uart -#define UART_NR fs_uart_nr#define RX_NUM_FIFO 4
@@ -44,8 +35,6 @@ struct gpio_desc;#define TX_NUM_FIFO 4#define TX_BUF_SIZE 32 -#define SCC_WAIT_CLOSING 100 -#define GPIO_CTS 0#define GPIO_RTS 1#define GPIO_DCD 2
@@ -85,24 +74,14 @@ struct uart_cpm_port {struct gpio_desc *gpios[NUM_GPIOS ]; }; -extern struct uart_cpm_port cpm_uart_ports[UART_NR ]; -/* these are located in their respective files */ void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd);void __iomem *cpm_uart_map_pram (struct uart_cpm_port *port,struct device_node *np);void cpm_uart_unmap_pram (struct uart_cpm_port *port,void __iomem *pram); -int cpm_uart_init_portdesc (void );int cpm_uart_allocbuf (struct uart_cpm_port *pinfo,unsigned int is_con);void cpm_uart_freebuf (struct uart_cpm_port *pinfo); -void smc1_lineif (struct uart_cpm_port *pinfo); -void smc2_lineif (struct uart_cpm_port *pinfo); -void scc1_lineif (struct uart_cpm_port *pinfo); -void scc2_lineif (struct uart_cpm_port *pinfo); -void scc3_lineif (struct uart_cpm_port *pinfo); -void scc4_lineif (struct uart_cpm_port *pinfo); -/* virtual to phys transtalion */
drivers/tty/serial/cpm_uart/cpm_uart_core.c +1 -3
@@ -48,8 +48,6 @@/**************************************************************/ static int cpm_uart_tx_pump (struct uart_port *port); -static void cpm_uart_init_smc (struct uart_cpm_port *pinfo); -static void cpm_uart_init_scc (struct uart_cpm_port *pinfo);static void cpm_uart_initbd (struct uart_cpm_port *pinfo);/**************************************************************/
@@ -1128,7 +1126,7 @@ static const struct uart_ops cpm_uart_pops = {#endif }; -struct uart_cpm_port cpm_uart_ports[UART_NR ]; +static struct uart_cpm_port cpm_uart_ports[UART_NR ];static int cpm_uart_init_port (struct device_node *np,struct uart_cpm_port *pinfo)
Signature · 1 line
2.41.0
PATCH 3/12 serial: cpm_uart: Stop using fs_uart_id enum
In reply to Christophe LeroyUsing an enum indirection to define numeric macros is pointless. Directly use the wanted numeric value.
--- drivers/tty/serial/cpm_uart/cpm_uart.h | 3 +-- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/tty/serial/cpm_uart/cpm_uart.h +1 -2
@@ -11,7 +11,6 @@#define CPM_UART_H #include <linux/platform_device.h> -#include <linux/fs_uart_pd.h> struct gpio_desc ;
@@ -28,7 +27,7 @@ struct gpio_desc;#define FLAG_SMC 0x00000002#define FLAG_CONSOLE 0x00000001 -#define UART_NR fs_uart_nr +#define UART_NR 6#define RX_NUM_FIFO 4#define RX_BUF_SIZE 32
drivers/tty/serial/cpm_uart/cpm_uart_core.c +0 -1
@@ -26,7 +26,6 @@#include <linux/device.h> #include <linux/memblock.h> #include <linux/dma-mapping.h> -#include <linux/fs_uart_pd.h> #include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h>
Signature · 1 line
2.41.0
PATCH 4/12 serial: cpm_uart: Use get_baudrate() instead of uart_baudrate()
In reply to Christophe Leroyuart_baudrate() is just a trivial wrapper to get_baudrate().
Use get_baudrate() directly and remove assignment in if condition.
And also remove uart_clock() which is not used since commit 0b2a2e5b7747 ("cpm_uart: Remove !CONFIG_PPC_CPM_NEW_BINDING code")
--- arch/powerpc/include/asm/fs_pd.h | 10 ---------- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 6 ++++-- 2 files changed, 4 insertions(+), 12 deletions(-)
arch/powerpc/include/asm/fs_pd.h +0 -10
@@ -36,14 +36,4 @@ extern immap_t __iomem *mpc8xx_immr;#define immr_unmap (addr) do {} while (0)#endif -static inline int uart_baudrate (void ) -{ -return get_baudrate (); -} - -static inline int uart_clock (void ) -{ -return ppc_proc_freq; -} -#endif
drivers/tty/serial/cpm_uart/cpm_uart_core.c +4 -2
@@ -32,10 +32,11 @@#include <linux/gpio/consumer.h> #include <linux/clk.h> +#include <sysdev/fsl_soc.h> +#include <asm/io.h> #include <asm/irq.h> #include <asm/delay.h> -#include <asm/fs_pd.h> #include <asm/udbg.h> #include <linux/serial_core.h>
@@ -1311,7 +1312,8 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)if (options) {uart_parse_options (options, &baud, &parity, &bits, &flow); }else { -if ((baud =uart_baudrate ()) ==-1 ) + baud =get_baudrate (); +if (baud ==-1 ) baud =9600 ; }
Signature · 1 line
2.41.0
PATCH 5/12 serial: cpm_uart: Deduplicate cpm_set_{brg/smc_fcr/scc_fcr}()
In reply to Christophe LeroyCPMFCR_EB is the same as SMC_EB and is defined
for both CPM1 and CPM2.
CPMFCR_GBL is defined as 0 for CPM1.
Therefore the CPM2 version of cpm_set_scc_fcr() and cpm_set_smc_fcr() can be used on both CPM1 and CPM2.
And cpm_set_brg() is already identical and just a
wrapper of cpm_setbrg().
In addition those three fonctions are only called once from cpm_uart_core.c, so just replace the calls with the content of the CPM2 versions of them.
And DPRAM_BASE is identical so can go in cpm_uart.h. While moving it, use cpm_muram_addr() directly instead of the cpm_dpram_addr() macro and remove __force tag which isn't needed.
Then cpm_uart_cpm1.h and cpm_uart_cpm2.h go away.
--- drivers/tty/serial/cpm_uart/cpm_uart.h | 6 ++-- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 8 +++-- drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h | 33 --------------------- drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h | 33 --------------------- 4 files changed, 9 insertions(+), 71 deletions(-) delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h
drivers/tty/serial/cpm_uart/cpm_uart.h +4 -2
@@ -15,11 +15,13 @@struct gpio_desc ;#if defined(CONFIG_CPM2 ) -#include "cpm_uart_cpm2.h" +#include "asm/cpm2.h" #elif defined(CONFIG_CPM1 ) -#include "cpm_uart_cpm1.h" +#include "asm/cpm1.h" #endif +#define DPRAM_BASE ((u8 __iomem *)cpm_muram_addr(0)) +#define SERIAL_CPM_MAJOR 204#define SERIAL_CPM_MINOR 46
drivers/tty/serial/cpm_uart/cpm_uart_core.c +5 -3
@@ -603,7 +603,7 @@ static void cpm_uart_set_termios(struct uart_port *port,if (pinfo->clk)clk_set_rate (pinfo->clk, baud);else -cpm_set_brg (pinfo->brg -1 , baud); +cpm_setbrg (pinfo->brg -1 , baud);spin_unlock_irqrestore (&port->lock, flags); }
@@ -769,7 +769,8 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)* parameter ram. */ -cpm_set_scc_fcr (sup); +out_8 (&sup->scc_genscc.scc_rfcr,CPMFCR_GBL |CPMFCR_EB ); +out_8 (&sup->scc_genscc.scc_tfcr,CPMFCR_GBL |CPMFCR_EB );out_be16 (&sup->scc_genscc.scc_mrblr, pinfo->rx_fifosize);out_be16 (&sup->scc_maxidl,0x10 );
@@ -840,7 +841,8 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)/* Set up the uart parameters in the * parameter ram. */ -cpm_set_smc_fcr (up); +out_8 (&up->smc_rfcr,CPMFCR_GBL |CPMFCR_EB ); +out_8 (&up->smc_tfcr,CPMFCR_GBL |CPMFCR_EB );/* Using idle character time requires some additional tuning. */ out_be16 (&up->smc_mrblr, pinfo->rx_fifosize);
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h deleted +0 -33
@@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Driver for CPM (SCC/SMC) serial ports -* -* definitions for cpm1 -* -*/ - -#ifndef CPM_UART_CPM1_H -#define CPM_UART_CPM1_H - -#include <asm/cpm1.h> - -static inline void cpm_set_brg (int brg,int baud) -{ -cpm_setbrg (brg, baud); -} - -static inline void cpm_set_scc_fcr (scc_uart_t __iomem * sup) -{ -out_8 (&sup->scc_genscc.scc_rfcr,SMC_EB ); -out_8 (&sup->scc_genscc.scc_tfcr,SMC_EB ); -} - -static inline void cpm_set_smc_fcr (smc_uart_t __iomem * up) -{ -out_8 (&up->smc_rfcr,SMC_EB ); -out_8 (&up->smc_tfcr,SMC_EB ); -} - -#define DPRAM_BASE ((u8 __iomem __force *)cpm_dpram_addr(0)) - -#endif
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h deleted +0 -33
@@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Driver for CPM (SCC/SMC) serial ports -* -* definitions for cpm2 -* -*/ - -#ifndef CPM_UART_CPM2_H -#define CPM_UART_CPM2_H - -#include <asm/cpm2.h> - -static inline void cpm_set_brg (int brg,int baud) -{ -cpm_setbrg (brg, baud); -} - -static inline void cpm_set_scc_fcr (scc_uart_t __iomem *sup) -{ -out_8 (&sup->scc_genscc.scc_rfcr,CPMFCR_GBL |CPMFCR_EB ); -out_8 (&sup->scc_genscc.scc_tfcr,CPMFCR_GBL |CPMFCR_EB ); -} - -static inline void cpm_set_smc_fcr (smc_uart_t __iomem *up) -{ -out_8 (&up->smc_rfcr,CPMFCR_GBL |CPMFCR_EB ); -out_8 (&up->smc_tfcr,CPMFCR_GBL |CPMFCR_EB ); -} - -#define DPRAM_BASE ((u8 __iomem __force *)cpm_dpram_addr(0)) - -#endif
Signature · 1 line
2.41.0
PATCH 6/12 serial: cpm_uart: Deduplicate cpm_line_cr_cmd()
In reply to Christophe Leroycpm_line_cr_cmd() is identical for CPM1 and CPM2 and is used only in cpm_uart_core.c. Move it there.
--- drivers/tty/serial/cpm_uart/cpm_uart.h | 1 - drivers/tty/serial/cpm_uart/cpm_uart_core.c | 5 +++++ drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 5 ----- drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 5 ----- 4 files changed, 5 insertions(+), 11 deletions(-)
drivers/tty/serial/cpm_uart/cpm_uart.h +0 -1
@@ -76,7 +76,6 @@ struct uart_cpm_port { };/* these are located in their respective files */ -void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd);void __iomem *cpm_uart_map_pram (struct uart_cpm_port *port,struct device_node *np);void cpm_uart_unmap_pram (struct uart_cpm_port *port,void __iomem *pram);
drivers/tty/serial/cpm_uart/cpm_uart_core.c +5 -0
@@ -54,6 +54,11 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo);#define HW_BUF_SPD_THRESHOLD 2400 +static void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) +{ +cpm_command (port->command, cmd); +} +/* * Check, if transmit buffers are processed */
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c +0 -5
@@ -36,11 +36,6 @@/**************************************************************/ -void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) -{ -cpm_command (port->command, cmd); -} -void __iomem *cpm_uart_map_pram (struct uart_cpm_port *port,struct device_node *np) {
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c +0 -5
@@ -33,11 +33,6 @@/**************************************************************/ -void cpm_line_cr_cmd (struct uart_cpm_port *port,int cmd) -{ -cpm_command (port->command, cmd); -} -void __iomem *cpm_uart_map_pram (struct uart_cpm_port *port,struct device_node *np) {
Signature · 1 line
2.41.0
PATCH 7/12 serial: cpm_uart: Refactor cpm_uart_allocbuf()/cpm_uart_freebuf()
In reply to Christophe Leroycpm_uart_freebuf() is identical for CPM1 and CPM2.
cpm_uart_allocbuf() only has a small difference between CPM1 and CPM2 as shown below:
CPM1:
if (is_con) {
/* was hostalloc but changed cause it blows away the */
/* large tlb mapping when pinning the kernel area */
mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8));
dma_addr = (u32)cpm_dpram_phys(mem_addr);
} else
mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
GFP_KERNEL);CPM2:
if (is_con) {
mem_addr = kzalloc(memsz, GFP_NOWAIT);
dma_addr = virt_to_bus(mem_addr);
}
else
mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
GFP_KERNEL);Refactor this by using IS_ENABLED(CONFIG_CPM1)
and move both functions in cpm_uart_core.c as they are used only there.
While doing this, add the necessary casts to silence sparse for the CPM1 part. This is because a dma alloc is not expected to be an iomem but for CPM1 as we use DPRAM this is seen as iomem.
Also replace calls to cpm_dpxxxx() by relevant cpm_muram_xxxx() calls. This is needed at least for cpm_dpram_phys() which is only defined for CPM1. Just do the same for all so that cpm_dpxxxx() macros can get droped in the future.
To silence checkpatch, replace printk(KERN_ERR by pr_err( and display function name instead of hard coded filename. Also replace mem_addr == NULL by !mem_addr.
--- drivers/tty/serial/cpm_uart/cpm_uart.h | 2 - drivers/tty/serial/cpm_uart/cpm_uart_core.c | 72 +++++++++++++++++++++ drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 69 -------------------- drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 69 -------------------- 4 files changed, 72 insertions(+), 140 deletions(-)
drivers/tty/serial/cpm_uart/cpm_uart.h +0 -2
@@ -79,8 +79,6 @@ struct uart_cpm_port {void __iomem *cpm_uart_map_pram (struct uart_cpm_port *port,struct device_node *np);void cpm_uart_unmap_pram (struct uart_cpm_port *port,void __iomem *pram); -int cpm_uart_allocbuf (struct uart_cpm_port *pinfo,unsigned int is_con); -void cpm_uart_freebuf (struct uart_cpm_port *pinfo);/* virtual to phys transtalion
drivers/tty/serial/cpm_uart/cpm_uart_core.c +72 -0
78 lines not on this page · raw message
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c +0 -69
72 lines not on this page · raw message
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c +0 -69
72 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH 8/12 serial: cpm_uart: Refactor cpm_uart_[un]map_pram()
In reply to Christophe Leroycpm_uart_map_pram() and cpm_uart_unmap_pram() are very similar for CPM1 and CPM2.
On CPM1 cpm_uart_map_pram() uses of_iomap() while CPM2 uses of_address_to_resource()/ioremap(). CPM2 version will also work on CPM1.
On CPM2 cpm_uart_map_pram() and cpm_uart_unmap_pram() has a special handling for SMC. Just gate it by an IS_ENABLED(CONFIG_CPM2).
So move the CPM2 version into cpm_uart_core.c which is the only user of those two fonctions and refactor to also handle CPM1 as mentionned above.
PROFF_SMC_SIZE is only defined for SMC2 and used only there. To make it simple, just use the numerical value 64, this is the only place it is used and anyway there's already the same numerical value for the alignment.
Use cpm_muram_alloc() instead of cpm_dpalloc() macro.
Then cpm_uart_cpm1.c and cpm_uart_cpm2.c are now empty and go away.
Replace printk(KERN_WARN by pr_warn( to make checkpatch happier.
--- drivers/tty/serial/cpm_uart/Makefile | 8 +- drivers/tty/serial/cpm_uart/cpm_uart.h | 5 -- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 48 ++++++++++++ drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 48 ------------ drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 82 --------------------- 5 files changed, 49 insertions(+), 142 deletions(-) delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c delete mode 100644 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
drivers/tty/serial/cpm_uart/Makefile +1 -7
@@ -3,10 +3,4 @@ # Makefile for the Motorola 8xx FEC ethernet controller # -obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o - -# Select the correct platform objects. -cpm_uart-objs-$(CONFIG_CPM2) += cpm_uart_cpm2.o -cpm_uart-objs-$(CONFIG_CPM1) += cpm_uart_cpm1.o - -cpm_uart-objs := cpm_uart_core.o $(cpm_uart-objs-y) +obj-$(CONFIG_SERIAL_CPM) += cpm_uart_core.o
drivers/tty/serial/cpm_uart/cpm_uart.h +0 -5
@@ -75,11 +75,6 @@ struct uart_cpm_port {struct gpio_desc *gpios[NUM_GPIOS ]; }; -/* these are located in their respective files */ -void __iomem *cpm_uart_map_pram (struct uart_cpm_port *port, -struct device_node *np); -void cpm_uart_unmap_pram (struct uart_cpm_port *port,void __iomem *pram); -/* virtual to phys transtalion */
drivers/tty/serial/cpm_uart/cpm_uart_core.c +48 -0
54 lines not on this page · raw message
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c deleted +0 -48
48 lines not on this page · raw message
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c deleted +0 -82
82 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH 9/12 serial: cpm_uart: Remove cpm_uart/ subdirectory
In reply to Christophe Leroycpm_uart/ subdirectory only has cpm_uart_core.c and cpm_uart.h now.
Move them up and remove cpm_uart/ directory while renaming cpm_uart_core.c as cpm_uart.c
---
drivers/tty/serial/Makefile | 2 +-
drivers/tty/serial/{cpm_uart/cpm_uart_core.c => cpm_uart.c} | 0
drivers/tty/serial/{cpm_uart => }/cpm_uart.h | 0
drivers/tty/serial/cpm_uart/Makefile | 6 ------
4 files changed, 1 insertion(+), 7 deletions(-)
rename drivers/tty/serial/{cpm_uart/cpm_uart_core.c => cpm_uart.c} (100%)
rename drivers/tty/serial/{cpm_uart => }/cpm_uart.h (100%)
delete mode 100644 drivers/tty/serial/cpm_uart/Makefiledrivers/tty/serial/Makefile +1 -1
@@ -41,7 +41,7 @@ obj-$(CONFIG_SERIAL_HS_LPC32XX) += lpc32xx_hs.o obj-$(CONFIG_SERIAL_DZ) += dz.o obj-$(CONFIG_SERIAL_ZS) += zs.o obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o -obj-$(CONFIG_SERIAL_CPM) += cpm_uart/ +obj-$(CONFIG_SERIAL_CPM) += cpm_uart.o obj-$(CONFIG_SERIAL_IMX) += imx.o obj-$(CONFIG_SERIAL_IMX_EARLYCON) += imx_earlycon.o obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o
drivers/tty/serial/cpm_uart.c renamed from drivers/tty/serial/cpm_uart/cpm_uart_core.c +0 -0
drivers/tty/serial/cpm_uart.h renamed from drivers/tty/serial/cpm_uart/cpm_uart.h +0 -0
drivers/tty/serial/cpm_uart/Makefile deleted +0 -6
@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the Motorola 8xx FEC ethernet controller -# - -obj-$(CONFIG_SERIAL_CPM) += cpm_uart_core.o
Signature · 1 line
2.41.0
PATCH 10/12 serial: cpm_uart: Remove stale prototype in powerpc/fsl_soc.c
In reply to Christophe LeroyCommit 0b5cf10691eb ("[POWERPC] 8xx: Convert mpc866ads to the new device binding.") removed last definition of init_smc_ioports().
Remove it.
And don't include anymore fs_uart_pd.h which is only included to provide fs_uart_platform_info structure.
--- arch/powerpc/sysdev/fsl_soc.c | 2 -- 1 file changed, 2 deletions(-)
arch/powerpc/sysdev/fsl_soc.c +0 -2
@@ -23,7 +23,6 @@#include <linux/spi/spi.h> #include <linux/fsl_devices.h> #include <linux/fs_enet_pd.h> -#include <linux/fs_uart_pd.h> #include <linux/reboot.h> #include <linux/atomic.h>
@@ -38,7 +37,6 @@extern void init_fcc_ioports (struct fs_platform_info *);extern void init_fec_ioports (struct fs_platform_info *); -extern void init_smc_ioports (struct fs_uart_platform_info *);static phys_addr_t immrbase =-1 ;phys_addr_t get_immrbase (void )
Signature · 1 line
2.41.0
PATCH 11/12 serial: cpm_uart: Don't include fs_uart_pd.h when not needed
In reply to Christophe LeroyRemove inclusion of fs_uart_pd.h from all files not using anything from that file.
--- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 1 - arch/powerpc/platforms/8xx/tqm8xx_setup.c | 1 - drivers/tty/serial/ucc_uart.c | 1 - 3 files changed, 3 deletions(-)
arch/powerpc/platforms/8xx/mpc885ads_setup.c +0 -1
@@ -22,7 +22,6 @@#include <linux/delay.h> #include <linux/fs_enet_pd.h> -#include <linux/fs_uart_pd.h> #include <linux/fsl_devices.h> #include <linux/mii.h> #include <linux/of_address.h>
arch/powerpc/platforms/8xx/tqm8xx_setup.c +0 -1
@@ -25,7 +25,6 @@#include <linux/delay.h> #include <linux/fs_enet_pd.h> -#include <linux/fs_uart_pd.h> #include <linux/fsl_devices.h> #include <linux/mii.h> #include <linux/of_fdt.h>
drivers/tty/serial/ucc_uart.c +0 -1
@@ -28,7 +28,6 @@#include <linux/of_platform.h> #include <linux/dma-mapping.h> -#include <linux/fs_uart_pd.h> #include <soc/fsl/qe/ucc_slow.h> #include <linux/firmware.h>
Signature · 1 line
2.41.0
PATCH 12/12 serial: cpm_uart: Remove linux/fs_uart_pd.h
In reply to Christophe Leroylinux/fs_uart_pd.h is not used anymore. Remove it.
--- include/linux/fs_uart_pd.h | 71 -------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 include/linux/fs_uart_pd.h
include/linux/fs_uart_pd.h deleted +0 -71
@@ -1,71 +0,0 @@ -/* -* Platform information definitions for the CPM Uart driver. -* -* 2006 (c) MontaVista Software, Inc. -* Vitaly Bordug <[email protected]> -* -* This file is licensed under the terms of the GNU General Public License -* version 2. This program is licensed "as is" without any warranty of any -* kind, whether express or implied. -*/ - -#ifndef FS_UART_PD_H -#define FS_UART_PD_H - -#include <asm/types.h> - -enum fs_uart_id { - fsid_smc1_uart, - fsid_smc2_uart, - fsid_scc1_uart, - fsid_scc2_uart, - fsid_scc3_uart, - fsid_scc4_uart, - fs_uart_nr, -}; - -static inline int fs_uart_id_scc2fsid (int id) -{ -return fsid_scc1_uart + id -1 ; -} - -static inline int fs_uart_id_fsid2scc (int id) -{ -return id - fsid_scc1_uart +1 ; -} - -static inline int fs_uart_id_smc2fsid (int id) -{ -return fsid_smc1_uart + id -1 ; -} - -static inline int fs_uart_id_fsid2smc (int id) -{ -return id - fsid_smc1_uart +1 ; -} - -struct fs_uart_platform_info { -void (*init_ioports)(struct fs_uart_platform_info *); -/* device specific information */ -int fs_no;/* controller index */ -char fs_type[4 ];/* controller type */ -u32 uart_clk; -u8 tx_num_fifo; -u8 tx_buf_size; -u8 rx_num_fifo; -u8 rx_buf_size; -u8 brg; -u8 clk_rx; -u8 clk_tx; -}; - -static inline int fs_uart_get_id (struct fs_uart_platform_info *fpi) -{ -if (strstr (fpi->fs_type,"SMC" )) -return fs_uart_id_smc2fsid (fpi->fs_no); -if (strstr (fpi->fs_type,"SCC" )) -return fs_uart_id_scc2fsid (fpi->fs_no); -return fpi->fs_no; -} - -#endif
Signature · 1 line
2.41.0