Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp124513rdb; Thu, 1 Feb 2024 04:13:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3nTox1EH6PEW8SYwxVxJYqUZ/WGCg87z5mglnLMspW+v5lPts9uTUAWpYyn/8dwa/5+nP X-Received: by 2002:a50:d597:0:b0:55f:30dc:a72f with SMTP id v23-20020a50d597000000b0055f30dca72fmr3572135edi.7.1706789628896; Thu, 01 Feb 2024 04:13:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706789628; cv=pass; d=google.com; s=arc-20160816; b=Lj1NNUlIl9/kjPshfOIqPispu8Tmq3gckKhvNG2vgLyaoSk9axjmow6yPBjDME9l/o YYI54iNmmuXbJmPjHC+qxLY7ITdwciKwIwUjUpxBxbHg188FRfyDYk86ENe4jcAlctEl Pc/efp6vbv3jVXHRo2oKntOGBdSYrhXYRt562VvfUO/He6CVIB7QxG5fncSFWCvRHlfC Xw2BqzcRt7hbHGrm0DjpfRWlkIqbJLbSwtv9iLztjp40jV6hgBbhofsIA72DdfUnakpV MFWH+ljhWnX8UJiOYFoaddeEMngWyzC9Z/SizLsf6nUoZw0C9X4m5C25Q7ilr/v8Wmfv Ybeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HxEJkFAd2u6PWo5ke0WcBLsLsSsYqOMSK6kiY4SIefI=; fh=1DzRvwj9eCI/LYBQLtvlAXyjrMVBEsXiV94xsnWfWoQ=; b=INdlZIdJG8mMrHDmLQ10C2fv1wLHL0w6QmsNSZ4jLE5Em2+f+SUz7ST6r/9L11/F/u fx/M9wK/x668FwAuoIaK30UA7Ghfw1fn/uPq9XKD6+PbQy7YCqF2MxJKEImL05TJ3Ubm zLWUeDZx4GD+Db+UkPQci1V9I6bAIqT3KALgRd4dWR8BagmPDt94JQaQAZUBNsgdfC7v ooyR829zdmIrAuWyypxHwo+4JHdVpJMeBSky8lQDl/0VIMsOZJTgox9eH0WfPFMyuwE6 6AqmYYNTTz2b/Cu+pCm2jSAhxo9Djo5WF/PVzpcavd4wUCsjUgxa/mAkTAq/ddcL6FiX 47jQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=urvYrxUW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48093-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVXg7B2aiteXYMo71Cd+a/pzAQkkm0bMRWDhcdlCIfG/llun/lf3E37yO/Il5bC8KVM9iN9wwvBij918U2MAPxbx1sRnPdwOP4dnFhg2g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b19-20020a056402351300b00558e39cd08bsi6727720edd.383.2024.02.01.04.13.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 04:13:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48093-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=urvYrxUW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48093-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A2D291F225AA for ; Thu, 1 Feb 2024 12:13:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C8C2161B47; Thu, 1 Feb 2024 12:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="urvYrxUW" 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 9C87A16088F; Thu, 1 Feb 2024 12:12:32 +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=1706789552; cv=none; b=H8Yhtzmtudn0sflidhGiJpYnn7kJKZBvRxLGLhrjZwqRMG+k2oxTODwJ+TfF1nwdarGbU+gXRpMZzqj+EhjbAjgEkVRmC4O2+kmMm58FNTIxcuZrNii9AusflXDx03ksosquDZZ5inE+FXrgZRvX10HdWdOVv42I0ajdFvju4k8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706789552; c=relaxed/simple; bh=U0KOgz6nOgOjNNhuSJI9UM8ClADua2irwTRLMiXXge0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g3SMPx8SCp6L68FwZj2HvF+PPubKmrtw4ABnixr0NL6fSHgFhpfsGk/nyP6/N9QXwvNcuIT2rexwvJlrKkvcnkSSXTqLQ+5vknLYfhKTvqbvCLYxxtmLIefi+tnWzEHZCvbHRM92Jn4Ldvvdy+DItZErbi45fZqoCMBTWJUoZQs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=urvYrxUW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 119FEC43399; Thu, 1 Feb 2024 12:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706789552; bh=U0KOgz6nOgOjNNhuSJI9UM8ClADua2irwTRLMiXXge0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urvYrxUWsMAFZTUvGyLBQVD3pWRgURGRXvf8giZcgNy4TQ8rhNMfJPHktBC0RXDzH 288iRyPCfec97Ogu5T12whCkNPH9UtbHJpYYhZRjZnotrOZsoxHotS+5Iw1Hl5fun6 4Uhnbrb+U03wYPhQQH+CBcAoVFQIi6ezE1C3au44gThPiGc4jPe008PPoQhP76BQ2i Jn/acVTuhMClwChUy0zJEm5jPwQPcvj8e/pnXa+Ay6jIn04nAZWQslJLUpkBEVKWjn 0ZmiGwJxtYVs5Lor46tD7eMVzhJ9K1Dd0V7fSDoBAlfxM9F4PqPrWalc21jLUy8w4e o5tynXZTmYGJQ== From: Roger Quadros To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, b-liu@ti.com, srk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH 2/4] usb: dwc3-am62: fix error on module removal Date: Thu, 1 Feb 2024 14:12:18 +0200 Message-Id: <20240201121220.5523-3-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240201121220.5523-1-rogerq@kernel.org> References: <20240201121220.5523-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Roger Quadros --- drivers/usb/dwc3/dwc3-am62.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 1bfc9e67614f..600ba9cfefea 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -273,6 +273,11 @@ static void dwc3_ti_remove(struct platform_device *pdev) struct dwc3_am62 *am62 = platform_get_drvdata(pdev); u32 reg; + pm_runtime_get_sync(dev); + + device_wakeup_disable(dev); + device_set_wakeup_capable(dev, false); + of_platform_depopulate(dev); /* Clear mode valid bit */ @@ -281,7 +286,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.34.1