提交 7cd88831 编写于 作者: K Kyoungil Kim 提交者: Greg Kroah-Hartman

serial: samsung: Remove NULL checking for baud clock

Signed-off-by: NKyoungil Kim <ki0351.kim@samsung.com>
Suggested-by: NRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4a055c9c
...@@ -529,7 +529,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, ...@@ -529,7 +529,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
switch (level) { switch (level) {
case 3: case 3:
if (!IS_ERR(ourport->baudclk) && ourport->baudclk != NULL) if (!IS_ERR(ourport->baudclk))
clk_disable(ourport->baudclk); clk_disable(ourport->baudclk);
clk_disable(ourport->clk); clk_disable(ourport->clk);
...@@ -538,7 +538,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, ...@@ -538,7 +538,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
case 0: case 0:
clk_enable(ourport->clk); clk_enable(ourport->clk);
if (!IS_ERR(ourport->baudclk) && ourport->baudclk != NULL) if (!IS_ERR(ourport->baudclk))
clk_enable(ourport->baudclk); clk_enable(ourport->baudclk);
break; break;
...@@ -604,7 +604,6 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport, ...@@ -604,7 +604,6 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
char clkname[MAX_CLK_NAME_LENGTH]; char clkname[MAX_CLK_NAME_LENGTH];
int calc_deviation, deviation = (1 << 30) - 1; int calc_deviation, deviation = (1 << 30) - 1;
*best_clk = NULL;
clk_sel = (ourport->cfg->clk_sel) ? ourport->cfg->clk_sel : clk_sel = (ourport->cfg->clk_sel) ? ourport->cfg->clk_sel :
ourport->info->def_clk_sel; ourport->info->def_clk_sel;
for (cnt = 0; cnt < info->num_clks; cnt++) { for (cnt = 0; cnt < info->num_clks; cnt++) {
...@@ -613,7 +612,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport, ...@@ -613,7 +612,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
sprintf(clkname, "clk_uart_baud%d", cnt); sprintf(clkname, "clk_uart_baud%d", cnt);
clk = clk_get(ourport->port.dev, clkname); clk = clk_get(ourport->port.dev, clkname);
if (IS_ERR_OR_NULL(clk)) if (IS_ERR(clk))
continue; continue;
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
...@@ -684,7 +683,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, ...@@ -684,7 +683,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
{ {
struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
struct s3c24xx_uart_port *ourport = to_ourport(port); struct s3c24xx_uart_port *ourport = to_ourport(port);
struct clk *clk = NULL; struct clk *clk = ERR_PTR(-EINVAL);
unsigned long flags; unsigned long flags;
unsigned int baud, quot, clk_sel = 0; unsigned int baud, quot, clk_sel = 0;
unsigned int ulcon; unsigned int ulcon;
...@@ -705,7 +704,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, ...@@ -705,7 +704,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
quot = s3c24xx_serial_getclk(ourport, baud, &clk, &clk_sel); quot = s3c24xx_serial_getclk(ourport, baud, &clk, &clk_sel);
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
quot = port->custom_divisor; quot = port->custom_divisor;
if (!clk) if (IS_ERR(clk))
return; return;
/* check to see if we need to change clock source */ /* check to see if we need to change clock source */
...@@ -713,9 +712,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, ...@@ -713,9 +712,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
if (ourport->baudclk != clk) { if (ourport->baudclk != clk) {
s3c24xx_serial_setsource(port, clk_sel); s3c24xx_serial_setsource(port, clk_sel);
if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) { if (!IS_ERR(ourport->baudclk)) {
clk_disable(ourport->baudclk); clk_disable(ourport->baudclk);
ourport->baudclk = NULL; ourport->baudclk = ERR_PTR(-EINVAL);
} }
clk_enable(clk); clk_enable(clk);
...@@ -1160,6 +1159,9 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev, ...@@ -1160,6 +1159,9 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
struct uart_port *port = s3c24xx_dev_to_port(dev); struct uart_port *port = s3c24xx_dev_to_port(dev);
struct s3c24xx_uart_port *ourport = to_ourport(port); struct s3c24xx_uart_port *ourport = to_ourport(port);
if (IS_ERR(ourport->baudclk))
return -EINVAL;
return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->baudclk->name); return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->baudclk->name);
} }
...@@ -1200,6 +1202,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) ...@@ -1200,6 +1202,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
ourport->baudclk = ERR_PTR(-EINVAL);
ourport->info = ourport->drv_data->info; ourport->info = ourport->drv_data->info;
ourport->cfg = (pdev->dev.platform_data) ? ourport->cfg = (pdev->dev.platform_data) ?
(struct s3c2410_uartcfg *)pdev->dev.platform_data : (struct s3c2410_uartcfg *)pdev->dev.platform_data :
...@@ -1387,7 +1390,7 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud, ...@@ -1387,7 +1390,7 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud,
sprintf(clk_name, "clk_uart_baud%d", clk_sel); sprintf(clk_name, "clk_uart_baud%d", clk_sel);
clk = clk_get(port->dev, clk_name); clk = clk_get(port->dev, clk_name);
if (!IS_ERR(clk) && clk != NULL) if (!IS_ERR(clk))
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
else else
rate = 1; rate = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册