From: miquel.raynal@free-electrons.com (Miquel RAYNAL)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 04/16] serial: mvebu-uart: support probe of multiple ports
Date: Fri, 13 Oct 2017 13:17:11 +0200 [thread overview]
Message-ID: <20171013131711.4ef63ea0@xps13> (raw)
In-Reply-To: <877evz9yi7.fsf@free-electrons.com>
Hi Gregory,
On Fri, 13 Oct 2017 11:40:32 +0200
Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:
> Hi Miquel,
>
> On ven., oct. 13 2017, Miquel Raynal
> <miquel.raynal@free-electrons.com> wrote:
>
> > - port = &mvebu_uart_ports[0];
> > + /* Assume that all UART ports have a DT alias or none has
> > */
> > + id = of_alias_get_id(pdev->dev.of_node, "serial");
>
> You stil need to check the pdev->dev.of_node before calling
> of_alias_get_id.
Thanks for your feedback but I don't think we still need to check it,
because the of_alias_get_id() function will either return -ENOSYS if
CONFIG_OF is not defined, or -ENODEV if the node is not found. As the
function does not dereference pdev->dev.of_node at any moment but
instead compares the value with another pointer, I think this call is
safe like this.
Thanks,
Miqu?l
>
> Once it will be fixed, you can add:
>
> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
>
> Thanks,
>
> Gregory
>
>
> > + if (!pdev->dev.of_node || id < 0)
> > + pdev->id = uart_num_counter++;
> > + else
> > + pdev->id = id;
> > +
> > + if (pdev->id >= MVEBU_NR_UARTS) {
> > + dev_err(&pdev->dev, "cannot have more than %d UART
> > ports\n",
> > + MVEBU_NR_UARTS);
> > + return -EINVAL;
> > + }
> > +
> > + port = &mvebu_uart_ports[pdev->id];
> >
> > spin_lock_init(&port->lock);
> >
> > @@ -572,7 +588,7 @@ static int mvebu_uart_probe(struct
> > platform_device *pdev) port->fifosize = 32;
> > port->iotype = UPIO_MEM32;
> > port->flags = UPF_FIXED_PORT;
> > - port->line = 0; /* single port: force line number
> > to 0 */
> > + port->line = pdev->id;
> >
> > port->irq = irq->start;
> > port->irqflags = 0;
> > --
> > 2.11.0
> >
>
--
Miquel Raynal, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2017-10-13 11:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 9:01 [PATCH v2 00/16] Support armada-37xx second UART port Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 01/16] dt-bindings: mvebu-uart: update documentation with extended UART Miquel Raynal
2017-10-17 22:00 ` Rob Herring
2017-10-18 6:25 ` Miquel RAYNAL
2017-10-18 13:29 ` Rob Herring
2017-10-19 7:36 ` Miquel RAYNAL
2017-10-13 9:01 ` [PATCH v2 02/16] pinctrl: dt-bindings: Fix A37xx uart2 group name Miquel Raynal
2017-10-16 11:56 ` Linus Walleij
2017-10-13 9:01 ` [PATCH v2 03/16] serial: mvebu-uart: use driver name when requesting an interrupt Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 04/16] serial: mvebu-uart: support probe of multiple ports Miquel Raynal
2017-10-13 9:40 ` Gregory CLEMENT
2017-10-13 11:17 ` Miquel RAYNAL [this message]
2017-10-13 11:22 ` Gregory CLEMENT
2017-10-13 9:01 ` [PATCH v2 05/16] serial: mvebu-uart: use a generic way to access the registers Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 06/16] serial: mvebu-uart: add soft reset at probe Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 07/16] serial: mvebu-uart: add function to change baudrate Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 08/16] serial: mvebu-uart: clear state register before IRQ request Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 09/16] serial: mvebu-uart: add TX interrupt trigger for pulse interrupts Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 10/16] serial: mvebu-uart: dissociate RX and TX interrupts Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 11/16] serial: mvebu-uart: augment the maximum number of ports Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 12/16] serial: mvebu-uart: support extended port registers layout Miquel Raynal
2017-10-13 9:01 ` [PATCH v2 13/16] arm64: dts: marvell: armada-37xx: add UART clock Miquel Raynal
2017-10-30 15:45 ` Gregory CLEMENT
2017-10-13 9:01 ` [PATCH v2 14/16] arm64: dts: marvell: armada-37xx: add second UART port Miquel Raynal
2017-10-30 15:45 ` Gregory CLEMENT
2017-10-13 9:01 ` [PATCH v2 15/16] arm64: dts: marvell: armada-3720-db: enable " Miquel Raynal
2017-10-30 15:46 ` Gregory CLEMENT
2017-10-13 9:02 ` [PATCH v2 16/16] arm64: dts: marvell: armada-3720-espressobin: fill UART nodes Miquel Raynal
2017-10-30 15:46 ` Gregory CLEMENT
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=20171013131711.4ef63ea0@xps13 \
--to=miquel.raynal@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).