From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbaFXI1M (ORCPT ); Tue, 24 Jun 2014 04:27:12 -0400 Received: from smtprelay4.synopsys.com ([198.182.44.111]:53718 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752534AbaFXI1J (ORCPT ); Tue, 24 Jun 2014 04:27:09 -0400 From: Vineet Gupta To: Rob Herring , Pawel Moll , "Mark Rutland" , Ian Campbell , Kumar Gala , Greg Kroah-Hartman , Jiri Slaby , Paul Bolle CC: , , , , Vineet Gupta Subject: [PATCH v2 REBASED 07/10] serial/arc: inline the probe helper Date: Tue, 24 Jun 2014 13:55:12 +0530 Message-ID: <1403598315-1429-8-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1403598315-1429-1-git-send-email-vgupta@synopsys.com> References: <1403598315-1429-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.12.196.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Vineet Gupta --- drivers/tty/serial/arc_uart.c | 90 +++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index dc3d5db37dc4..435de4f2af3b 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c @@ -496,50 +496,6 @@ static struct uart_ops arc_serial_pops = { #endif }; -static int -arc_uart_init_one(struct platform_device *pdev, int dev_id) -{ - struct device_node *np = pdev->dev.of_node; - struct arc_uart_port *uart = &arc_uart_ports[dev_id]; - struct uart_port *port = &uart->port; - u32 val; - - if (of_property_read_u32(np, "clock-frequency", &val)) { - dev_err(&pdev->dev, "clock-frequency property NOTset\n"); - return -EINVAL; - } - port->uartclk = val; - - if (of_property_read_u32(np, "current-speed", &val)) { - dev_err(&pdev->dev, "current-speed property NOT set\n"); - return -EINVAL; - } - uart->baud = val; - - port->membase = of_iomap(np, 0); - if (!port->membase) - /* No point of dev_err since UART itself is hosed here */ - return -ENXIO; - - port->irq = irq_of_parse_and_map(np, 0); - - port->dev = &pdev->dev; - port->iotype = UPIO_MEM; - port->flags = UPF_BOOT_AUTOCONF; - port->line = dev_id; - port->ops = &arc_serial_pops; - - port->fifosize = ARC_UART_TX_FIFO_SIZE; - - /* - * uart_insert_char( ) uses it in decideding whether to ignore a - * char or not. Explicitly setting it here, removes the subtelty - */ - port->ignore_status_mask = 0; - - return 0; -} - #ifdef CONFIG_SERIAL_ARC_CONSOLE static int arc_serial_console_setup(struct console *co, char *options) @@ -628,8 +584,11 @@ EARLYCON_DECLARE(arc_uart, arc_early_console_setup); static int arc_serial_probe(struct platform_device *pdev) { - int rc, dev_id; struct device_node *np = pdev->dev.of_node; + struct arc_uart_port *uart; + struct uart_port *port; + int dev_id; + u32 val; /* no device tree device */ if (!np) @@ -639,12 +598,43 @@ static int arc_serial_probe(struct platform_device *pdev) if (dev_id < 0) dev_id = 0; - rc = arc_uart_init_one(pdev, dev_id); - if (rc) - return rc; + uart = &arc_uart_ports[dev_id]; + port = &uart->port; + + if (of_property_read_u32(np, "clock-frequency", &val)) { + dev_err(&pdev->dev, "clock-frequency property NOTset\n"); + return -EINVAL; + } + port->uartclk = val; + + if (of_property_read_u32(np, "current-speed", &val)) { + dev_err(&pdev->dev, "current-speed property NOT set\n"); + return -EINVAL; + } + uart->baud = val; + + port->membase = of_iomap(np, 0); + if (!port->membase) + /* No point of dev_err since UART itself is hosed here */ + return -ENXIO; + + port->irq = irq_of_parse_and_map(np, 0); + + port->dev = &pdev->dev; + port->iotype = UPIO_MEM; + port->flags = UPF_BOOT_AUTOCONF; + port->line = dev_id; + port->ops = &arc_serial_pops; + + port->fifosize = ARC_UART_TX_FIFO_SIZE; + + /* + * uart_insert_char( ) uses it in decideding whether to ignore a + * char or not. Explicitly setting it here, removes the subtelty + */ + port->ignore_status_mask = 0; - rc = uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); - return rc; + return uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); } static int arc_serial_remove(struct platform_device *pdev) -- 1.8.3.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet Gupta Subject: [PATCH v2 REBASED 07/10] serial/arc: inline the probe helper Date: Tue, 24 Jun 2014 13:55:12 +0530 Message-ID: <1403598315-1429-8-git-send-email-vgupta@synopsys.com> References: <1403598315-1429-1-git-send-email-vgupta@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1403598315-1429-1-git-send-email-vgupta@synopsys.com> Sender: linux-kernel-owner@vger.kernel.org To: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Greg Kroah-Hartman , Jiri Slaby , Paul Bolle Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Francois.Bedard@synopsys.com, Vineet Gupta List-Id: devicetree@vger.kernel.org Signed-off-by: Vineet Gupta --- drivers/tty/serial/arc_uart.c | 90 +++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index dc3d5db37dc4..435de4f2af3b 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c @@ -496,50 +496,6 @@ static struct uart_ops arc_serial_pops = { #endif }; -static int -arc_uart_init_one(struct platform_device *pdev, int dev_id) -{ - struct device_node *np = pdev->dev.of_node; - struct arc_uart_port *uart = &arc_uart_ports[dev_id]; - struct uart_port *port = &uart->port; - u32 val; - - if (of_property_read_u32(np, "clock-frequency", &val)) { - dev_err(&pdev->dev, "clock-frequency property NOTset\n"); - return -EINVAL; - } - port->uartclk = val; - - if (of_property_read_u32(np, "current-speed", &val)) { - dev_err(&pdev->dev, "current-speed property NOT set\n"); - return -EINVAL; - } - uart->baud = val; - - port->membase = of_iomap(np, 0); - if (!port->membase) - /* No point of dev_err since UART itself is hosed here */ - return -ENXIO; - - port->irq = irq_of_parse_and_map(np, 0); - - port->dev = &pdev->dev; - port->iotype = UPIO_MEM; - port->flags = UPF_BOOT_AUTOCONF; - port->line = dev_id; - port->ops = &arc_serial_pops; - - port->fifosize = ARC_UART_TX_FIFO_SIZE; - - /* - * uart_insert_char( ) uses it in decideding whether to ignore a - * char or not. Explicitly setting it here, removes the subtelty - */ - port->ignore_status_mask = 0; - - return 0; -} - #ifdef CONFIG_SERIAL_ARC_CONSOLE static int arc_serial_console_setup(struct console *co, char *options) @@ -628,8 +584,11 @@ EARLYCON_DECLARE(arc_uart, arc_early_console_setup); static int arc_serial_probe(struct platform_device *pdev) { - int rc, dev_id; struct device_node *np = pdev->dev.of_node; + struct arc_uart_port *uart; + struct uart_port *port; + int dev_id; + u32 val; /* no device tree device */ if (!np) @@ -639,12 +598,43 @@ static int arc_serial_probe(struct platform_device *pdev) if (dev_id < 0) dev_id = 0; - rc = arc_uart_init_one(pdev, dev_id); - if (rc) - return rc; + uart = &arc_uart_ports[dev_id]; + port = &uart->port; + + if (of_property_read_u32(np, "clock-frequency", &val)) { + dev_err(&pdev->dev, "clock-frequency property NOTset\n"); + return -EINVAL; + } + port->uartclk = val; + + if (of_property_read_u32(np, "current-speed", &val)) { + dev_err(&pdev->dev, "current-speed property NOT set\n"); + return -EINVAL; + } + uart->baud = val; + + port->membase = of_iomap(np, 0); + if (!port->membase) + /* No point of dev_err since UART itself is hosed here */ + return -ENXIO; + + port->irq = irq_of_parse_and_map(np, 0); + + port->dev = &pdev->dev; + port->iotype = UPIO_MEM; + port->flags = UPF_BOOT_AUTOCONF; + port->line = dev_id; + port->ops = &arc_serial_pops; + + port->fifosize = ARC_UART_TX_FIFO_SIZE; + + /* + * uart_insert_char( ) uses it in decideding whether to ignore a + * char or not. Explicitly setting it here, removes the subtelty + */ + port->ignore_status_mask = 0; - rc = uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); - return rc; + return uart_add_one_port(&arc_uart_driver, &arc_uart_ports[dev_id].port); } static int arc_serial_remove(struct platform_device *pdev) -- 1.8.3.2