mirror of https://gitee.com/openkylin/linux.git
[POWERPC] mpc5200: Cleanup checkpatch.pl problems in mpc52xx_uart.c
In preparation of adding MPC5121 support cleanup some things that checkpatch.pl complains about also some minor fixes suggested by Stephen Rothwell. Signed-off-by: John Rigby <jrigby@freescale.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
94f389485e
commit
406b7d4f7b
|
@ -68,8 +68,8 @@
|
|||
#include <linux/sysrq.h>
|
||||
#include <linux/console.h>
|
||||
|
||||
#include <asm/delay.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#if defined(CONFIG_PPC_MERGE)
|
||||
#include <linux/of.h>
|
||||
|
@ -122,7 +122,8 @@ static irqreturn_t mpc52xx_uart_int(int irq,void *dev_id);
|
|||
/* Simple macro to test if a port is console or not. This one is taken
|
||||
* for serial_core.c and maybe should be moved to serial_core.h ? */
|
||||
#ifdef CONFIG_SERIAL_CORE_CONSOLE
|
||||
#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
|
||||
#define uart_console(port) \
|
||||
((port)->cons && (port)->cons->index == (port)->line)
|
||||
#else
|
||||
#define uart_console(port) (0)
|
||||
#endif
|
||||
|
@ -367,7 +368,8 @@ mpc52xx_uart_type(struct uart_port *port)
|
|||
static void
|
||||
mpc52xx_uart_release_port(struct uart_port *port)
|
||||
{
|
||||
if (port->flags & UPF_IOREMAP) { /* remapped by us ? */
|
||||
/* remapped by us ? */
|
||||
if (port->flags & UPF_IOREMAP) {
|
||||
iounmap(port->membase);
|
||||
port->membase = NULL;
|
||||
}
|
||||
|
@ -401,8 +403,8 @@ mpc52xx_uart_request_port(struct uart_port *port)
|
|||
static void
|
||||
mpc52xx_uart_config_port(struct uart_port *port, int flags)
|
||||
{
|
||||
if ( (flags & UART_CONFIG_TYPE) &&
|
||||
(mpc52xx_uart_request_port(port) == 0) )
|
||||
if ((flags & UART_CONFIG_TYPE)
|
||||
&& (mpc52xx_uart_request_port(port) == 0))
|
||||
port->type = PORT_MPC52xx;
|
||||
}
|
||||
|
||||
|
@ -619,11 +621,18 @@ mpc52xx_console_get_options(struct uart_port *port,
|
|||
|
||||
/* Parse them */
|
||||
switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) {
|
||||
case MPC52xx_PSC_MODE_5_BITS: *bits = 5; break;
|
||||
case MPC52xx_PSC_MODE_6_BITS: *bits = 6; break;
|
||||
case MPC52xx_PSC_MODE_7_BITS: *bits = 7; break;
|
||||
case MPC52xx_PSC_MODE_5_BITS:
|
||||
*bits = 5;
|
||||
break;
|
||||
case MPC52xx_PSC_MODE_6_BITS:
|
||||
*bits = 6;
|
||||
break;
|
||||
case MPC52xx_PSC_MODE_7_BITS:
|
||||
*bits = 7;
|
||||
break;
|
||||
case MPC52xx_PSC_MODE_8_BITS:
|
||||
default: *bits = 8;
|
||||
default:
|
||||
*bits = 8;
|
||||
}
|
||||
|
||||
if (mr1 & MPC52xx_PSC_MODE_PARNONE)
|
||||
|
@ -736,13 +745,15 @@ mpc52xx_console_setup(struct console *co, char *options)
|
|||
co->index, mpc52xx_uart_nodes[co->index]->full_name);
|
||||
|
||||
/* Fetch register locations */
|
||||
if ((ret = of_address_to_resource(np, 0, &res)) != 0) {
|
||||
ret = of_address_to_resource(np, 0, &res);
|
||||
if (ret) {
|
||||
pr_debug("Could not get resources for PSC%x\n", co->index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Search for bus-frequency property in this node or a parent */
|
||||
if ((ipb_freq = mpc52xx_find_ipb_freq(np)) == 0) {
|
||||
ipb_freq = mpc52xx_find_ipb_freq(np);
|
||||
if (ipb_freq == 0) {
|
||||
pr_debug("Could not find IPB bus frequency!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -760,7 +771,8 @@ mpc52xx_console_setup(struct console *co, char *options)
|
|||
return -EINVAL;
|
||||
|
||||
pr_debug("mpc52xx-psc uart at %p, mapped to %p, irq=%x, freq=%i\n",
|
||||
(void*)port->mapbase, port->membase, port->irq, port->uartclk);
|
||||
(void *)port->mapbase, port->membase,
|
||||
port->irq, port->uartclk);
|
||||
|
||||
/* Setup the port parameters accoding to options */
|
||||
if (options)
|
||||
|
@ -812,7 +824,6 @@ console_initcall(mpc52xx_console_init);
|
|||
/* ======================================================================== */
|
||||
|
||||
static struct uart_driver mpc52xx_uart_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.driver_name = "mpc52xx_psc_uart",
|
||||
.dev_name = "ttyPSC",
|
||||
.major = SERIAL_PSC_MAJOR,
|
||||
|
@ -920,6 +931,7 @@ static struct platform_driver mpc52xx_uart_platform_driver = {
|
|||
.resume = mpc52xx_uart_resume,
|
||||
#endif
|
||||
.driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "mpc52xx-psc",
|
||||
},
|
||||
};
|
||||
|
@ -952,7 +964,8 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
|
|||
mpc52xx_uart_nodes[idx]->full_name, idx);
|
||||
|
||||
/* Search for bus-frequency property in this node or a parent */
|
||||
if ((ipb_freq = mpc52xx_find_ipb_freq(op->node)) == 0) {
|
||||
ipb_freq = mpc52xx_find_ipb_freq(op->node);
|
||||
if (ipb_freq == 0) {
|
||||
dev_dbg(&op->dev, "Could not find IPB bus frequency!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -971,7 +984,8 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
|
|||
port->dev = &op->dev;
|
||||
|
||||
/* Search for IRQ and mapbase */
|
||||
if ((ret = of_address_to_resource(op->node, 0, &res)) != 0)
|
||||
ret = of_address_to_resource(op->node, 0, &res);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
port->mapbase = res.start;
|
||||
|
@ -1051,6 +1065,7 @@ mpc52xx_uart_of_assign(struct device_node *np, int idx)
|
|||
if (idx < 0)
|
||||
return; /* No free slot; abort */
|
||||
|
||||
of_node_get(np);
|
||||
/* If the slot is already occupied, then swap slots */
|
||||
if (mpc52xx_uart_nodes[idx] && (free_idx != -1))
|
||||
mpc52xx_uart_nodes[free_idx] = mpc52xx_uart_nodes[idx];
|
||||
|
@ -1060,7 +1075,7 @@ mpc52xx_uart_of_assign(struct device_node *np, int idx)
|
|||
static void
|
||||
mpc52xx_uart_of_enumerate(void)
|
||||
{
|
||||
static int enum_done = 0;
|
||||
static int enum_done;
|
||||
struct device_node *np;
|
||||
const unsigned int *devno;
|
||||
int i;
|
||||
|
@ -1074,7 +1089,7 @@ mpc52xx_uart_of_enumerate(void)
|
|||
|
||||
/* Is a particular device number requested? */
|
||||
devno = of_get_property(np, "port-number", NULL);
|
||||
mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1);
|
||||
mpc52xx_uart_of_assign(np, devno ? *devno : -1);
|
||||
}
|
||||
|
||||
enum_done = 1;
|
||||
|
@ -1089,8 +1104,6 @@ mpc52xx_uart_of_enumerate(void)
|
|||
MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
|
||||
|
||||
static struct of_platform_driver mpc52xx_uart_of_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "mpc52xx-psc-uart",
|
||||
.match_table = mpc52xx_uart_of_match,
|
||||
.probe = mpc52xx_uart_of_probe,
|
||||
.remove = mpc52xx_uart_of_remove,
|
||||
|
@ -1116,7 +1129,8 @@ mpc52xx_uart_init(void)
|
|||
|
||||
printk(KERN_INFO "Serial: MPC52xx PSC UART driver\n");
|
||||
|
||||
if ((ret = uart_register_driver(&mpc52xx_uart_driver)) != 0) {
|
||||
ret = uart_register_driver(&mpc52xx_uart_driver);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "%s: uart_register_driver failed (%i)\n",
|
||||
__FILE__, ret);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue