From patchwork Wed Mar 6 10:25:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2224261 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4B5EF3FCF6 for ; Wed, 6 Mar 2013 10:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756806Ab3CFK0c (ORCPT ); Wed, 6 Mar 2013 05:26:32 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:33881 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756212Ab3CFK0b (ORCPT ); Wed, 6 Mar 2013 05:26:31 -0500 Received: by mail-pb0-f48.google.com with SMTP id wy12so5794459pbc.35 for ; Wed, 06 Mar 2013 02:26:30 -0800 (PST) X-Received: by 10.68.0.170 with SMTP id 10mr45273976pbf.59.1362565590625; Wed, 06 Mar 2013 02:26:30 -0800 (PST) Received: from localhost ([183.37.194.87]) by mx.google.com with ESMTPS id 4sm17731221pbn.23.2013.03.06.02.26.25 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Mar 2013 02:26:29 -0800 (PST) From: Ming Lei To: "David S. Miller" , Greg Kroah-Hartman , Jiri Kosina Cc: Alan Stern , Oliver Neukum , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, Ming Lei , Johan Hovold Subject: [PATCH v1 2/7] USB: serial: handle suspend failure path correctly Date: Wed, 6 Mar 2013 18:25:51 +0800 Message-Id: <1362565557-15884-3-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362565557-15884-1-git-send-email-ming.lei@canonical.com> References: <1362565557-15884-1-git-send-email-ming.lei@canonical.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This patch kills traffic even though type->suspend returns failure inside usb_serial_suspend from system sleep context because USB core ignores the failiure and lets system sleep go ahread, so the serial URB traffic need to be killed in this case. Cc: Johan Hovold Signed-off-by: Ming Lei --- drivers/usb/serial/usb-serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a19ed74..9d0b9c8 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -1142,10 +1142,11 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) if (serial->type->suspend) { r = serial->type->suspend(serial, message); - if (r < 0) { + if (r < 0 && PMSG_IS_AUTO(message)) { serial->suspending = 0; goto err_out; } + /* TODO: resume() might need to handle suspend failure */ } for (i = 0; i < serial->num_ports; ++i) {