linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Felipe Balbi <balbi@ti.com>
Cc: linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Kevin Hilman <khilman@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Roger Quadros <rogerq@ti.com>
Subject: Re: [PATCH] serial: omap: Add support for optional wake-up interrupt
Date: Fri, 18 Oct 2013 09:37:40 -0700	[thread overview]
Message-ID: <20131018163740.GP15154@atomide.com> (raw)
In-Reply-To: <20131018161916.GF18921@gimli>

* Felipe Balbi <balbi@ti.com> [131018 09:19]:
> > --- a/drivers/tty/serial/omap-serial.c
> > +++ b/drivers/tty/serial/omap-serial.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/irq.h>
> >  #include <linux/pm_runtime.h>
> >  #include <linux/of.h>
> > +#include <linux/of_irq.h>
> >  #include <linux/gpio.h>
> >  #include <linux/of_gpio.h>
> >  #include <linux/platform_data/serial-omap.h>
> > @@ -134,7 +135,7 @@ struct uart_omap_port {
> >  	struct uart_port	port;
> >  	struct uart_omap_dma	uart_dma;
> >  	struct device		*dev;
> > -
> > +	int			irqs[2];
> >  	unsigned char		ier;
> >  	unsigned char		lcr;
> >  	unsigned char		mcr;
> > @@ -176,6 +177,8 @@ struct uart_omap_port {
> >  };
> >  
> >  #define to_uart_omap_port(p)	((container_of((p), struct uart_omap_port, port)))
> > +#define omap_uartirq		(up->irqs[0])
> > +#define omap_wakeirq		(up->irqs[1])
> >  
> >  static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
> >  
> > @@ -214,10 +217,23 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up)
> >  	return pdata->get_context_loss_count(up->dev);
> >  }
> >  
> > +static inline void serial_omap_enable_wakeirq(struct uart_omap_port *up,
> > +				       bool enable)
> > +{
> > +	if (!omap_wakeirq)
> > +		return;
> 
> can we drop the pointless obfuscation ?

Hmm care to specify what exactly you have in mind here? The wakeirq
is optional so we need to check for it.

Do you mean get rid of serial_omap_enable_wakeirq() or get rid of
the defines for omap_uartirq and omap_wakeirq?

> > @@ -689,15 +705,25 @@ static int serial_omap_startup(struct uart_port *port)
> >  {
> >  	struct uart_omap_port *up = to_uart_omap_port(port);
> >  	unsigned long flags = 0;
> > -	int retval;
> > +	int i, retval;
> >  
> >  	/*
> > -	 * Allocate the IRQ
> > +	 * Allocate the IRQs, the second IRQ is the optional wakeirq
> >  	 */
> > -	retval = request_irq(up->port.irq, serial_omap_irq, up->port.irqflags,
> > -				up->name, up);
> > -	if (retval)
> > -		return retval;
> > +	for (i = 0; i < ARRAY_SIZE(up->irqs); i++) {
> > +		if (i == 1 && !omap_wakeirq) {
> > +			dev_info(up->port.dev, "no wakeirq for uart%d\n",
> > +				 up->port.line);
> > +			break;
> > +		}
> > +		retval = devm_request_irq(up->port.dev, up->irqs[i],
> > +					  serial_omap_irq, up->port.irqflags,
> > +					  up->name, up);
> 
> conversion to devm_* should be done as another patch, it seems.

OK, I'll separate the devm_* changes from this patch. It's seems
that we're currently mostly devm_*, so let's do that first.
 
> > @@ -786,7 +813,10 @@ static void serial_omap_shutdown(struct uart_port *port)
> >  
> >  	pm_runtime_mark_last_busy(up->dev);
> >  	pm_runtime_put_autosuspend(up->dev);
> > -	free_irq(up->port.irq, up);
> > +
> > +	for (i = 0; i < ARRAY_SIZE(up->irqs); i++)
> > +		if (up->irqs[i])
> > +			devm_free_irq(up->port.dev, up->irqs[i], up);
> 
> do you need this at all if you're using devm_* ?

So it seems, startup and shutdown are managed by serial_core and
that's what at least clps711x.c serial driver is doing.

Regards,

Tony

  reply	other threads:[~2013-10-18 16:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-17 23:28 [PATCH] serial: omap: Add support for optional wake-up interrupt Tony Lindgren
2013-10-18 16:19 ` Felipe Balbi
2013-10-18 16:37   ` Tony Lindgren [this message]
2013-10-18 16:45     ` Tony Lindgren
2013-10-18 22:56       ` Tony Lindgren
2013-10-21  9:07         ` Roger Quadros
2013-10-21 12:21         ` Felipe Balbi
2013-10-22 13:49           ` Tony Lindgren

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=20131018163740.GP15154@atomide.com \
    --to=tony@atomide.com \
    --cc=balbi@ti.com \
    --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=linux-serial@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 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).