All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Alan Cox <alan@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v2] serial/8250_dw: use platform_get_irq() instead of platform_get_resource()
Date: Tue, 03 Mar 2015 17:26:02 +0200	[thread overview]
Message-ID: <1425396362.14897.143.camel@linux.intel.com> (raw)
In-Reply-To: <1425395474-6762-1-git-send-email-abrodkin@synopsys.com>

On Tue, 2015-03-03 at 18:11 +0300, Alexey Brodkin wrote:
> It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
> for requesting IRQ's resources any more, as they can be not ready yet in
> case of DT-booting.
> 
> platform_get_irq() instead is a recommended way for getting IRQ even if
> it was not retrieved earlier.
> 
> It also makes code simpler because we're getting "int" value right away
> and no conversion from resource to int is required.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 
>  Changes in v2:
>   * Suppress error message if platform_get_irq() returns -EPROBE_DEFER

Do we really need that message at all?

> 
> ---
>  drivers/tty/serial/8250/8250_dw.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index e601162..cda76e8 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -384,18 +384,24 @@ static int dw8250_probe(struct platform_device *pdev)
>  {
>  	struct uart_8250_port uart = {};
>  	struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +	int irq = platform_get_irq(pdev, 0);
>  	struct dw8250_data *data;
>  	int err;
>  
> -	if (!regs || !irq) {
> -		dev_err(&pdev->dev, "no registers/irq defined\n");
> +	if (!regs) {
> +		dev_err(&pdev->dev, "no registers defined\n");
>  		return -EINVAL;
>  	}
>  
> +	if (irq < 0) {
> +		if (irq != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "cannot get irq\n");
> +		return irq;
> +	}
> +
>  	spin_lock_init(&uart.port.lock);
>  	uart.port.mapbase = regs->start;
> -	uart.port.irq = irq->start;
> +	uart.port.irq = irq;
>  	uart.port.handle_irq = dw8250_handle_irq;
>  	uart.port.pm = dw8250_do_pm;
>  	uart.port.type = PORT_8250;


-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy

  reply	other threads:[~2015-03-03 15:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 15:11 [PATCH v2] serial/8250_dw: use platform_get_irq() instead of platform_get_resource() Alexey Brodkin
2015-03-03 15:26 ` Andy Shevchenko [this message]
2015-03-03 15:33   ` Alexey Brodkin
2015-03-03 15:43     ` Andy Shevchenko
2015-03-03 15:47       ` Alexey Brodkin
2015-03-03 15:59         ` Andy Shevchenko

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=1425396362.14897.143.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=alan@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.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 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.