Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933729AbbHKBhb (ORCPT ); Mon, 10 Aug 2015 21:37:31 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:34059 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933578AbbHKBgG (ORCPT ); Mon, 10 Aug 2015 21:36:06 -0400 From: Eduardo Valentin To: Greg Kroah-Hartman , Jiri Slaby , Fabio Estevam Cc: Sascha Hauer , Linux PM , linux-serial@vger.kernel.org, LKML , Eduardo Valentin Subject: [PATCHv2 5/8] serial: imx: add a flag to indicate we are in the suspend path Date: Mon, 10 Aug 2015 18:35:46 -0700 Message-Id: <1439256949-626-6-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439256949-626-1-git-send-email-edubezval@gmail.com> References: <1439256949-626-1-git-send-email-edubezval@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1986 Lines: 67 This is a simple flag that gets set across prepare and complete callbacks in the suspend path. We the flag we may avoid runtime pm idling at the same time. Cc: Fabio Estevam Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin --- drivers/tty/serial/imx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index fe3d41c..50abb60 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -218,6 +218,8 @@ struct imx_port { wait_queue_head_t dma_wait; unsigned int saved_reg[10]; bool context_saved; + + bool is_suspending; }; struct imx_port_ucrs { @@ -2026,6 +2028,22 @@ static void serial_imx_enable_wakeup(struct imx_port *sport, bool on) writel(val, sport->port.membase + UCR1); } +static int serial_imx_prepare(struct device *dev) +{ + struct imx_port *sport = dev_get_drvdata(dev); + + sport->is_suspending = true; + + return 0; +} + +static void serial_imx_complete(struct device *dev) +{ + struct imx_port *sport = dev_get_drvdata(dev); + + sport->is_suspending = false; +} + static int imx_serial_port_suspend_noirq(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -2091,6 +2109,8 @@ static const struct dev_pm_ops imx_serial_port_pm_ops = { .resume_noirq = imx_serial_port_resume_noirq, .suspend = imx_serial_port_suspend, .resume = imx_serial_port_resume, + .prepare = serial_imx_prepare, + .complete = serial_imx_complete, }; static struct platform_driver serial_imx_driver = { -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/