From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH resend] serial_core: Fix pm imbalance on unbind Date: Thu, 27 Mar 2014 09:38:06 +0100 Message-ID: References: <1395392905-29569-1-git-send-email-geert@linux-m68k.org> <532C394A.3050408@hurleysoftware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-pa0-f44.google.com ([209.85.220.44]:46530 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754338AbaC0IjC (ORCPT ); Thu, 27 Mar 2014 04:39:02 -0400 In-Reply-To: <532C394A.3050408@hurleysoftware.com> Sender: linux-serial-owner@vger.kernel.org List-Id: linux-serial@vger.kernel.org To: Peter Hurley Cc: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, Linux-sh list , "linux-kernel@vger.kernel.org" , Geert Uytterhoeven On Fri, Mar 21, 2014 at 2:06 PM, Peter Hurley wrote: >> When a serial port is closed, uart_close() takes care of shutting down the >> hardware, and powering it down. >> >> When a serial port is unbound while in use, uart_close() bypasses all of >> this, as this is supposed to be done through uart_hangup() (invoked via >> tty_vhangup() in uart_remove_one_port()). >> >> However, uart_hangup() does not set the hardware's power state, leaving it >> powered up. This may also lead to unbounded nesting counts in clock and >> power management, depending on their internal implementation. >> >> Make sure to power down the port in uart_hangup(), except when the port is >> used as a serial console. For serial consoles, this must be postponed >> until >> after their deregistration in uart_remove_one_port() (symmetry with >> registration in uart_configure_port(), invoked from uart_add_one_port()). >> >> After this, the module clock used by the sh-sci driver is disabled on >> unbind while the serial port is in use. >> >> Signed-off-by: Geert Uytterhoeven >> --- >> drivers/tty/serial/serial_core.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/tty/serial/serial_core.c >> b/drivers/tty/serial/serial_core.c >> index 2cf5649a6dc0..56dda84f82a5 100644 >> --- a/drivers/tty/serial/serial_core.c >> +++ b/drivers/tty/serial/serial_core.c >> @@ -1452,6 +1452,8 @@ static void uart_hangup(struct tty_struct *tty) >> clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); >> spin_unlock_irqrestore(&port->lock, flags); >> tty_port_tty_set(port, NULL); >> + if (!uart_console(state->uart_port)) >> + uart_change_pm(state, UART_PM_STATE_OFF); > > > Ok. Thanks, I'll send an updated patch handling the non-serial console case only. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds