From patchwork Tue Oct 27 13:50:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73BA2C64E75 for ; Tue, 27 Oct 2020 16:46:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C7AB22264 for ; Tue, 27 Oct 2020 16:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603817196; bh=lMMHdA/8048VM3PBksY4VAcm8GFml13hO7tc6DH14Gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lrnxoykxr3gdwhOG9VBMuZJtIqyxfLq3b2G9v/7yXmf2/P4RGFzsP6jv/njWFDphz 6ISZlXpsNDbrU4ZpfKzvrjj5v10ylizQ0LBCEfg/HrWhjuaypiI4TE62zuOyvJ/YuV +tXbEo0L8Y1SOMp+PR1l/mzUa17a2USLe2Kbzzss= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1797960AbgJ0Pli (ORCPT ); Tue, 27 Oct 2020 11:41:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:53258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1800084AbgJ0Pew (ORCPT ); Tue, 27 Oct 2020 11:34:52 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3ABB12225E; Tue, 27 Oct 2020 15:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812891; bh=lMMHdA/8048VM3PBksY4VAcm8GFml13hO7tc6DH14Gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B31t/WH+TrXk2dSc3OtZcAJwAfsiKYVBmFSyhCwN5wEZjDeZXUQ84QA/3XlJqcmeQ At3QPZ0h4G//w2m4ccQNVxU9HlGeD0c3eIKZEwDYjjbfSuMsNDBpTucXAC5wYwhsQL xD/x8d1OmDiExKQQpvD1iTq3mrHw9RH7+gzxuyG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Linh Phung , Tam Nguyen , Felipe Balbi , Sasha Levin Subject: [PATCH 5.9 366/757] usb: gadget: u_serial: clear suspended flag when disconnecting Date: Tue, 27 Oct 2020 14:50:16 +0100 Message-Id: <20201027135507.736682232@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yoshihiro Shimoda [ Upstream commit d98ef43bfb65b5201e1afe36aaf8c4f9d71b4307 ] The commit aba3a8d01d62 ("usb: gadget: u_serial: add suspend resume callbacks") set/cleared the suspended flag in USB bus suspend/resume only. But, when a USB cable is disconnected in the suspend, since some controllers will not detect USB bus resume, the suspended flag is not cleared. After that, user cannot send any data. To fix the issue, clears the suspended flag in the gserial_disconnect(). Fixes: aba3a8d01d62 ("usb: gadget: u_serial: add suspend resume callbacks") Signed-off-by: Yoshihiro Shimoda Tested-by: Linh Phung Tested-by: Tam Nguyen Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/u_serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 127ecc2b43176..2caccbb6e0140 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -1391,6 +1391,7 @@ void gserial_disconnect(struct gserial *gser) if (port->port.tty) tty_hangup(port->port.tty); } + port->suspended = false; spin_unlock_irqrestore(&port->port_lock, flags); /* disable endpoints, aborting down any active I/O */