Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933237AbbHISTi (ORCPT ); Sun, 9 Aug 2015 14:19:38 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:34842 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933198AbbHIST1 (ORCPT ); Sun, 9 Aug 2015 14:19:27 -0400 From: Eduardo Valentin To: Greg Kroah-Hartman , Jiri Slaby , Fabio Stevam Cc: Linux PM , Eduardo Valentin , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/8] serial: imx: add a flag to indicate we are in the suspend path Date: Sun, 9 Aug 2015 11:19:07 -0700 Message-Id: <1439144349-10494-7-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439144349-10494-1-git-send-email-edubezval@gmail.com> References: <1439144349-10494-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: 1923 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 Stevam 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 494b182..def52e0 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -219,6 +219,8 @@ struct imx_port { wait_queue_head_t dma_wait; unsigned int saved_reg[8]; bool context_saved; + + bool is_suspending; }; struct imx_port_ucrs { @@ -1805,6 +1807,22 @@ static struct uart_driver imx_reg = { .cons = IMX_CONSOLE, }; +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 void serial_imx_restore_context(struct imx_port *sport) { if (!sport->context_saved) @@ -2033,6 +2051,8 @@ static int serial_imx_remove(struct platform_device *pdev) static const struct dev_pm_ops serial_imx_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(serial_imx_suspend, serial_imx_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/