mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@freescale.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: <linux-kernel@vger.kernel.org>, <kernel@pengutronix.de>,
	<linux-arm-kernel@lists.infradead.org>,
	Shawn Guo <shawn.guo@linaro.org>, Alan Cox <alan@linux.intel.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Jeremy Kerr <jeremy.kerr@canonical.com>,
	Jason Liu <jason.hui@linaro.org>,
	Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH] serial/imx: propagate error from of_alias_get_id instead of using -ENODEV
Date: Thu, 15 Dec 2011 10:10:47 +0800	[thread overview]
Message-ID: <20111215021046.GD3259@S2101-09.ap.freescale.net> (raw)
In-Reply-To: <20111214203153.GB24496@pengutronix.de>

On Wed, Dec 14, 2011 at 09:31:53PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Wed, Dec 14, 2011 at 09:26:51PM +0100, Uwe Kleine-König wrote:
> > A quick look at of_alias_get_id shows that in the error case it returns
> > -ENODEV, too, but still it's better style to propagate the value as is.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Alan Cox <alan@linux.intel.com>
> > Cc: Grant Likely <grant.likely@secretlab.ca>
> > Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
> > Cc: Jason Liu <jason.hui@linaro.org>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  drivers/tty/serial/imx.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> > index 163fc90..75c159a 100644
> > --- a/drivers/tty/serial/imx.c
> > +++ b/drivers/tty/serial/imx.c
> > @@ -1301,7 +1301,7 @@ static int serial_imx_probe_dt(struct imx_port *sport,
> >  	ret = of_alias_get_id(np, "serial");
> >  	if (ret < 0) {
> >  		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> > -		return -ENODEV;
> > +		return ret;
> >  	}
> >  	sport->port.line = ret;
> >  
> One more comment on serial_imx_probe_dt:
> 
> It is used as follows:
> 
>         ret = serial_imx_probe_dt(sport, pdev);
> 	if (ret == -ENODEV)
> 		serial_imx_probe_pdata(sport, pdev);
> 
> IMHO you should distinguish here more carefully between the different
> -ENODEV cases. It's OK to call serial_imx_probe_pdata() if
> 
> 	!pdev->dev.of_node
> 
> but if
> 
> 	of_alias_get_id(np, "serial")
> 
> returns an error isn't that something that should make the probing of
> the device fail instead of relying on platform data and the device id
> that are non-existant and more or less random respectively if the device
> is instantiated by dt?
> 
Yes, agreed.  Care to send a fix for that too?

-- 
Regards,
Shawn


  reply	other threads:[~2011-12-15  2:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 20:26 Uwe Kleine-König
2011-12-14 20:31 ` Uwe Kleine-König
2011-12-15  2:10   ` Shawn Guo [this message]
2011-12-15  8:16     ` [PATCH] serial/imx: let probing fail for the dt case without a valid alias Uwe Kleine-König
2011-12-15  9:08       ` Shawn Guo
2011-12-26  1:56       ` Shawn Guo
2011-12-15  2:06 ` [PATCH] serial/imx: propagate error from of_alias_get_id instead of using -ENODEV Shawn Guo
2011-12-15  2:59 ` Jason Hui
2011-12-26  1:55 ` Shawn Guo

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=20111215021046.GD3259@S2101-09.ap.freescale.net \
    --to=shawn.guo@freescale.com \
    --cc=alan@linux.intel.com \
    --cc=grant.likely@secretlab.ca \
    --cc=jason.hui@linaro.org \
    --cc=jeremy.kerr@canonical.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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

all inboxes | Powered by JetHome®