From: Vineet Gupta <Vineet.Gupta1@synopsys.com> To: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>, "Mark Rutland" <mark.rutland@arm.com>, Ian Campbell <ijc+devicetree@hellion.org.uk>, Kumar Gala <galak@codeaurora.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jslaby@suse.cz>, Paul Bolle <pebolle@tiscali.nl> Cc: <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>, <Francois.Bedard@synopsys.com>, Vineet Gupta <Vineet.Gupta1@synopsys.com> Subject: [PATCH v2 REBASED 07/10] serial/arc: inline the probe helper Date: Tue, 24 Jun 2014 13:55:12 +0530 [thread overview] Message-ID: <1403598315-1429-8-git-send-email-vgupta@synopsys.com> (raw) In-Reply-To: <1403598315-1429-1-git-send-email-vgupta@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <Vineet.Gupta1@synopsys.com> To: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>, Mark Rutland <mark.rutland@arm.com>, Ian Campbell <ijc+devicetree@hellion.org.uk>, Kumar Gala <galak@codeaurora.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jslaby@suse.cz>, Paul Bolle <pebolle@tiscali.nl> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Francois.Bedard@synopsys.com, Vineet Gupta <Vineet.Gupta1@synopsys.com> Subject: [PATCH v2 REBASED 07/10] serial/arc: inline the probe helper Date: Tue, 24 Jun 2014 13:55:12 +0530 [thread overview] Message-ID: <1403598315-1429-8-git-send-email-vgupta@synopsys.com> (raw) In-Reply-To: <1403598315-1429-1-git-send-email-vgupta@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> --- 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
next prev parent reply other threads:[~2014-06-24 8:27 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-06-24 8:25 [PATCH v2 REBASED 00/10] Generic earlyconsole for ARC UART Driver Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 01/10] serial/arc: use uart_console_write() helper Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 02/10] serial/arc: Refactor by referencing to uart_port where possible Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 03/10] serial/arc: Remove the workaround for legacy ISS Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 04/10] serial/arc: Use generic earlycon infrastructure Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 05/10] serial/arc: remove earlyprintk support and switch to earlycon Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 06/10] serial/arc: remove last remanants of platform data Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 21:01 ` Rob Herring 2014-06-25 4:38 ` Vineet Gupta 2014-07-05 20:54 ` Rob Herring 2014-06-24 8:25 ` Vineet Gupta [this message] 2014-06-24 8:25 ` [PATCH v2 REBASED 07/10] serial/arc: inline the probe helper Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 08/10] ARC: [arcfpga] RIP early uart platform device stuff Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 09/10] serial/arc: Enable DT based earlycon Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 8:25 ` [PATCH v2 REBASED 10/10] ARC: [arcfpga] stdout-path now suffices for earlycon/console Vineet Gupta 2014-06-24 8:25 ` Vineet Gupta 2014-06-24 21:05 ` [PATCH v2 REBASED 00/10] Generic earlyconsole for ARC UART Driver Rob Herring 2014-07-04 7:05 ` Vineet Gupta 2014-07-04 7:05 ` Vineet Gupta 2014-07-10 0:40 ` Greg Kroah-Hartman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1403598315-1429-8-git-send-email-vgupta@synopsys.com \ --to=vineet.gupta1@synopsys.com \ --cc=Francois.Bedard@synopsys.com \ --cc=devicetree@vger.kernel.org \ --cc=galak@codeaurora.org \ --cc=gregkh@linuxfoundation.org \ --cc=ijc+devicetree@hellion.org.uk \ --cc=jslaby@suse.cz \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-serial@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=pawel.moll@arm.com \ --cc=pebolle@tiscali.nl \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.