All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kevin Hilman <khilman@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Roger Quadros <rogerq@ti.com>
Subject: Re: [PATCH v2] serial: omap: Add support for optional wake-up
Date: Thu, 24 Oct 2013 06:19:36 -0700	[thread overview]
Message-ID: <20131024131935.GV15154@atomide.com> (raw)
In-Reply-To: <20131024103300.6023FC4039D@trevor.secretlab.ca>

* Grant Likely <grant.likely@secretlab.ca> [131024 03:33]:
> On Tue, 22 Oct 2013 06:49:48 -0700, Tony Lindgren <tony@atomide.com> wrote:
> > @@ -1572,11 +1603,23 @@ static int serial_omap_probe(struct platform_device *pdev)
> >  	struct uart_omap_port	*up;
> >  	struct resource		*mem, *irq;
> >  	struct omap_uart_port_info *omap_up_info = dev_get_platdata(&pdev->dev);
> > -	int ret;
> > +	int ret, uartirq = 0, wakeirq = 0;
> >  
> > +	/* The optional wakeirq may be specified in the board dts file */
> >  	if (pdev->dev.of_node) {
> > +		uartirq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> > +		if (!uartirq)
> > +			return -EPROBE_DEFER;
> > +		wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
> >  		omap_up_info = of_get_uart_port_info(&pdev->dev);
> >  		pdev->dev.platform_data = omap_up_info;
> > +	} else {
> > +		irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > +		if (!irq) {
> > +			dev_err(&pdev->dev, "no irq resource?\n");
> > +			return -ENODEV;
> > +		}
> > +		uartirq = irq->start;
> 
> Ugh. This is such a hack. platform_get_irq() should just work for DT and
> non-DT. There is no way around it right now, but we need to get the code
> in place to resolve IRQs late so that drivers don't need these special
> cases.

Yes it's pretty messed up. I wrote something about it in the
"Getting rid of subsys_initcall usage?" thread at:

http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg13678.html

And having zero populated in the struct resource as valid IRQ is
not nice at all.

Regards,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] serial: omap: Add support for optional wake-up
Date: Thu, 24 Oct 2013 06:19:36 -0700	[thread overview]
Message-ID: <20131024131935.GV15154@atomide.com> (raw)
In-Reply-To: <20131024103300.6023FC4039D@trevor.secretlab.ca>

* Grant Likely <grant.likely@secretlab.ca> [131024 03:33]:
> On Tue, 22 Oct 2013 06:49:48 -0700, Tony Lindgren <tony@atomide.com> wrote:
> > @@ -1572,11 +1603,23 @@ static int serial_omap_probe(struct platform_device *pdev)
> >  	struct uart_omap_port	*up;
> >  	struct resource		*mem, *irq;
> >  	struct omap_uart_port_info *omap_up_info = dev_get_platdata(&pdev->dev);
> > -	int ret;
> > +	int ret, uartirq = 0, wakeirq = 0;
> >  
> > +	/* The optional wakeirq may be specified in the board dts file */
> >  	if (pdev->dev.of_node) {
> > +		uartirq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> > +		if (!uartirq)
> > +			return -EPROBE_DEFER;
> > +		wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
> >  		omap_up_info = of_get_uart_port_info(&pdev->dev);
> >  		pdev->dev.platform_data = omap_up_info;
> > +	} else {
> > +		irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > +		if (!irq) {
> > +			dev_err(&pdev->dev, "no irq resource?\n");
> > +			return -ENODEV;
> > +		}
> > +		uartirq = irq->start;
> 
> Ugh. This is such a hack. platform_get_irq() should just work for DT and
> non-DT. There is no way around it right now, but we need to get the code
> in place to resolve IRQs late so that drivers don't need these special
> cases.

Yes it's pretty messed up. I wrote something about it in the
"Getting rid of subsys_initcall usage?" thread at:

http://www.mail-archive.com/linux-i2c at vger.kernel.org/msg13678.html

And having zero populated in the struct resource as valid IRQ is
not nice at all.

Regards,

Tony

  reply	other threads:[~2013-10-24 13:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 13:49 [PATCH v2] serial: omap: Add support for optional wake-up Tony Lindgren
2013-10-22 13:49 ` Tony Lindgren
2013-10-24 10:33 ` Grant Likely
2013-10-24 10:33   ` Grant Likely
2013-10-24 13:19   ` Tony Lindgren [this message]
2013-10-24 13:19     ` Tony Lindgren
2013-11-07 18:52 ` Kevin Hilman
2013-11-07 18:52   ` Kevin Hilman
2013-11-07 19:45   ` Tony Lindgren
2013-11-07 19:45     ` Tony Lindgren
2013-11-07 19:48     ` Olof Johansson
2013-11-07 19:48       ` Olof Johansson
2013-11-07 20:01       ` Tony Lindgren
2013-11-07 20:01         ` Tony Lindgren
2013-11-07 20:27     ` Kevin Hilman
2013-11-07 20:27       ` Kevin Hilman

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=20131024131935.GV15154@atomide.com \
    --to=tony@atomide.com \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rogerq@ti.com \
    /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 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.