linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] tty/serial: atmel_serial: add device tree support
Date: Tue, 4 Oct 2011 10:52:26 -0600	[thread overview]
Message-ID: <20111004165226.GA10919@ponder.secretlab.ca> (raw)
In-Reply-To: <4E8A6858.6020700@gmail.com>

On Mon, Oct 03, 2011 at 08:58:48PM -0500, Rob Herring wrote:
> On 10/03/2011 04:51 AM, Nicolas Ferre wrote:
> >  static int __devinit atmel_serial_probe(struct platform_device *pdev)
> >  {
> >  	struct atmel_uart_port *port;
> > +	struct device_node *np = pdev->dev.of_node;
> >  	struct atmel_uart_data *pdata = pdev->dev.platform_data;
> >  	void *data;
> >  	int ret;
> >  
> >  	BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1));
> >  
> > -	port = &atmel_ports[pdata->num];
> > +	if (np) {
> > +		ret = of_alias_get_id(np, "serial");
> > +		if (ret < 0)
> > +			goto err;
> 
> I'll defer to Grant on this. There aren't any other drivers using this.
> 

This is the correct thing to do.

One note however; I prefer driver to *not* require an alias to be
present.  By all means, use an alias if it is available, but the
driver should auto-enumerate if it is not.  There is a patch that
makes of_alias_get_id() do this for you, but it hasn't been mainlined
yet and it is still a bit in flux.  There will be something that takes
care of this for you, but be aware that the function name may change.

In the mean time, this patch is okay.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

g.

  parent reply	other threads:[~2011-10-04 16:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03  9:51 [RFC PATCH] tty/serial: atmel_serial: add device tree support Nicolas Ferre
2011-10-04  1:58 ` Rob Herring
2011-10-04  8:18   ` Nicolas Ferre
2011-10-04 13:08     ` Rob Herring
2011-10-04 16:55       ` Grant Likely
2011-10-11 16:04         ` Nicolas Ferre
2011-10-04 16:52   ` Grant Likely [this message]
2011-10-12 15:35     ` Nicolas Ferre

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=20111004165226.GA10919@ponder.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --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).