From patchwork Sun Apr 21 13:47:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 790923 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7732B64E; Sun, 21 Apr 2024 13:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707313; cv=none; b=R+PhRr+8HpCTjXzG9mKcGmLYs/4t9ZVwyU6DS69W+/ORXNvUNlD9x/j2LEkkLWnqn1Iz7AeLgKWFKtQnLON5SrF3xR4UxauXuuTUEcPQPdFAI33+0jCRbq2GftKxrGJuUlaln0KzEWTLeKI5Zf/XtSmEDcdgCJTG3lFGwuIaOFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707313; c=relaxed/simple; bh=YRvqVcmwuUP8KQzGkDUkcd/uUAKw1WBPiXOoWNitfhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VaJKB9Ljks2nv3RpZZijMDqadQ0DEimhMLeoHISulvCue/z2J74ciWXvT76wnmA4AuXkpntPxhFBgni9y8JQiOC1ig5PwtWg3mPisHBBnJ8mvA8Y29W3fyyCRqXejcZGZ4+YaF7HdrQ0XnijbB/Zb8c1RCK9vBeN4Lh6DS3Xbt8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jmy/BBsM; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jmy/BBsM" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-5dca1efad59so2597837a12.2; Sun, 21 Apr 2024 06:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707311; x=1714312111; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WcTvBG8QtewVblIlyVX39beMUKrTk6jsd2Uev9rHf/0=; b=jmy/BBsMlv0WrcF86mtgKemjEWRhxnp+cw64YKc64bu6qf+3slm7zrM0U6x8yi72Kn xZv8rKlHI/txXODUIsidV4w1rhtT9T017f8rAh00TsiknJTWOezdfqaCPnDm3AnA/u9C 30kzTdYapZoQEl/XRKkGtNMXUXJvC6OcLJlIbDOL6moUFBkhYhGiRrGWQOwE4o0iIlyh 1j1BsHK61zFu7cQAEc84K0WwmIRRI39k+w4OJoYnF5JkQsTITj3O8xXZBjCzjPJio7TO DaO++i0A/PIn2xIXYRUbqJdqB+m8t2tsrXmgLb4b7zsy5t5P26dq/KMcgCnE26oOWi7t DsNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707311; x=1714312111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WcTvBG8QtewVblIlyVX39beMUKrTk6jsd2Uev9rHf/0=; b=h9vfI8t2xZTVBul5sjVjqi4Z1h9LlU55pE3CyDVPQLNLoeXAmVkrZmIj1Ppb70Lc8/ jbJvg10KvWMRxaPDYNZXqj2dnkIXdubmtEgtfpuV7apxDQ1V4v+syTxtzqUmCZlFTcnP g9AgnChjeKgIfa3k91Cfc0Nxlv+I01wrrTCWgSx7w559uVsrj4Jgtt6vmeWJpE3fJ1p3 3F6KsjEryiCQLBlZcH225dJhKqmH+58g81bC+N0OY4lVDvzkP54RmTgwsfGj5Om+hXPz u0yhq7v943TOcTd6X40n31uYh5O100TnPucnZQ2bWJscN+PMBY75XzqnlkPibEJhB2pI ZlkQ== X-Forwarded-Encrypted: i=1; AJvYcCXWN593lHdS6daJBe/ENA62uJ0uQ4AWGfWqcziT0DG1HmxjuYU4JU7lIJ3xhmL0yzejjKZ5iD/i+f7iHLenA8HrcBzbc6LhIaktiKWfWlF03ESe3MQWDmuxplNxThQJQynuNC97x8b0n+AHX8fC6Ww/pdpXtm88nV0KB1LFo/UIXst8ckQhQrWOQuA= X-Gm-Message-State: AOJu0YysmJ52XycJbWDly64cDysEx5uLnR6kYSPXtuYE0OQBUCmP620m Pfrds+WhsjOjQO38DwhGI13DAMBJQP8Gytijdugu99c22XbjgyrB X-Google-Smtp-Source: AGHT+IEyPxwqw/6TXGpzi8WH9F4lH1JxYg6WoBnEpf5NAK/vkuPgmJrfQekLV8WaNKlLanS22PkK4g== X-Received: by 2002:a05:6a20:9191:b0:1a3:c3a9:53b7 with SMTP id v17-20020a056a20919100b001a3c3a953b7mr7874675pzd.55.1713707310911; Sun, 21 Apr 2024 06:48:30 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:30 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/5] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Sun, 21 Apr 2024 19:17:30 +0530 Message-ID: <20240421134752.2652-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Reviewed-by: Alan Stern Signed-off-by: Anand Moon --- v4: Add Rb Alan Stern v3: drop dev_err_probe to simplify the error handle. v2: drop the clk_disable_unprepare in suspend/resume functions fix the usb_put_hcd return before the devm_clk_get_enabled --- drivers/usb/host/ehci-exynos.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f644b131cc0b..e2303757bc0f 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -159,20 +159,16 @@ static int exynos_ehci_probe(struct platform_device *pdev) err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); if (err) - goto fail_clk; + goto fail_io; - exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); + exynos_ehci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ehci->clk)) { dev_err(&pdev->dev, "Failed to get usbhost clock\n"); err = PTR_ERR(exynos_ehci->clk); - goto fail_clk; + goto fail_io; } - err = clk_prepare_enable(exynos_ehci->clk); - if (err) - goto fail_clk; - hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); @@ -223,8 +219,6 @@ static int exynos_ehci_probe(struct platform_device *pdev) exynos_ehci_phy_disable(&pdev->dev); pdev->dev.of_node = exynos_ehci->of_node; fail_io: - clk_disable_unprepare(exynos_ehci->clk); -fail_clk: usb_put_hcd(hcd); return err; } @@ -240,8 +234,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) exynos_ehci_phy_disable(&pdev->dev); - clk_disable_unprepare(exynos_ehci->clk); - usb_put_hcd(hcd); } From patchwork Sun Apr 21 13:47:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 791205 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96E9E18E3F; Sun, 21 Apr 2024 13:48:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707320; cv=none; b=IyAiGY/OMFqTpDqU/xvz/VFlxUGvaFxfy4yuzd8TJN1ssgOv4j0T+aJ++eNO5ZqVfSvNPbcUdHKTR4syMxI9biZFnKcPqpNq3RVXxOzGWyUIHZ50XJaQS9OkN2NEPRVO40Q/0zcaDO17Bm7qMDsZ2JuFJhKXlo7eH0jAmlswK20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707320; c=relaxed/simple; bh=A4OPctYYUH7PuBa9PxvK7F68AY0rYnDxN+Q+bX9qxmg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YPka2W1cLJ84edcTtImGHLg5ljqQnpOTzVTZSSmKxouLeEgWq9gJNqsDPtlZ1XHU1dw6CxQsbYO5XFA9fiFwmYRZbhSTLyRSpsIx749ezZYo7LrAZ7pcG1ZhEJcyyXpJimYWV5SVWnAdNqJzGUbe/JSIQrURVuz4JN6hnEsH+pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TvfU1Scv; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TvfU1Scv" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ed9fc77bbfso2753554b3a.1; Sun, 21 Apr 2024 06:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707318; x=1714312118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ciAsjHwxYvDFWKrK0+bRI8F1DZJnqhJJG3f0Ywfv28Q=; b=TvfU1Scv5GFSW+3Y5S6668UXl6IHEQr6kwaUrIYdZgQxK/uP9rO6PI4Gs5bqYds34i iBPEit7t29x/LuHUhksnokz36i9x4Wizzea70aXGKMry6fhrOli5QVCbwB2j+dnRB1J3 L0V1N+VZNaDTGR69Wz+4ey+ggefhCMoxdPwEfhsze5AHRZLBARK/rb3bcL30TEKQFjX/ lwDqJiAJ3u34XJS+AKiJjzHFvACFHeroe0O3A4Zn624iHSOR7hPrBfpKSL83rmpIqzPD HFf7jneVSsJyukRFO1PzqgCzgRSpeVV2OqGzVIiXfuuSUeukUaI/nr2ckPGhemJr5qqA fqLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707318; x=1714312118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ciAsjHwxYvDFWKrK0+bRI8F1DZJnqhJJG3f0Ywfv28Q=; b=AE3vrJyQ7PGICkof0WsRx9Af8N0PDbjG+rb6arXG7k3PtWOVEKUgvztVllwcD+dQ7P 4duduw5bdBT6dhB8xqQEFbCxeC1eFD0Z9vU71Wcph4AurI2WLCNs502DBKFmaRqtBgaW VN79oa/qBDvcMrUr3mRyrODwmaqV0g05HM0YseoK4TXoSMevohneV9QCwqfdrHRgHtp7 7GulcACXfXyNfBpr1+EeoD1ko47Fx7YgJFUUnc7mvpjYib0f2DIcN3iWBcl1EgFN6dK8 t+DHUOs9M5cN3apAZh28JG3Jxx2ustFlmweu3AxyLxCe7BjaV2g15NYm0NT+6Ij4OO6c 7dVA== X-Forwarded-Encrypted: i=1; AJvYcCVdjqBvb6NAfomk87oCX8P3Ebq1Bj6ijukTNt95oslmtBbl9zHUHGYp3GnDR9vHWN5/WsdrtBK4cAqhqFJ8WhMMsK6PouBNMgnn5cPO5W+u70oKe/uk96Xsfrv6nHZmEd6xhKbqtGNDVXFhPjkACmROFHbzqGCFn/nBJPNg1fifwuClelF7eYeud2w= X-Gm-Message-State: AOJu0YxR/OQzyUqtxZ+j1OxvCaXQoGma0xTpFQpqEM9XkTydTUgVxbNF 26jDsjQISXB6NQpOqzSayBT4+iNBZn2WhMTDPsFWurgeH04XYerY X-Google-Smtp-Source: AGHT+IHfvthUjm2iFzaL1LUjJwU52v8bgHPixb0cyYfYA4lJ9nZLxMwMuG3dGxRPm+KDk4l3Veo7wQ== X-Received: by 2002:a05:6a00:1390:b0:6ec:f9d3:d0c6 with SMTP id t16-20020a056a00139000b006ecf9d3d0c6mr10380392pfg.16.1713707317822; Sun, 21 Apr 2024 06:48:37 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:37 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] usb: ehci-exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Sun, 21 Apr 2024 19:17:31 +0530 Message-ID: <20240421134752.2652-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use DEFINE_SIMPLE_DEV_PM_OPS macro to progressively switch from a code model where PM callbacks are all protected behind CONFIG_PM guards, to a code model where the PM callbacks are always seen by the compiler, but discarded if not used. Reviewed-by: Alan Stern Signed-off-by: Anand Moon --- v4: rephrase commit message add reviewed by RB Alan Stern v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/host/ehci-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index e2303757bc0f..f40bc2a7a124 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -237,7 +237,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) usb_put_hcd(hcd); } -#ifdef CONFIG_PM static int exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -280,15 +279,9 @@ static int exynos_ehci_resume(struct device *dev) ehci_resume(hcd, false); return 0; } -#else -#define exynos_ehci_suspend NULL -#define exynos_ehci_resume NULL -#endif -static const struct dev_pm_ops exynos_ehci_pm_ops = { - .suspend = exynos_ehci_suspend, - .resume = exynos_ehci_resume, -}; +static DEFINE_SIMPLE_DEV_PM_OPS(exynos_ehci_pm_ops, + exynos_ehci_suspend, exynos_ehci_resume); #ifdef CONFIG_OF static const struct of_device_id exynos_ehci_match[] = { @@ -304,7 +297,7 @@ static struct platform_driver exynos_ehci_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "exynos-ehci", - .pm = &exynos_ehci_pm_ops, + .pm = pm_ptr(&exynos_ehci_pm_ops), .of_match_table = of_match_ptr(exynos_ehci_match), } }; From patchwork Sun Apr 21 13:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 790922 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F7E9625; Sun, 21 Apr 2024 13:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707326; cv=none; b=sW/4i6zvanOJJsN/9sFnStgyjeccFJFA8ir75yKNVsAzUOAAna5e55LZFIIBYSsyrsoCBiUzwe6JoXS6TmHc42L9ovc2VCdEMfXua151+DA2Z9bXCK+NorhE8xPeScVfgM5X57ff/+Yi0hEM8tvO3T/rhur6O8AOInBIyq03xP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707326; c=relaxed/simple; bh=0KUGNTeSghqjf4dUuEOi4jQq1uyimggR/5MrEIFNjmk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O9SRfCKa7qQr468pqZ0YxzNfwmN8oLezi7RqwbOdFEQ/+mXJNIh1ggApQ6vW6HdPDTKn+TbpW6CdU/J6umPlkZR1ERt8KC4m4vXkujtY87L1aeQUpE8QqNYT8UfzTjcpbvJRSwecNXF6y5LmjsVX5U85u72+XVDrmT7TuzV/O7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V6l93vQl; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V6l93vQl" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6ece8991654so3388965b3a.3; Sun, 21 Apr 2024 06:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707324; x=1714312124; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CFH817ciebpwZm5RIvkd4+jbnHC/S06VW05vaHkc95Y=; b=V6l93vQlx+llOfWYv8HrFM/Ol+cN8nLEdFX64LHlaDow5LFsiXalraRIlmtRVzokRY pLDkodSJNJ2231A+2/88Wu7RI7X7yJK23lf0nKJv1GsOzXH9yrXj/3IQ+dtPeO7XR+82 c6cIetN0UG44Qb2VPJHwZ84LTb6pSyDGieOM0Be0fYc1fhwvY8wbHnOjnVxcniyHbgcW EY77LZc5cPewvCWA2WMB4lygwMHrTK3iF5QO8UMyjpyWte/okPVPPxcL5k1pxr5/p1Df E4/ylJVrQMtI3EONQhG+9dSk9qxdrK1VU4C/w72JIt/zQfT8kI2JoYGbKcpVnJ2wCscc izkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707324; x=1714312124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CFH817ciebpwZm5RIvkd4+jbnHC/S06VW05vaHkc95Y=; b=nilyqetV6pTGF/C4SIdjWsqhZa7D9/G/JHB/h8CbY3Ze0HCB91qCvsOMqtbsRmFazV QGVtNcndTUaHNqmBYqZ33v7Ke/HMEBx7wAmyw/aMVfvJgE2yP1QNbfXmIvflJZU+MVke FtAj4Te8VFLKusrS+bWYzpLgKcGwRpZHIqqwyDzxzUd/kx/VVbgRZyCXWZdntrjsaP6U YZrc9UfZ7+AuGW91n/tycYGz2RXW0fzWma11E0vxhzqgcB9s7V8UIoJ0tRNoMkRjH2EL pJucslIoMPxw1ctSKFGg1ddGyWIjmxjBK29auqE9wsUFVLV9NxmY8XTb9Wc9WxBTrE1H eawg== X-Forwarded-Encrypted: i=1; AJvYcCVwc33NEPnlbgUlBpYH5plXkwI/Rj62Y2BmRoTGZnvbvpWFATDK91qMqHzqwp5kSQs627BfYt3YRg+Xr9WHHFM9At9ph6zUadFjiN3bMPMJc3ls0LJL4cIy1cYm/BWle9UqZZEFA7i+d4DNAgduHXkv1lm+pOfpf+xoZ2hRo1ng7w5g0xNsLPRtK1U= X-Gm-Message-State: AOJu0YwczOPwOYisdyzneizV3hfXs6KWYsQtH26FqHWj8yDrUbFnU+h0 1y8dZsWZs9WO4BXcauZjx6tctJN1xtomVIpYMoijmWzmVgRJ5O44 X-Google-Smtp-Source: AGHT+IGBTkJIFfQemhLvAqEPk4jeBsCkiyNthhoIPYS3OEp203fcQuznnALtMlwF0yGaNj9W4OwFNQ== X-Received: by 2002:a05:6a00:10d1:b0:6ea:9252:435 with SMTP id d17-20020a056a0010d100b006ea92520435mr9937740pfu.30.1713707324572; Sun, 21 Apr 2024 06:48:44 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:44 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] usb: ohci-exynos: Use devm_clk_get_enabled() helpers Date: Sun, 21 Apr 2024 19:17:32 +0530 Message-ID: <20240421134752.2652-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Reviewed-by: Alan Stern Signed-off-by: Anand Moon --- v4 : Add reviewed by Alan Stern v3: drop dev_err_probe to simplify the error handle. v2: new patch in this series --- drivers/usb/host/ohci-exynos.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 20e26a474591..89e6587c089b 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -135,20 +135,16 @@ static int exynos_ohci_probe(struct platform_device *pdev) err = exynos_ohci_get_phy(&pdev->dev, exynos_ohci); if (err) - goto fail_clk; + goto fail_io; - exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); + exynos_ohci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ohci->clk)) { dev_err(&pdev->dev, "Failed to get usbhost clock\n"); err = PTR_ERR(exynos_ohci->clk); - goto fail_clk; + goto fail_io; } - err = clk_prepare_enable(exynos_ohci->clk); - if (err) - goto fail_clk; - hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); @@ -191,8 +187,6 @@ static int exynos_ohci_probe(struct platform_device *pdev) exynos_ohci_phy_disable(&pdev->dev); pdev->dev.of_node = exynos_ohci->of_node; fail_io: - clk_disable_unprepare(exynos_ohci->clk); -fail_clk: usb_put_hcd(hcd); return err; } @@ -208,8 +202,6 @@ static void exynos_ohci_remove(struct platform_device *pdev) exynos_ohci_phy_disable(&pdev->dev); - clk_disable_unprepare(exynos_ohci->clk); - usb_put_hcd(hcd); } From patchwork Sun Apr 21 13:47:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 791204 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E58B1BDE1; Sun, 21 Apr 2024 13:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707333; cv=none; b=sTu0zDqSkcviPo9GjOlFrnKijyZ6sQLhkuUIs3PcSkA4OYddLxjb+8VayDeQfYfIesChZWX21LKntSDRuRZFpDsAaoxL0o6uDeaVu1xie+ctAoeuHxGLvkwqQPJxLb+LOEfzYjqlhLts9IDkRT0i6NRuYbJXOvv6FBYlDeDz2Cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707333; c=relaxed/simple; bh=Jd1njSo+3n9Ssr8M/lLZxDhNFtu/DSBLSWYTX7TOnUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KiXVBqkXcOgp+TG6Fphp/rB7Xw59xiG7DlsYktHIT9+TqQW9GeMm+wwsj4IQgHEv2/rrUB4125YYAhPSwT4AyBKFS99tCZiLrnuox3pi3AN0VmPD3kfw08sb2cYvHWbp6hjE9gzbyyfrVTt9YOgoJWRuhiMYNCrlpmBe4rdgTKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ADPEmUx2; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ADPEmUx2" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5dca1efad59so2598072a12.2; Sun, 21 Apr 2024 06:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707331; x=1714312131; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fr8lwupgPbBOYuK2auIrCKM8IcU0Dw3SnEDCwy+iiEE=; b=ADPEmUx2QA8kK1Z3ZdGerBmbmDJtpNHsFwEmnmNcJ0mc2C8/3/C5xbz1TQYvT40D1/ njwGRP9ghgirOhW1ZA3T3DvWCKopXGVH49JGhf5u/54lh36ylmYh/LIxltWG1NIbwUfP EBajeXqPuxCP0ROzLbGBxgwDc9a3nF1Svh1E+7B6uaIDdHKYcqGCMXdljL/aVcnG47y0 b1sBj0ClRHJ34oLbqte+0igf5+4TrnBIR6Dws1rONVwxmgvV+gMOGrGY38z1MiUQYlYo Lp2tAZlYnoeW3p+8NWoCIhjahIxOlEGXziZ66kKKr0lvariwlWymTCj3k+0WpWEf/5LW pYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707331; x=1714312131; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fr8lwupgPbBOYuK2auIrCKM8IcU0Dw3SnEDCwy+iiEE=; b=kRPMoflvM5i7k4NSttkSOUnrvmsCCGRpYQHao1Hk+guXYcluq8tGDpPubupHP9JUci h1nUYm/JHTWvsXzCxP59+IAuoVQ0RfmMaBl2eaQowKX23pUWHes92dj149uk7OF7iKv+ JxENa3S5eO+SFGBLsf+YIJxKbIW6A/rcvmrIk4AJYbxJcLMibv8Za23aNA01KXQz37G+ BYxwc+hklQoSzUDR4cGW9Frhih1ZJ6iLTNyVNhDb8z0pk+LMpwJUXC59782tRp94WctA JF6J69L5ohkn2z0yBaoTeA+035o1aHO2s6vc25FODFyHf+eEXfXTZ3ZwLGqsceak4yYz +tlQ== X-Forwarded-Encrypted: i=1; AJvYcCXMaLnjIbBZ+jywBBxUWYagvWf957bauNzVRkWHYmfv3W2L5DpLt5PQQ2bVYBBjBMmMyFvUaSQGQV8tPudu3PtY896XWeShq9cY28bkO+zW14GD+CveR6YrL8pk2lW5P+zbZmp+Fks6up7NDTWmLaNq0lB/gaZ0nB19BLDjPJ/gFf++m+dIu5duKsU= X-Gm-Message-State: AOJu0Yw5ODG2GtCzlEJ7uu+tMTcO1gi4/hYvhglvPn5ZprtdYvXVEkgu uu5B095sEBc8SU/SzSKNPw1DieyheN3Uv/itIU6v5jCWJQmiPY6u X-Google-Smtp-Source: AGHT+IG2cLYEOHRWAkmdXIu5WTnMlfdKTjYNd65KFwSvWcxeRUQLWRPI7PE9DToAr9E/lnxyGyQ++A== X-Received: by 2002:a05:6a21:99a7:b0:1a7:a86a:1132 with SMTP id ve39-20020a056a2199a700b001a7a86a1132mr8649495pzb.13.1713707331300; Sun, 21 Apr 2024 06:48:51 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:51 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 4/5] usb: ohci-exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Sun, 21 Apr 2024 19:17:33 +0530 Message-ID: <20240421134752.2652-5-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use DEFINE_SIMPLE_DEV_PM_OPS macro to progressively switch from a code model where PM callbacks are all protected behind CONFIG_PM guards, to a code model where the PM callbacks are always seen by the compiler, but discarded if not used. Reviewed-by: Alan Stern Signed-off-by: Anand Moon --- v4: rephrase commit message add reviewed by RB Alan Stern v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/host/ohci-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 89e6587c089b..3c4d68fd5c33 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -213,7 +213,6 @@ static void exynos_ohci_shutdown(struct platform_device *pdev) hcd->driver->shutdown(hcd); } -#ifdef CONFIG_PM static int exynos_ohci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -250,19 +249,13 @@ static int exynos_ohci_resume(struct device *dev) return 0; } -#else -#define exynos_ohci_suspend NULL -#define exynos_ohci_resume NULL -#endif static const struct ohci_driver_overrides exynos_overrides __initconst = { .extra_priv_size = sizeof(struct exynos_ohci_hcd), }; -static const struct dev_pm_ops exynos_ohci_pm_ops = { - .suspend = exynos_ohci_suspend, - .resume = exynos_ohci_resume, -}; +static DEFINE_SIMPLE_DEV_PM_OPS(exynos_ohci_pm_ops, + exynos_ohci_suspend, exynos_ohci_resume); #ifdef CONFIG_OF static const struct of_device_id exynos_ohci_match[] = { @@ -278,7 +271,7 @@ static struct platform_driver exynos_ohci_driver = { .shutdown = exynos_ohci_shutdown, .driver = { .name = "exynos-ohci", - .pm = &exynos_ohci_pm_ops, + .pm = pm_ptr(&exynos_ohci_pm_ops), .of_match_table = of_match_ptr(exynos_ohci_match), } }; From patchwork Sun Apr 21 13:47:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 790921 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D411C29F; Sun, 21 Apr 2024 13:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707339; cv=none; b=HaIH67yBmeXRY/KqGy6tnDHKsBZzW6zWT/ubVefid1ChRAGJfaewdJ6hUIy6573IBqBdG5p+MefNOhyw2VQLw/xiKdbep26eaHEkm6X7DsQOXMxhMxTIDA1/TodivtND3S4dOVGWESoqtW/YgImF73f4Dr7wW3QPsVdWMwoOX6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713707339; c=relaxed/simple; bh=Y9jIyElOMp31XHXfaCIVTLoMyn8wDqkA34DCh0awnvg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oinBLTiDXDSL14ka0l2Wwo3jnqvCtylnFqAL4PBSWjpu8v9kykt1SHouYi50v8PXPOnaGryhzVy0xKmaEu9SmP4OW6WWLnc67eYIXBxlYVeMJCGM37hTULXWAGTSFq2er5Jj7qImGxoUTvBZSacIhowaZV+8/S4el5/yGj73URk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Tx6zQLop; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tx6zQLop" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6ed627829e6so4016303b3a.1; Sun, 21 Apr 2024 06:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707338; x=1714312138; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vAq3AHvWEQFsKDgpu//rdmbRIcBJ6dLOs4RYotedEeg=; b=Tx6zQLopnJkmPQeroWlWtNHVVFP4NZSBfP+CV8kfhhmDeB5pPfh86sFz43FOO2aISl XJTWhIZfwNCaOkV2JxSB/2Kp+VhB75CX9bx6BKzccB/UQIs9VbqfZqX/0kRCLZI7S7de 1kYvhPh7MD0zc+G0sCCoA3hTEVug8jK9sr32IderaCqZbHWQlMVKHj1+WeK5OVwqvEub w/8kdSAi/gHHtRQl7pOjxM+AWWeszXFVnZxxIcZ/t9SvUAsba0Z31snoQylO1yqNJYwk jEbr5W9XuDPRAkedjdSKip6agfJy6E9G/Fq9xE61GzYGSEkpV6ehzcltkglaRFpMyQ8o FQWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707338; x=1714312138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vAq3AHvWEQFsKDgpu//rdmbRIcBJ6dLOs4RYotedEeg=; b=e7WmupRFU921uCvrnLtLYigQJ76w4ESoOd539E3UsTxfLxXaF3uwMChEG6DjEVel1u +7zNAyhPws//rtzlmsk08S0crhs6hm+w/cx/NCiwm6c4M/gekCNid2R9knP+LWoxFNjK ONnney3Fkyrpm1TGV63XZaCQksTSkUiyZAsgTmA3i0g4c6J1PG3A3b6PTIVAYn1zOfDU 1Ms+8pXFNl+8RLOSgUJvhQRcgeFCytIDYsRRBFSTmR6CjQ9ECdlfYF7mM4oLGGzHefQ2 DEbV982YhVTkRakN2VCFzVSZvdJddNueg6VKz6wfYJW75/U8sDZjUFp7zDlMusxKhr7r aFMA== X-Forwarded-Encrypted: i=1; AJvYcCXBoWA/ya0WcTFFIkn0PToMHCKCDmSfMcUZlCYdc8gitb9a9cltQdTNFUeeW0n2LZGrjnctEazVcXTX3k2vY4BaFLpddiahJKl9I2rN6IC8ZILkt0KUPx4atRRZg3TQx+mwo8Iof6BTgkUgRe11bk41Gv/nHKMCDZ8XKDWCPkABxqjssY6e49zRIiU= X-Gm-Message-State: AOJu0YyCEZsUT7bnWOzw+I5Su3m60xozxW/ku7Umyc7FMvOqv8b3BN/i cjYU97miwnm2SWuS68ImMsFe0HPisaoHEj2OFFBle++cKmKtq2wn X-Google-Smtp-Source: AGHT+IFqFGNGrYSxduO+G3kiUy/CR5IuQrcVEgPwVltGpWh2slVvuWUY98I8IosXloAx10/SaETCIw== X-Received: by 2002:aa7:8883:0:b0:6ea:bf1c:9dfd with SMTP id z3-20020aa78883000000b006eabf1c9dfdmr10512702pfe.27.1713707337795; Sun, 21 Apr 2024 06:48:57 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:57 -0700 (PDT) From: Anand Moon To: Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/5] usb: dwc3: exynos: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Sun, 21 Apr 2024 19:17:34 +0530 Message-ID: <20240421134752.2652-6-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This macro has the advantage over SET_SYSTEM_SLEEP_PM_OPS that we don't have to care about when the functions are actually used. Also make use of pm_sleep_ptr() to discard all PM_SLEEP related stuff if CONFIG_PM_SLEEP isn't enabled. Acked-by: Thinh Nguyen Signed-off-by: Anand Moon --- v4 Fix typo in commit message SIMPLE_DEV_PM_OPS to SET_SYSTEM_SLEEP_PM_OPS Add Acked by Thinh Nguyen v3: fix using new DEFINE_SIMPLE_DEV_PM_OPS PM macro hence change the $subject and the commit message v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/dwc3/dwc3-exynos.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 5d365ca51771..3427522a7c6a 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -187,7 +187,6 @@ static const struct of_device_id exynos_dwc3_match[] = { }; MODULE_DEVICE_TABLE(of, exynos_dwc3_match); -#ifdef CONFIG_PM_SLEEP static int dwc3_exynos_suspend(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); @@ -230,14 +229,8 @@ static int dwc3_exynos_resume(struct device *dev) return 0; } -static const struct dev_pm_ops dwc3_exynos_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dwc3_exynos_suspend, dwc3_exynos_resume) -}; - -#define DEV_PM_OPS (&dwc3_exynos_dev_pm_ops) -#else -#define DEV_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +static DEFINE_SIMPLE_DEV_PM_OPS(dwc3_exynos_dev_pm_ops, + dwc3_exynos_suspend, dwc3_exynos_resume); static struct platform_driver dwc3_exynos_driver = { .probe = dwc3_exynos_probe, @@ -245,7 +238,7 @@ static struct platform_driver dwc3_exynos_driver = { .driver = { .name = "exynos-dwc3", .of_match_table = exynos_dwc3_match, - .pm = DEV_PM_OPS, + .pm = pm_sleep_ptr(&dwc3_exynos_dev_pm_ops), }, };