Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1C4AC433F5 for ; Mon, 15 Nov 2021 08:43:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DAF461C48 for ; Mon, 15 Nov 2021 08:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236489AbhKOIqK (ORCPT ); Mon, 15 Nov 2021 03:46:10 -0500 Received: from muru.com ([72.249.23.125]:56406 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235130AbhKOIpS (ORCPT ); Mon, 15 Nov 2021 03:45:18 -0500 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id D6236813A; Mon, 15 Nov 2021 08:42:58 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman Cc: Andy Shevchenko , Jiri Slaby , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH 3/7] serial: 8250_port: properly handle runtime PM in IRQ Date: Mon, 15 Nov 2021 10:41:59 +0200 Message-Id: <20211115084203.56478-4-tony@atomide.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115084203.56478-1-tony@atomide.com> References: <20211115084203.56478-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko We can't and basically don't need to call runtime PM in IRQ handler. If IRQ is ours, device must be powered on. Otherwise check if the device is powered off and return immediately. Signed-off-by: Andy Shevchenko [tony@atomide.com: use port->runtime_suspended] Signed-off-by: Tony Lindgren --- drivers/tty/serial/8250/8250_port.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1939,17 +1939,19 @@ EXPORT_SYMBOL_GPL(serial8250_handle_irq); static int serial8250_default_handle_irq(struct uart_port *port) { - struct uart_8250_port *up = up_to_u8250p(port); unsigned int iir; - int ret; - serial8250_rpm_get(up); + /* + * The IRQ might be shared with other peripherals so we must first + * check that are we RPM suspended or not. If we are we assume that + * the IRQ was not for us (we shouldn't be RPM suspended when the + * interrupt is enabled). + */ + if (port->runtime_suspended) + return 0; iir = serial_port_in(port, UART_IIR); - ret = serial8250_handle_irq(port, iir); - - serial8250_rpm_put(up); - return ret; + return serial8250_handle_irq(port, iir); } /* -- 2.33.1