Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: linux-serial@vger.kernel.org, Rob Herring <robh@kernel.org>
Cc: linux-mips@linux-mips.org, jringle@gridpoint.com,
	allsey87@gmail.com, Jakub Kicinski <kubakici@wp.pl>,
	Xue Liu <liuxuenetmail@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] serial: sc16is7xx: Use DT sub-nodes for UART ports
Date: Mon, 6 Aug 2018 18:21:39 +0200	[thread overview]
Message-ID: <c258d70d-5b9b-77ff-a478-2a96d510d454@suse.de> (raw)
In-Reply-To: <20180805232651.10605-1-afaerber@suse.de>

Am 06.08.2018 um 01:26 schrieb Andreas Färber:
> This is to allow using serdev.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  drivers/tty/serial/sc16is7xx.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index 243c96025053..ad7267274f65 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -1213,9 +1213,31 @@ static int sc16is7xx_probe(struct device *dev,
>  			SC16IS7XX_IOCONTROL_SRESET_BIT);
>  
>  	for (i = 0; i < devtype->nr_uart; ++i) {
> +#ifdef CONFIG_OF

Looks like this and below need to be CONFIG_OF_ADDRESS (build failure
reported for sparc).

Regards,
Andreas

> +		struct device_node *np;
> +		struct platform_device *pdev;
> +		char name[6] = "uartx";
> +#endif
> +
>  		s->p[i].line		= i;
>  		/* Initialize port data */
> +#ifdef CONFIG_OF
> +		name[4] = '0' + i;
> +		np = of_get_child_by_name(dev->of_node, name);
> +		if (IS_ERR(np)) {
> +			ret = PTR_ERR(np);
> +			goto out_ports;
> +		}
> +		pdev = of_platform_device_create(np, NULL, dev);
> +		if (IS_ERR(pdev)) {
> +			ret = PTR_ERR(pdev);
> +			goto out_ports;
> +		}
> +		platform_set_drvdata(pdev, dev_get_drvdata(dev));
> +		s->p[i].port.dev	= &pdev->dev;
> +#else
>  		s->p[i].port.dev	= dev;
> +#endif
>  		s->p[i].port.irq	= irq;
>  		s->p[i].port.type	= PORT_SC16IS7XX;
>  		s->p[i].port.fifosize	= SC16IS7XX_FIFO_SIZE;
> @@ -1271,6 +1293,9 @@ static int sc16is7xx_probe(struct device *dev,
>  	for (i--; i >= 0; i--) {
>  		uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port);
>  		clear_bit(s->p[i].port.line, &sc16is7xx_lines);
> +#ifdef CONFIG_OF
> +		of_platform_device_destroy(s->p[i].port.dev, NULL);
> +#endif
>  	}
>  
>  #ifdef CONFIG_GPIOLIB

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)

  reply	other threads:[~2018-08-06 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAL_JsqKNnfgESG6ON95D7nD8VNrcVy7-x6cGGnae_GbbGKAuPQ@mail.gmail.com>
2018-08-05 23:26 ` [RFC] serial: sc16is7xx: Use DT sub-nodes for UART ports Andreas Färber
2018-08-06 16:21   ` Andreas Färber [this message]
2018-08-10 17:34   ` Rob Herring
2018-08-10 17:45     ` Andreas Färber
2018-08-10 18:11       ` Rob Herring

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=c258d70d-5b9b-77ff-a478-2a96d510d454@suse.de \
    --to=afaerber@suse.de \
    --cc=allsey87@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jringle@gridpoint.com \
    --cc=jslaby@suse.com \
    --cc=kubakici@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=liuxuenetmail@gmail.com \
    --cc=robh@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: 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