From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 955E846B9F; Mon, 1 Apr 2024 15:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711986810; cv=none; b=Ukwf6MHTz/UmBmEv8sXq5SPVSMEeyvkLbzPDIwkRKdcYJg6WAr2RrdfkV/8i5uWAWGA0JHyl7dlD8cUabKhg+MCnNNPqtTy+2ISwx9EvhlEjHXpIJZRg3GCJTHzyvdp6g5V2SdYwqb8DcEz6RIia9f2wxmX/uGDjnJ6ODLj+E34= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711986810; c=relaxed/simple; bh=SWu3uX80xupWrRQl5Ku0vx31xPcoyaLEg66kBDY7xgY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DqCSPD5o/cOmT+hbknlCwIGKvHtSvg/0rO1b7MDXT9Sfxt2TjKjysxVx0th7g8Pa1Bu2YgZwvKU922Zi2qSDsPF8isAiQ/2rvZJ3RUpdZ5JY07Xqlo2RzVB5CUPaqGcpVPNRKdYnz1jp3LfuF5m8NquNPGxl5RKQ5hEDYRRZkUI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wDcZOQFj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wDcZOQFj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 115DFC433F1; Mon, 1 Apr 2024 15:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711986810; bh=SWu3uX80xupWrRQl5Ku0vx31xPcoyaLEg66kBDY7xgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wDcZOQFjASGCKLY2ooKcjKYEytvpYR8qXZ4x+S7AP8fV74KFWyET2XKOoAd/yyV5G mmfuBNWrrdySVq7YA+WcbGMsplk0rHgu/bR1b1wX3YREowMXdYLiCW9z8/08rxDVGs n8UL4UFh4Gm23x65G06dfKx8e6Ou9kRlkeYytnTQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Roger Quadros , Sasha Levin Subject: [PATCH 6.8 092/399] usb: dwc3-am62: fix module unload/reload behavior Date: Mon, 1 Apr 2024 17:40:58 +0200 Message-ID: <20240401152551.927102520@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152549.131030308@linuxfoundation.org> References: <20240401152549.131030308@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: Roger Quadros [ Upstream commit 6661befe41009c210efa2c1bcd16a5cc4cff8a06 ] As runtime PM is enabled, the module can be runtime suspended when .remove() is called. Do a pm_runtime_get_sync() to make sure module is active before doing any register operations. Doing a pm_runtime_put_sync() should disable the refclk so no need to disable it again. Fixes the below warning at module removel. [ 39.705310] ------------[ cut here ]------------ [ 39.710004] clk:162:3 already disabled [ 39.713941] WARNING: CPU: 0 PID: 921 at drivers/clk/clk.c:1090 clk_core_disable+0xb0/0xb8 We called of_platform_populate() in .probe() so call the cleanup function of_platform_depopulate() in .remove(). Get rid of the now unnnecessary dwc3_ti_remove_core(). Without this, module re-load doesn't work properly. Fixes: e8784c0aec03 ("drivers: usb: dwc3: Add AM62 USB wrapper driver") Cc: stable@vger.kernel.org # v5.19+ Signed-off-by: Roger Quadros Link: https://lore.kernel.org/r/20240227-for-v6-9-am62-usb-errata-3-0-v4-1-0ada8ddb0767@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/dwc3-am62.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 90a587bc29b74..f85603b7f7c5e 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -267,21 +267,14 @@ static int dwc3_ti_probe(struct platform_device *pdev) return ret; } -static int dwc3_ti_remove_core(struct device *dev, void *c) -{ - struct platform_device *pdev = to_platform_device(dev); - - platform_device_unregister(pdev); - return 0; -} - static void dwc3_ti_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct dwc3_am62 *am62 = platform_get_drvdata(pdev); u32 reg; - device_for_each_child(dev, NULL, dwc3_ti_remove_core); + pm_runtime_get_sync(dev); + of_platform_depopulate(dev); /* Clear mode valid bit */ reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL); @@ -289,7 +282,6 @@ static void dwc3_ti_remove(struct platform_device *pdev) dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg); pm_runtime_put_sync(dev); - clk_disable_unprepare(am62->usb2_refclk); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); } -- 2.43.0