From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756833AbbCCP0J (ORCPT ); Tue, 3 Mar 2015 10:26:09 -0500 Received: from mga02.intel.com ([134.134.136.20]:42257 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754046AbbCCP0G (ORCPT ); Tue, 3 Mar 2015 10:26:06 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,682,1418112000"; d="scan'208";a="659794308" Message-ID: <1425396362.14897.143.camel@linux.intel.com> Subject: Re: [PATCH v2] serial/8250_dw: use platform_get_irq() instead of platform_get_resource() From: Andy Shevchenko To: Alexey Brodkin Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Gupta , Alan Cox , Greg Kroah-Hartman Date: Tue, 03 Mar 2015 17:26:02 +0200 In-Reply-To: <1425395474-6762-1-git-send-email-abrodkin@synopsys.com> References: <1425395474-6762-1-git-send-email-abrodkin@synopsys.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Vineet Gupta > Cc: Alan Cox > Cc: Greg Kroah-Hartman > Cc: Andy Shevchenko > --- > > 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 Intel Finland Oy